-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85747d3
commit f9aedd0
Showing
9 changed files
with
222 additions
and
0 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
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,31 @@ | ||
#include "Mouse.h" | ||
|
||
#include "Context.h" | ||
|
||
static MouseDelta current; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void Mouse_Update() { | ||
Ship::Coords coords = Ship::Context::GetInstance()->GetWindow()->GetMouseDelta(); | ||
current.x = coords.x; | ||
current.y = coords.y; | ||
} | ||
|
||
MouseDelta Mouse_GetDelta() { | ||
return current; | ||
} | ||
|
||
void Mouse_SetCursorPos(s32 x, s32 y) { | ||
Ship::Context::GetInstance()->GetWindow()->SetMousePos({ x, y }); | ||
} | ||
|
||
bool Mouse_IsCaptured() { | ||
return Ship::Context::GetInstance()->GetWindow()->IsMouseCaptured(); | ||
} | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif |
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,22 @@ | ||
// TODO: Maybe this file should be part of BenPort | ||
#pragma once | ||
|
||
#include "ultratypes.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct MouseDelta { | ||
s32 x; | ||
s32 y; | ||
} MouseDelta; | ||
|
||
void Mouse_Update(); | ||
MouseDelta Mouse_GetDelta(); | ||
void Mouse_SetCursorPos(s32 x, s32 y); | ||
bool Mouse_IsCaptured(); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif |
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
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