🚨 clean up a few lint errors and start building a new game
parent
06c173e6da
commit
f5da7b5188
|
@ -0,0 +1,28 @@
|
||||||
|
use opengl_rust::prelude::*;
|
||||||
|
|
||||||
|
use anyhow::Result;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main () -> Result <()> {
|
||||||
|
let sdl_context = sdl2::init ().map_err (|e| anyhow! ("Can't init SDL: {}", e))?;
|
||||||
|
let video_subsystem = sdl_context.video ().map_err (|e| anyhow! ("Can't get SDL video subsystem: {}", e))?;
|
||||||
|
let window = video_subsystem.window ("3D platformer", 1280, 720)
|
||||||
|
.position_centered ()
|
||||||
|
.opengl ()
|
||||||
|
.build ()
|
||||||
|
?;
|
||||||
|
|
||||||
|
gl::load_with (|s| {
|
||||||
|
video_subsystem.gl_get_proc_address (s) as *const _
|
||||||
|
});
|
||||||
|
|
||||||
|
if ! gl::ClearColor::is_loaded () {
|
||||||
|
bail! ("gl::ClearColor didn't load, something is wrong with OpenGL");
|
||||||
|
}
|
||||||
|
|
||||||
|
let gl_ctx = window.gl_create_context ().map_err (|e| anyhow! ("Can't create OpenGL context: {}", e))?;
|
||||||
|
|
||||||
|
window.gl_make_current (&gl_ctx).map_err (|e| anyhow! ("Can't make OpenGL context current: {}", e))?;
|
||||||
|
|
||||||
|
Ok (())
|
||||||
|
}
|
|
@ -1,37 +1,4 @@
|
||||||
use std::{
|
use opengl_rust::prelude::*;
|
||||||
convert::TryInto,
|
|
||||||
ffi::{
|
|
||||||
CString,
|
|
||||||
c_void,
|
|
||||||
},
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
|
|
||||||
use anyhow::{
|
|
||||||
anyhow,
|
|
||||||
Context,
|
|
||||||
};
|
|
||||||
use glam::{
|
|
||||||
Mat4,
|
|
||||||
Vec3,
|
|
||||||
};
|
|
||||||
use sdl2::{
|
|
||||||
event::Event,
|
|
||||||
keyboard::{Keycode, Scancode},
|
|
||||||
};
|
|
||||||
use tracing::{
|
|
||||||
debug,
|
|
||||||
instrument,
|
|
||||||
};
|
|
||||||
|
|
||||||
use opengl_rust::{
|
|
||||||
glezz,
|
|
||||||
gpu_buffers,
|
|
||||||
network_protocol::*,
|
|
||||||
quinn_common::make_client_endpoint,
|
|
||||||
shader,
|
|
||||||
timestep::TimeStep,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GameState {
|
struct GameState {
|
||||||
logic_frames: u64,
|
logic_frames: u64,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#[macro_use]
|
|
||||||
extern crate iota;
|
extern crate iota;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
@ -10,6 +9,7 @@ pub mod gl_state;
|
||||||
pub mod gpu_buffers;
|
pub mod gpu_buffers;
|
||||||
pub mod network_protocol;
|
pub mod network_protocol;
|
||||||
pub mod physics;
|
pub mod physics;
|
||||||
|
pub mod prelude;
|
||||||
pub mod quinn_common;
|
pub mod quinn_common;
|
||||||
pub mod renderable_model;
|
pub mod renderable_model;
|
||||||
pub mod shader;
|
pub mod shader;
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
pub use std::{
|
||||||
|
convert::TryInto,
|
||||||
|
ffi::{
|
||||||
|
CString,
|
||||||
|
c_void,
|
||||||
|
},
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub use anyhow::{
|
||||||
|
anyhow,
|
||||||
|
bail,
|
||||||
|
Context,
|
||||||
|
};
|
||||||
|
pub use glam::{
|
||||||
|
Mat4,
|
||||||
|
Vec3,
|
||||||
|
};
|
||||||
|
pub use sdl2::{
|
||||||
|
event::Event,
|
||||||
|
keyboard::{Keycode, Scancode},
|
||||||
|
};
|
||||||
|
pub use tracing::{
|
||||||
|
debug,
|
||||||
|
instrument,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub use crate::{
|
||||||
|
glezz,
|
||||||
|
gpu_buffers,
|
||||||
|
network_protocol::*,
|
||||||
|
quinn_common::make_client_endpoint,
|
||||||
|
shader,
|
||||||
|
timestep::TimeStep,
|
||||||
|
};
|
|
@ -2,7 +2,7 @@ use quinn::{
|
||||||
Certificate, CertificateChain, ClientConfig, ClientConfigBuilder, Endpoint, Incoming,
|
Certificate, CertificateChain, ClientConfig, ClientConfigBuilder, Endpoint, Incoming,
|
||||||
PrivateKey, ServerConfig, ServerConfigBuilder, TransportConfig,
|
PrivateKey, ServerConfig, ServerConfigBuilder, TransportConfig,
|
||||||
};
|
};
|
||||||
use std::{error::Error, net::SocketAddr, sync::Arc};
|
use std::{net::SocketAddr, sync::Arc};
|
||||||
|
|
||||||
/// Constructs a QUIC endpoint configured for use a client only.
|
/// Constructs a QUIC endpoint configured for use a client only.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue