ebiten/ui/cocoa/ebiten_content_view.c

65 lines
1.4 KiB
C
Raw Normal View History

2013-11-23 10:10:15 +01:00
// -*- objc -*-
#include "ebiten_content_view.h"
#include "input.h"
void ebiten_MouseStateUpdated(void* nativeWindow, InputType inputType, int x, int y);
2013-11-23 10:10:15 +01:00
@implementation EbitenContentView {
}
- (BOOL)acceptsFirstResponder {
return YES;
}
2013-11-23 10:10:15 +01:00
- (BOOL)isFlipped {
return YES;
}
- (void)keyDown:(NSEvent*)theEvent {
[self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
}
- (void)insertText:(id)aString {
}
2013-11-23 10:10:15 +01:00
- (void)mouseDown:(NSEvent*)theEvent {
NSPoint location = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
int x = location.x;
int y = location.y;
ebiten_MouseStateUpdated([self window], 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;
ebiten_MouseStateUpdated([self window], 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;
ebiten_MouseStateUpdated([self window], InputTypeMouseDragged, x, y);
}
- (void)moveDown:(id)sender {
}
- (void)moveLeft:(id)sender {
}
- (void)moveRight:(id)sender {
}
- (void)moveUp:(id)sender {
2013-11-23 10:10:15 +01:00
}
@end