added partial mouse events on osx
This commit is contained in:
@@ -486,3 +486,16 @@ void App::resize(float w, float h)
|
||||
YGNodeStyleSetHeight(y_root, height);
|
||||
update_layout();
|
||||
}
|
||||
|
||||
void App::mouse_down(int button, float x, float y)
|
||||
{
|
||||
printf("mouse click %f %f\n", x, y);
|
||||
}
|
||||
void App::mouse_move(float x, float y)
|
||||
{
|
||||
|
||||
}
|
||||
void App::mouse_up(int button, float x, float y)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ public:
|
||||
void create();
|
||||
void update(float dt);
|
||||
void resize(float w, float h);
|
||||
void mouse_down(int button, float x, float y);
|
||||
void mouse_move(float x, float y);
|
||||
void mouse_up(int button, float x, float y);
|
||||
void update_layout();
|
||||
void load_layout();
|
||||
};
|
||||
|
||||
@@ -192,6 +192,21 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
|
||||
|
||||
[super renewGState];
|
||||
}
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_down(0, mouseLoc.x, mouseLoc.y);
|
||||
}
|
||||
- (void)mouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_up(0, mouseLoc.x, mouseLoc.y);
|
||||
}
|
||||
- (void)mouseMoved:(NSEvent *)theEvent
|
||||
{
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, mouseLoc.y);
|
||||
}
|
||||
@end
|
||||
|
||||
@interface Window : NSWindow
|
||||
|
||||
Reference in New Issue
Block a user