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 {
fn create() -> Self;
fn init() {}
type GlslCompileContext;
type GlslProgram;

View file

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

View file

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

View file

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