-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Several changed pertaining to UI and the new event system. (WIP)
- Loading branch information
1 parent
2a70420
commit 5cecfc1
Showing
29 changed files
with
711 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package net.aoba.event.events; | ||
|
||
import java.util.ArrayList; | ||
|
||
import net.aoba.event.listeners.AbstractListener; | ||
import net.aoba.event.listeners.KeyDownListener; | ||
|
||
public class KeyDownEvent extends AbstractEvent{ | ||
private final long window; | ||
private final int key; | ||
private final int scancode; | ||
private final int action; | ||
private final int modifiers; | ||
|
||
public KeyDownEvent(long window, int key, int scancode, int action, int modifiers) { | ||
super(); | ||
this.window = window; | ||
this.key = key; | ||
this.scancode = scancode; | ||
this.action = action; | ||
this.modifiers = modifiers; | ||
} | ||
|
||
public long GetWindow() { | ||
return window; | ||
} | ||
|
||
public int GetKey() { | ||
return key; | ||
} | ||
|
||
public int GetScanCode() { | ||
return scancode; | ||
} | ||
|
||
public int GetAction() { | ||
return action; | ||
} | ||
|
||
public int GetModifiers() { | ||
return modifiers; | ||
} | ||
|
||
@Override | ||
public void Fire(ArrayList<? extends AbstractListener> listeners) { | ||
for(AbstractListener listener : listeners) { | ||
KeyDownListener keyDownListener = (KeyDownListener) listener; | ||
keyDownListener.OnKeyDown(this); | ||
} | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Class<KeyDownListener> GetListenerClassType() { | ||
return KeyDownListener.class; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/net/aoba/event/events/MouseLeftClickEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package net.aoba.event.events; | ||
|
||
import java.util.ArrayList; | ||
import net.aoba.event.listeners.AbstractListener; | ||
import net.aoba.event.listeners.MouseLeftClickListener; | ||
|
||
public class MouseLeftClickEvent extends AbstractEvent{ | ||
|
||
int mouseX; | ||
int mouseY; | ||
|
||
public MouseLeftClickEvent(int mouseX, int mouseY) { | ||
super(); | ||
this.mouseX = mouseX; | ||
this.mouseY = mouseY; | ||
} | ||
|
||
public int GetMouseX() { | ||
return mouseX; | ||
} | ||
|
||
public int GetMouseY() { | ||
return mouseY; | ||
} | ||
|
||
@Override | ||
public void Fire(ArrayList<? extends AbstractListener> listeners) { | ||
for(AbstractListener listener : listeners) { | ||
MouseLeftClickListener mouseLeftClickListener = (MouseLeftClickListener) listener; | ||
mouseLeftClickListener.OnMouseLeftClick(this); | ||
} | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Class<MouseLeftClickListener> GetListenerClassType() { | ||
return MouseLeftClickListener.class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package net.aoba.event.events; | ||
|
||
import java.util.ArrayList; | ||
|
||
import net.aoba.event.listeners.AbstractListener; | ||
import net.aoba.event.listeners.MouseMoveListener; | ||
import net.aoba.event.listeners.MouseScrollListener; | ||
|
||
public class MouseMoveEvent extends AbstractEvent{ | ||
private double horizontal; | ||
private double vertical; | ||
|
||
public MouseMoveEvent(double x, double y) { | ||
super(); | ||
this.horizontal = x; | ||
this.vertical = y; | ||
} | ||
|
||
public double GetVertical() { | ||
return vertical; | ||
} | ||
|
||
public double GetHorizontal() { | ||
return horizontal; | ||
} | ||
|
||
@Override | ||
public void Fire(ArrayList<? extends AbstractListener> listeners) { | ||
for(AbstractListener listener : listeners) { | ||
MouseMoveListener mouseMoveListener = (MouseMoveListener) listener; | ||
mouseMoveListener.OnMouseMove(this); | ||
} | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Class<MouseScrollListener> GetListenerClassType() { | ||
return MouseScrollListener.class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package net.aoba.event.listeners; | ||
|
||
import net.aoba.event.events.KeyDownEvent; | ||
|
||
public interface KeyDownListener extends AbstractListener { | ||
public abstract void OnKeyDown(KeyDownEvent event); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/net/aoba/event/listeners/MouseLeftClickListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package net.aoba.event.listeners; | ||
|
||
import net.aoba.event.events.MouseLeftClickEvent; | ||
|
||
public interface MouseLeftClickListener extends AbstractListener { | ||
public abstract void OnMouseLeftClick(MouseLeftClickEvent event); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/net/aoba/event/listeners/MouseMoveListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package net.aoba.event.listeners; | ||
|
||
import net.aoba.event.events.MouseMoveEvent; | ||
|
||
public interface MouseMoveListener extends AbstractListener { | ||
public abstract void OnMouseMove(MouseMoveEvent mouseMoveEvent); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.