format
This commit is contained in:
parent
b873398a79
commit
e2d5748733
41 changed files with 291 additions and 268 deletions
|
|
@ -1,8 +1,13 @@
|
|||
pub enum EventType {
|
||||
None,
|
||||
WindowClose, WindowResize,
|
||||
KeyPressed, KeyReleased,
|
||||
MouseButtonPressed, MouseButtonReleased, MouseMoved, MouseScrolled
|
||||
WindowClose,
|
||||
WindowResize,
|
||||
KeyPressed,
|
||||
KeyReleased,
|
||||
MouseButtonPressed,
|
||||
MouseButtonReleased,
|
||||
MouseMoved,
|
||||
MouseScrolled,
|
||||
}
|
||||
|
||||
/// Base Class for Engine Events
|
||||
|
|
@ -13,4 +18,3 @@ pub trait Event {
|
|||
/// Emits the Event
|
||||
fn emit();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@ use crate::event::Event;
|
|||
|
||||
pub trait EventListener {
|
||||
fn on_event<T: Event>(event: T);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
use crate::{event::{Event, EventType}, events::key_events::KeyEvent};
|
||||
use crate::{
|
||||
event::{Event, EventType},
|
||||
events::key_events::KeyEvent,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct KeyPressedEvent{}
|
||||
struct KeyPressedEvent {}
|
||||
|
||||
const KEY_PRESSED_EVENT_NAME: &str = "KeyPressedEvent";
|
||||
|
||||
|
|
@ -13,12 +16,8 @@ impl Event for KeyPressedEvent {
|
|||
fn get_event_type() -> EventType {
|
||||
EventType::KeyPressed
|
||||
}
|
||||
|
||||
fn emit() {
|
||||
|
||||
}
|
||||
|
||||
fn emit() {}
|
||||
}
|
||||
|
||||
impl super::KeyEvent for KeyPressedEvent {
|
||||
|
||||
}
|
||||
impl super::KeyEvent for KeyPressedEvent {}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,5 @@ use crate::event::Event;
|
|||
pub mod key_pressed_event;
|
||||
|
||||
pub trait KeyEvent: Event {
|
||||
fn get_key_code() {
|
||||
|
||||
}
|
||||
}
|
||||
fn get_key_code() {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
pub mod key_events;
|
||||
pub mod mouse_events;
|
||||
pub mod window_events;
|
||||
pub mod window_events;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
use crate::event::Event;
|
||||
|
||||
pub trait MouseEvent: Event {
|
||||
|
||||
}
|
||||
pub trait MouseEvent: Event {}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,4 @@ pub mod window_close_event;
|
|||
|
||||
use crate::event::Event;
|
||||
|
||||
pub trait WindowEvent: Event {
|
||||
|
||||
}
|
||||
pub trait WindowEvent: Event {}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
use crate::{event::Event, events::window_events::WindowEvent};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct WindowCloseEvent {
|
||||
|
||||
}
|
||||
pub struct WindowCloseEvent {}
|
||||
|
||||
impl Event for WindowCloseEvent {
|
||||
fn get_event_name() -> &'static str {
|
||||
|
|
@ -14,10 +12,7 @@ impl Event for WindowCloseEvent {
|
|||
todo!()
|
||||
}
|
||||
|
||||
fn emit(){
|
||||
}
|
||||
fn emit() {}
|
||||
}
|
||||
|
||||
impl WindowEvent for WindowCloseEvent {
|
||||
|
||||
}
|
||||
impl WindowEvent for WindowCloseEvent {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! Defines various Events for the Moonhare Game Engine
|
||||
pub mod event;
|
||||
pub mod event_listener;
|
||||
pub mod events;
|
||||
pub mod events;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue