move assert_renderer to

This commit is contained in:
griffi-gh 2023-02-10 00:49:05 +01:00
parent 39b97eb990
commit 7edf3529db
3 changed files with 14 additions and 11 deletions

View file

@ -1,17 +1,10 @@
use shipyard::{AllStoragesView, NonSendSync, UniqueView};
use glium::{Version, Api};
use shipyard::AllStoragesView;
use std::{env, net::SocketAddr};
use crate::{
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(
all_storages: AllStoragesView,
) {

View file

@ -57,6 +57,7 @@ use rendering::{
RenderTarget,
BackgroundColor,
clear_background,
assert_renderer,
primitives::init_primitives,
selection_box::render_selection_box,
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 control_flow::{exit_on_esc, insert_control_flow_unique, SetControlFlow};
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};
fn startup() -> Workload {

View file

@ -1,6 +1,7 @@
use shipyard::{Unique, NonSendSync, UniqueView, UniqueViewMut};
use glium::{
Display, Surface,
Version, Api,
glutin::{
event_loop::EventLoop,
window::WindowBuilder,
@ -34,10 +35,18 @@ impl Renderer {
.with_gl_profile(GlProfile::Core);
let display = Display::new(wb, cb, event_loop)
.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 }
}
}
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(
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
color: UniqueView<BackgroundColor>,