2013-11-23 10:10:15 +01:00
|
|
|
// -*- objc -*-
|
|
|
|
|
|
|
|
#include "ebiten_content_view.h"
|
|
|
|
#include "input.h"
|
|
|
|
|
2013-11-23 10:15:39 +01:00
|
|
|
void ebiten_InputUpdated(InputType inputType, int x, int y);
|
2013-11-23 10:10:15 +01:00
|
|
|
|
|
|
|
@implementation EbitenContentView {
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)isFlipped {
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)mouseDown:(NSEvent*)theEvent {
|
|
|
|
NSPoint location = [self convertPoint:[theEvent locationInWindow]
|
|
|
|
fromView:nil];
|
|
|
|
int x = location.x;
|
|
|
|
int y = location.y;
|
2013-11-23 10:15:39 +01:00
|
|
|
ebiten_InputUpdated(InputTypeMouseDown, x, y);
|
2013-11-23 10:10:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)mouseUp:(NSEvent*)theEvent {
|
|
|
|
(void)theEvent;
|
|
|
|
NSPoint location = [self convertPoint:[theEvent locationInWindow]
|
|
|
|
fromView:nil];
|
|
|
|
int x = location.x;
|
|
|
|
int y = location.y;
|
2013-11-23 10:15:39 +01:00
|
|
|
ebiten_InputUpdated(InputTypeMouseUp, x, y);
|
2013-11-23 10:10:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)mouseDragged:(NSEvent*)theEvent {
|
|
|
|
NSPoint location = [self convertPoint:[theEvent locationInWindow]
|
|
|
|
fromView:nil];
|
|
|
|
int x = location.x;
|
|
|
|
int y = location.y;
|
2013-11-23 10:15:39 +01:00
|
|
|
ebiten_InputUpdated(InputTypeMouseDragged, x, y);
|
2013-11-23 10:10:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|