-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: open file button, keypress/mouse wrapper, render on handled inp…
…ut, rounded rect stroke
- Loading branch information
Showing
8 changed files
with
192 additions
and
38 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,19 @@ | ||
#include "keys.h" | ||
|
||
void keys::on_mouse_move(gfx::Point position, os::KeyModifiers modifiers, os::PointerType pointerType, float pressure) { | ||
mouse_pos = position; | ||
} | ||
|
||
void keys::on_mouse_down(gfx::Point position, os::Event::MouseButton button, os::KeyModifiers modifiers, os::PointerType pointerType, float pressure) { | ||
mouse_pos = position; | ||
pressed_mouse_keys.insert(button); | ||
} | ||
|
||
void keys::on_mouse_up(gfx::Point position, os::Event::MouseButton button, os::KeyModifiers modifiers, os::PointerType pointerType) { | ||
mouse_pos = position; | ||
pressed_mouse_keys.erase(button); | ||
} | ||
|
||
bool keys::is_rect_pressed(gfx::Rect rect, os::Event::MouseButton button) { | ||
return rect.contains(mouse_pos) && pressed_mouse_keys.contains(button); | ||
} |
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,12 @@ | ||
#pragma once | ||
|
||
namespace keys { | ||
inline gfx::Point mouse_pos; | ||
inline std::unordered_set<os::Event::MouseButton> pressed_mouse_keys; | ||
|
||
void on_mouse_move(gfx::Point position, os::KeyModifiers modifiers, os::PointerType pointerType, float pressure); | ||
void on_mouse_down(gfx::Point position, os::Event::MouseButton button, os::KeyModifiers modifiers, os::PointerType pointerType, float pressure); | ||
void on_mouse_up(gfx::Point position, os::Event::MouseButton button, os::KeyModifiers modifiers, os::PointerType pointerType); | ||
|
||
bool is_rect_pressed(gfx::Rect rect, os::Event::MouseButton button); | ||
} |
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.