This commit is contained in:
Michael Zhang 2020-06-08 02:40:49 -05:00
parent d63beb5152
commit 70d28b43f1
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
4 changed files with 12 additions and 7 deletions

View file

@ -1,5 +1,5 @@
pub trait Platform { pub trait Platform {
fn create() -> Self; fn init() {}
type GlslCompileContext; type GlslCompileContext;
type GlslProgram; type GlslProgram;

View file

@ -5,6 +5,6 @@ use wedge_core::Platform;
use crate::platform::DesktopPlatform; use crate::platform::DesktopPlatform;
fn main() { fn main() {
let platform = DesktopPlatform::create(); let platform = DesktopPlatform::new();
wedge_core::run_with(platform); wedge_core::run_with(platform);
} }

View file

@ -1,13 +1,16 @@
use glium::{Display, Program, ProgramCreationError}; use glium::{Display, Program, ProgramCreationError};
use wedge_core::Platform; use wedge_core::Platform;
pub struct DesktopPlatform {} pub struct DesktopPlatform {
}
impl Platform for DesktopPlatform { impl DesktopPlatform {
fn create() -> Self { pub fn new() -> Self {
DesktopPlatform {} DesktopPlatform {}
} }
}
impl Platform for DesktopPlatform {
type GlslCompileContext = Display; type GlslCompileContext = Display;
type GlslProgram = Program; type GlslProgram = Program;
type GlslError = ProgramCreationError; type GlslError = ProgramCreationError;

View file

@ -5,11 +5,13 @@ use wedge_core::Platform;
pub struct WebPlatform {} pub struct WebPlatform {}
impl Platform for WebPlatform { impl WebPlatform {
fn create() -> Self { pub fn new() -> Self {
WebPlatform {} WebPlatform {}
} }
}
impl Platform for WebPlatform {
// TODO: don't use strings lol // TODO: don't use strings lol
type GlslCompileContext = WebGlRenderingContext; type GlslCompileContext = WebGlRenderingContext;
type GlslProgram = WebGlProgram; type GlslProgram = WebGlProgram;