[DEV] update MacOs onput mouse to be compatible wit Linux
This commit is contained in:
parent
c6928fa591
commit
971acf0036
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
||||
Subproject commit 216f3a55280227155a8acded577dec14be5734a0
|
||||
Subproject commit 9e93578be9d48f8cbf21de9fe56ceaf17eeb8b21
|
@ -11,62 +11,53 @@
|
||||
#import <ewol/renderer/MacOs/OpenglView.h>
|
||||
|
||||
@implementation MacOsAppDelegate
|
||||
|
||||
|
||||
@synthesize window=_window;
|
||||
|
||||
- (BOOL)application:(MacOsAppDelegate *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
OpenGLView *view=[[OpenGLView alloc]initWithFrame:[[NSScreen mainScreen] bounds]];
|
||||
// Override point for customization after application launch.
|
||||
[self.window addSubview:view];
|
||||
[self.window makeKeyAndVisible];
|
||||
return YES;
|
||||
- (BOOL)application:(MacOsAppDelegate *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
OpenGLView *view=[[OpenGLView alloc]initWithFrame:[[NSScreen mainScreen] bounds]];
|
||||
// Override point for customization after application launch.
|
||||
[self.window addSubview:view];
|
||||
[self.window makeKeyAndVisible];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(MacOsAppDelegate *)application
|
||||
{
|
||||
/*
|
||||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
- (void)applicationWillResignActive:(MacOsAppDelegate *)application {
|
||||
/*
|
||||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(MacOsAppDelegate *)application
|
||||
{
|
||||
/*
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
- (void)applicationDidEnterBackground:(MacOsAppDelegate *)application {
|
||||
/*
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(MacOsAppDelegate *)application
|
||||
{
|
||||
/*
|
||||
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
*/
|
||||
- (void)applicationWillEnterForeground:(MacOsAppDelegate *)application {
|
||||
/*
|
||||
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
*/
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(MacOsAppDelegate *)application
|
||||
{
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
- (void)applicationDidBecomeActive:(MacOsAppDelegate *)application {
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(MacOsAppDelegate *)application
|
||||
{
|
||||
/*
|
||||
Called when the application is about to terminate.
|
||||
Save data if appropriate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
- (void)applicationWillTerminate:(MacOsAppDelegate *)application {
|
||||
/*
|
||||
Called when the application is about to terminate.
|
||||
Save data if appropriate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_window release];
|
||||
[super dealloc];
|
||||
- (void)dealloc {
|
||||
[_window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -11,9 +11,7 @@
|
||||
|
||||
#include <ewol/key.h>
|
||||
|
||||
namespace MacOs
|
||||
{
|
||||
|
||||
namespace MacOs {
|
||||
// return true if a flush is needed
|
||||
bool draw(bool _displayEveryTime);
|
||||
/**
|
||||
@ -21,11 +19,9 @@ namespace MacOs
|
||||
* @param[in] _size new size of the windows.
|
||||
*/
|
||||
void resize(float _x, float _y);
|
||||
|
||||
void setMouseState(int32_t _id, bool _isDown, float _x, float _y);
|
||||
void setMouseMotion(int32_t _id, float _x, float _y);
|
||||
void setKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -12,79 +12,75 @@
|
||||
#import <ewol/renderer/MacOs/OpenglView.h>
|
||||
#import <ewol/renderer/MacOs/AppDelegate.h>
|
||||
|
||||
int mm_main(int argc, const char *argv[])
|
||||
{
|
||||
|
||||
[NSAutoreleasePool new];
|
||||
|
||||
[NSApplication sharedApplication];
|
||||
// set the quit policy and all stadard for Mac
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// -- basic menu bar creation :
|
||||
// ---------------------------------------------------------------
|
||||
// set the basic menu bar (stadard on Mac OSX)
|
||||
id menubar = [[NSMenu new] autorelease];
|
||||
//add an item
|
||||
id appMenuItem = [[NSMenuItem new] autorelease];
|
||||
// add the item to the menu bar:
|
||||
[menubar addItem:appMenuItem];
|
||||
// set the main menu in the menu bar ...
|
||||
[NSApp setMainMenu:menubar];
|
||||
int mm_main(int argc, const char *argv[]) {
|
||||
[NSAutoreleasePool new];
|
||||
|
||||
id appMenu = [[NSMenu new] autorelease];
|
||||
id appName = [[NSProcessInfo processInfo] processName];
|
||||
// create the label to qui the application :
|
||||
id quitTitle = [@"Quit " stringByAppendingString:appName];
|
||||
// create the item to quit the appllication with META+q at shortCut
|
||||
id quitMenuItem = [ [ [NSMenuItem alloc] initWithTitle:quitTitle
|
||||
action:@selector(terminate:) keyEquivalent:@"q"] autorelease];
|
||||
// add the item to the menu:
|
||||
[appMenu addItem:quitMenuItem];
|
||||
// set the application menu to the main app menu ...
|
||||
[appMenuItem setSubmenu:appMenu];
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// -- basic windows creation :
|
||||
// ---------------------------------------------------------------
|
||||
// create a windows of size 800/600
|
||||
id window = [ [ [NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
||||
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
|
||||
autorelease];
|
||||
[NSApplication sharedApplication];
|
||||
// set the quit policy and all stadard for Mac
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// -- basic menu bar creation :
|
||||
// ---------------------------------------------------------------
|
||||
// set the basic menu bar (stadard on Mac OSX)
|
||||
id menubar = [[NSMenu new] autorelease];
|
||||
//add an item
|
||||
id appMenuItem = [[NSMenuItem new] autorelease];
|
||||
// add the item to the menu bar:
|
||||
[menubar addItem:appMenuItem];
|
||||
// set the main menu in the menu bar ...
|
||||
[NSApp setMainMenu:menubar];
|
||||
|
||||
id appMenu = [[NSMenu new] autorelease];
|
||||
id appName = [[NSProcessInfo processInfo] processName];
|
||||
// create the label to qui the application :
|
||||
id quitTitle = [@"Quit " stringByAppendingString:appName];
|
||||
// create the item to quit the appllication with META+q at shortCut
|
||||
id quitMenuItem = [ [ [NSMenuItem alloc] initWithTitle:quitTitle
|
||||
action:@selector(terminate:) keyEquivalent:@"q"] autorelease];
|
||||
// add the item to the menu:
|
||||
[appMenu addItem:quitMenuItem];
|
||||
// set the application menu to the main app menu ...
|
||||
[appMenuItem setSubmenu:appMenu];
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// -- basic windows creation :
|
||||
// ---------------------------------------------------------------
|
||||
// create a windows of size 800/600
|
||||
id window = [ [ [NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
||||
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
|
||||
autorelease];
|
||||
// set the windows at a specific position :
|
||||
[window cascadeTopLeftFromPoint:NSMakePoint(50,50)];
|
||||
// set the windows resizable
|
||||
[window setStyleMask:[window styleMask] | NSResizableWindowMask];
|
||||
// oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask];
|
||||
// set the title
|
||||
[window setTitle:appName];
|
||||
|
||||
[window setAcceptsMouseMovedEvents:YES];
|
||||
// ???
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
NSRect window_frame = [window frame];
|
||||
|
||||
OpenGLView* view=[[OpenGLView alloc]initWithFrame:window_frame]; //NSMakeRect(0, 0, 800, 600)];
|
||||
[window setContentView:view];
|
||||
[window cascadeTopLeftFromPoint:NSMakePoint(50,50)];
|
||||
// set the windows resizable
|
||||
[window setStyleMask:[window styleMask] | NSResizableWindowMask];
|
||||
// oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask];
|
||||
// set the title
|
||||
[window setTitle:appName];
|
||||
|
||||
[window setAcceptsMouseMovedEvents:YES];
|
||||
// ???
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
NSRect window_frame = [window frame];
|
||||
|
||||
OpenGLView* view=[[OpenGLView alloc]initWithFrame:window_frame]; //NSMakeRect(0, 0, 800, 600)];
|
||||
[window setContentView:view];
|
||||
[view setAutoresizesSubviews:YES];
|
||||
|
||||
// Override point for customization after application launch.
|
||||
//[window addSubview:view];
|
||||
//[window addChildWindow:view];
|
||||
//[window makeKeyAndVisible];
|
||||
|
||||
[window setDelegate:view];
|
||||
// return no error
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mm_run(void)
|
||||
{
|
||||
[NSApp run];
|
||||
// return no error
|
||||
return 0;
|
||||
|
||||
// Override point for customization after application launch.
|
||||
//[window addSubview:view];
|
||||
//[window addChildWindow:view];
|
||||
//[window makeKeyAndVisible];
|
||||
|
||||
[window setDelegate:view];
|
||||
// return no error
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mm_run(void) {
|
||||
[NSApp run];
|
||||
// return no error
|
||||
return 0;
|
||||
}
|
||||
|
@ -10,8 +10,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface OpenGLView : NSOpenGLView<NSWindowDelegate>
|
||||
{
|
||||
@interface OpenGLView : NSOpenGLView<NSWindowDelegate> {
|
||||
}
|
||||
- (void)prepareOpenGL;
|
||||
- (void)drawRect:(NSRect) bounds;
|
||||
|
@ -13,18 +13,16 @@
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/Dimension.h>
|
||||
|
||||
|
||||
@implementation OpenGLView
|
||||
|
||||
|
||||
static ewol::SpecialKey guiKeyBoardMode;
|
||||
|
||||
- (void) prepareOpenGL
|
||||
{
|
||||
EWOL_ERROR("prepare");
|
||||
GLint swapInt = 1;
|
||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; // set to vbl sync
|
||||
|
||||
GLint swapInt = 1;
|
||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; // set to vbl sync
|
||||
|
||||
// set system dpi size :
|
||||
NSScreen *screen = [NSScreen mainScreen];
|
||||
NSDictionary *description = [screen deviceDescription];
|
||||
@ -33,27 +31,25 @@ static ewol::SpecialKey guiKeyBoardMode;
|
||||
|
||||
ewol::dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width,
|
||||
(float)displayPixelSize.height/(float)displayPhysicalSize.height),
|
||||
ewol::Dimension::Millimeter);
|
||||
|
||||
ewol::Dimension::Millimeter);
|
||||
}
|
||||
|
||||
-(void) drawRect: (NSRect) bounds
|
||||
{
|
||||
MacOs::draw(true);
|
||||
glFlush();
|
||||
MacOs::draw(true);
|
||||
glFlush();
|
||||
}
|
||||
|
||||
-(void)reshape {
|
||||
EWOL_INFO("view reshape (" << [self frame].size.width << "," << [self frame].size.height << ")" );
|
||||
|
||||
// window resize; width and height are in pixel coordinates
|
||||
// but they are floats
|
||||
float width = [self frame].size.width;
|
||||
float height = [self frame].size.height;
|
||||
|
||||
// window resize; width and height are in pixel coordinates
|
||||
// but they are floats
|
||||
float width = [self frame].size.width;
|
||||
float height = [self frame].size.height;
|
||||
MacOs::resize(width,height);
|
||||
}
|
||||
|
||||
|
||||
-(void)mouseDown:(NSEvent *)event {
|
||||
NSPoint point = [event locationInWindow];
|
||||
//float x = [event locationInWindow].x; //point.x;
|
||||
@ -100,22 +96,90 @@ static ewol::SpecialKey guiKeyBoardMode;
|
||||
}
|
||||
-(void)otherMouseDown:(NSEvent *)event {
|
||||
NSPoint point = [event locationInWindow];
|
||||
EWOL_INFO("otherMouseDown : " << (float)point.x << " " << (float)point.y);
|
||||
int32_t btNumber = [event buttonNumber];
|
||||
switch (btNumber) {
|
||||
case 2: // 2 : Middle button
|
||||
btNumber = 2;
|
||||
break;
|
||||
case 3: // 3 : border button DOWN
|
||||
btNumber = 8;
|
||||
break;
|
||||
case 4: // 4 : border button UP
|
||||
btNumber = 9;
|
||||
break;
|
||||
case 5: // 5 : horizontal scroll Right to left
|
||||
btNumber = 11;
|
||||
break;
|
||||
case 6: // 6 : horizontal scroll left to Right
|
||||
btNumber = 10;
|
||||
break;
|
||||
case 7: // 7 : Red button
|
||||
btNumber = 12;
|
||||
break;
|
||||
default:
|
||||
btNumber = 15;
|
||||
break;
|
||||
}
|
||||
//EWOL_INFO("otherMouseDown : " << (float)point.x << " " << (float)point.y);
|
||||
MacOs::setMouseState(btNumber, true, point.x, point.y);
|
||||
}
|
||||
-(void)otherMouseDragged:(NSEvent *)event {
|
||||
NSPoint point = [event locationInWindow];
|
||||
EWOL_INFO("otherMouseDragged : " << (float)point.x << " " << (float)point.y);
|
||||
int32_t btNumber = [event buttonNumber];
|
||||
switch (btNumber) {
|
||||
case 2: // 2 : Middle button
|
||||
btNumber = 2;
|
||||
break;
|
||||
case 3: // 3 : border button DOWN
|
||||
btNumber = 8;
|
||||
break;
|
||||
case 4: // 4 : border button UP
|
||||
btNumber = 9;
|
||||
break;
|
||||
case 5: // 5 : horizontal scroll Right to left
|
||||
btNumber = 11;
|
||||
break;
|
||||
case 6: // 6 : horizontal scroll left to Right
|
||||
btNumber = 10;
|
||||
break;
|
||||
case 7: // 7 : Red button
|
||||
btNumber = 12;
|
||||
break;
|
||||
default:
|
||||
btNumber = 15;
|
||||
break;
|
||||
}
|
||||
//EWOL_INFO("otherMouseDragged : " << (float)point.x << " " << (float)point.y);
|
||||
MacOs::setMouseMotion(btNumber, point.x, point.y);
|
||||
}
|
||||
-(void)otherMouseUp:(NSEvent *)event {
|
||||
NSPoint point = [event locationInWindow];
|
||||
int32_t btNumber = [event buttonNumber];
|
||||
EWOL_INFO("otherMouseUp : " << (float)point.x << " " << (float)point.y << " bt id=" << btNumber );
|
||||
// 2 : Middle button
|
||||
// 3 : border button DOWN
|
||||
// 4 : border button UP
|
||||
// 7 : Red button
|
||||
// 5 : horizontal scroll Right to left
|
||||
// 6 : horizontal scroll left to Right
|
||||
switch (btNumber) {
|
||||
case 2: // 2 : Middle button
|
||||
btNumber = 2;
|
||||
break;
|
||||
case 3: // 3 : border button DOWN
|
||||
btNumber = 8;
|
||||
break;
|
||||
case 4: // 4 : border button UP
|
||||
btNumber = 9;
|
||||
break;
|
||||
case 5: // 5 : horizontal scroll Right to left
|
||||
btNumber = 11;
|
||||
break;
|
||||
case 6: // 6 : horizontal scroll left to Right
|
||||
btNumber = 10;
|
||||
break;
|
||||
case 7: // 7 : Red button
|
||||
btNumber = 12;
|
||||
break;
|
||||
default:
|
||||
btNumber = 15;
|
||||
break;
|
||||
}
|
||||
//EWOL_INFO("otherMouseUp : " << (float)point.x << " " << (float)point.y << " bt id=" << btNumber );
|
||||
MacOs::setMouseState(btNumber, false, point.x, point.y);
|
||||
}
|
||||
- (void)scrollWheel:(NSEvent *)event {
|
||||
NSPoint point = [event locationInWindow];
|
||||
@ -144,46 +208,34 @@ static ewol::SpecialKey guiKeyBoardMode;
|
||||
|
||||
// this generate all the event entry availlable ==> like a big keep focus ...
|
||||
- (BOOL)acceptsFirstResponder {
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)keyDown:(NSEvent *)theEvent {
|
||||
bool thisIsAReapeateKey = false;
|
||||
if ([theEvent isARepeat]) {
|
||||
thisIsAReapeateKey = true;
|
||||
}
|
||||
NSString *str = [theEvent charactersIgnoringModifiers];
|
||||
// TODO : set if for every char in the string !!!
|
||||
unichar c = [str characterAtIndex:0];
|
||||
/*
|
||||
if (c < ' ' || c > '~') { // only ASCII please
|
||||
c = 0;
|
||||
return;
|
||||
}
|
||||
*/
|
||||
//EWOL_DEBUG("KeyDown " << (char)c);
|
||||
MacOs::setKeyboard(guiKeyBoardMode, (char)c, true, thisIsAReapeateKey);
|
||||
if (true==thisIsAReapeateKey) {
|
||||
if ([theEvent isARepeat]) {
|
||||
thisIsAReapeateKey = true;
|
||||
}
|
||||
NSString *str = [theEvent charactersIgnoringModifiers];
|
||||
// TODO : set if for every char in the string !!!
|
||||
unichar c = [str characterAtIndex:0];
|
||||
//EWOL_DEBUG("KeyDown " << (char)c);
|
||||
MacOs::setKeyboard(guiKeyBoardMode, (char)c, true, thisIsAReapeateKey);
|
||||
if (true==thisIsAReapeateKey) {
|
||||
MacOs::setKeyboard(guiKeyBoardMode, (char)c, false, thisIsAReapeateKey);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)keyUp:(NSEvent *)theEvent {
|
||||
bool thisIsAReapeateKey = false;
|
||||
if ([theEvent isARepeat]) {
|
||||
thisIsAReapeateKey = true;
|
||||
}
|
||||
//EWOL_DEBUG("KeyUp ");
|
||||
NSString *str = [theEvent charactersIgnoringModifiers];
|
||||
unichar c = [str characterAtIndex:0];
|
||||
/*
|
||||
if (c < ' ' || c > '~') { // only ASCII please
|
||||
c = 0;
|
||||
return;
|
||||
}
|
||||
*/
|
||||
MacOs::setKeyboard(guiKeyBoardMode, (char)c, false, thisIsAReapeateKey);
|
||||
if (true==thisIsAReapeateKey) {
|
||||
if ([theEvent isARepeat]) {
|
||||
thisIsAReapeateKey = true;
|
||||
}
|
||||
//EWOL_DEBUG("KeyUp ");
|
||||
NSString *str = [theEvent charactersIgnoringModifiers];
|
||||
unichar c = [str characterAtIndex:0];
|
||||
MacOs::setKeyboard(guiKeyBoardMode, (char)c, false, thisIsAReapeateKey);
|
||||
if (true==thisIsAReapeateKey) {
|
||||
MacOs::setKeyboard(guiKeyBoardMode, (char)c, true, thisIsAReapeateKey);
|
||||
}
|
||||
}
|
||||
@ -193,30 +245,30 @@ static ewol::SpecialKey guiKeyBoardMode;
|
||||
static NSTimer *timer = nil;
|
||||
|
||||
- (void)windowDidResignMain:(NSNotification *)notification {
|
||||
// NSLog(@"window did resign main");
|
||||
[timer invalidate];
|
||||
|
||||
//game_deactivate(); // freeze, pause
|
||||
[self setNeedsDisplay:YES];
|
||||
// NSLog(@"window did resign main");
|
||||
[timer invalidate];
|
||||
|
||||
//game_deactivate(); // freeze, pause
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification *)notification {
|
||||
// NSLog(@"window did become main");
|
||||
|
||||
//game_activate();
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
timer = [NSTimer timerWithTimeInterval:FRAME_INTERVAL
|
||||
target:self
|
||||
selector:@selector(timerEvent:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
|
||||
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
|
||||
// NSLog(@"window did become main");
|
||||
|
||||
//game_activate();
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
timer = [NSTimer timerWithTimeInterval:FRAME_INTERVAL
|
||||
target:self
|
||||
selector:@selector(timerEvent:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
|
||||
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
- (void)timerEvent:(NSTimer *)t {
|
||||
//run_game();
|
||||
[self setNeedsDisplay:YES];
|
||||
//run_game();
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user