mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-25 21:28:20 -06:00
move assert_renderer to
This commit is contained in:
parent
39b97eb990
commit
7edf3529db
|
@ -1,17 +1,10 @@
|
||||||
use shipyard::{AllStoragesView, NonSendSync, UniqueView};
|
use shipyard::AllStoragesView;
|
||||||
use glium::{Version, Api};
|
|
||||||
use std::{env, net::SocketAddr};
|
use std::{env, net::SocketAddr};
|
||||||
use crate::{
|
use crate::{
|
||||||
networking::{GameType, ServerAddress},
|
networking::{GameType, ServerAddress},
|
||||||
state::GameState, rendering::Renderer
|
state::GameState
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn assert_renderer(
|
|
||||||
renderer: NonSendSync<UniqueView<Renderer>>
|
|
||||||
) {
|
|
||||||
assert!(renderer.display.is_glsl_version_supported(&Version(Api::GlEs, 3, 0)), "GLES 3.0 is not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn initialize_from_args(
|
pub fn initialize_from_args(
|
||||||
all_storages: AllStoragesView,
|
all_storages: AllStoragesView,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -57,6 +57,7 @@ use rendering::{
|
||||||
RenderTarget,
|
RenderTarget,
|
||||||
BackgroundColor,
|
BackgroundColor,
|
||||||
clear_background,
|
clear_background,
|
||||||
|
assert_renderer,
|
||||||
primitives::init_primitives,
|
primitives::init_primitives,
|
||||||
selection_box::render_selection_box,
|
selection_box::render_selection_box,
|
||||||
world::draw_world,
|
world::draw_world,
|
||||||
|
@ -67,7 +68,7 @@ use delta_time::{DeltaTime, init_delta_time};
|
||||||
use cursor_lock::{insert_lock_state, update_cursor_lock_state, lock_cursor_now};
|
use cursor_lock::{insert_lock_state, update_cursor_lock_state, lock_cursor_now};
|
||||||
use control_flow::{exit_on_esc, insert_control_flow_unique, SetControlFlow};
|
use control_flow::{exit_on_esc, insert_control_flow_unique, SetControlFlow};
|
||||||
use state::{is_ingame, is_ingame_or_loading, is_loading};
|
use state::{is_ingame, is_ingame_or_loading, is_loading};
|
||||||
use init::{initialize_from_args, assert_renderer};
|
use init::initialize_from_args;
|
||||||
use gui::{render_gui, init_gui, gui_testing, update_gui};
|
use gui::{render_gui, init_gui, gui_testing, update_gui};
|
||||||
|
|
||||||
fn startup() -> Workload {
|
fn startup() -> Workload {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use shipyard::{Unique, NonSendSync, UniqueView, UniqueViewMut};
|
use shipyard::{Unique, NonSendSync, UniqueView, UniqueViewMut};
|
||||||
use glium::{
|
use glium::{
|
||||||
Display, Surface,
|
Display, Surface,
|
||||||
|
Version, Api,
|
||||||
glutin::{
|
glutin::{
|
||||||
event_loop::EventLoop,
|
event_loop::EventLoop,
|
||||||
window::WindowBuilder,
|
window::WindowBuilder,
|
||||||
|
@ -34,10 +35,18 @@ impl Renderer {
|
||||||
.with_gl_profile(GlProfile::Core);
|
.with_gl_profile(GlProfile::Core);
|
||||||
let display = Display::new(wb, cb, event_loop)
|
let display = Display::new(wb, cb, event_loop)
|
||||||
.expect("Failed to create a glium Display");
|
.expect("Failed to create a glium Display");
|
||||||
|
log::info!("renderer: {}", display.get_opengl_renderer_string());
|
||||||
|
log::info!("oepngl {}", display.get_opengl_version_string());
|
||||||
Self { display }
|
Self { display }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn assert_renderer(
|
||||||
|
renderer: NonSendSync<UniqueView<Renderer>>
|
||||||
|
) {
|
||||||
|
assert!(renderer.display.is_glsl_version_supported(&Version(Api::GlEs, 3, 0)), "GLES 3.0 is not supported");
|
||||||
|
}
|
||||||
|
|
||||||
pub fn clear_background(
|
pub fn clear_background(
|
||||||
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
color: UniqueView<BackgroundColor>,
|
color: UniqueView<BackgroundColor>,
|
||||||
|
|
Loading…
Reference in a new issue