-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,041 changed files
with
124,128 additions
and
10,479 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,7 @@ | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface FGAppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property (copy, readonly) NSArray *windows; | ||
|
||
@end |
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,132 @@ | ||
|
||
#import "fg_app_delegate.h" | ||
#import "fg_view_controller.h" | ||
#import "fg_internal.h" | ||
#import "fg_main_ios.h" | ||
|
||
@interface FGAppDelegate () | ||
|
||
@property (copy) NSArray *windows; | ||
@property (strong) CADisplayLink *displayLink; | ||
|
||
- (void)pollEvents:(CADisplayLink *)sender; | ||
|
||
@end | ||
|
||
@implementation FGAppDelegate | ||
|
||
@synthesize windows; | ||
@synthesize displayLink; | ||
|
||
- (void)dealloc | ||
{ | ||
self.windows = nil; | ||
self.displayLink = nil; | ||
[super dealloc]; | ||
} | ||
|
||
- (BOOL)application:(UIApplication *)application | ||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
{ | ||
// Override point for customization after application launch. | ||
CGRect frame = [[UIScreen mainScreen] bounds]; | ||
NSMutableArray *mutableWindows = [NSMutableArray array]; | ||
for (SFG_Window *sfgWindow = (SFG_Window*)fgStructure.Windows.First; | ||
sfgWindow; | ||
sfgWindow = (SFG_Window*)sfgWindow->Node.Next) | ||
{ | ||
if (sfgWindow->IsMenu) continue; | ||
UIWindow *window = [[[UIWindow alloc] initWithFrame:frame] autorelease]; | ||
FGViewController *viewController = | ||
[[[FGViewController alloc] initWithSFGWindow:sfgWindow] autorelease]; | ||
window.rootViewController = viewController; | ||
[window makeKeyAndVisible]; | ||
[mutableWindows addObject:window]; | ||
} | ||
self.windows = mutableWindows; | ||
self.displayLink = [CADisplayLink | ||
displayLinkWithTarget:self selector:@selector(pollEvents:)]; | ||
[displayLink | ||
addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; | ||
return YES; | ||
} | ||
|
||
- (void)applicationWillResignActive:(UIApplication *)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:(UIApplication *)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:(UIApplication *)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:(UIApplication *)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:(UIApplication *)application | ||
{ | ||
// Called when the application is about to terminate. Save data if | ||
// appropriate. See also applicationDidEnterBackground:. | ||
} | ||
|
||
- (void)pollEvents:(CADisplayLink *)sender | ||
{ | ||
|
||
if (fgState.ExecState != GLUT_EXEC_STATE_RUNNING) exit(0); | ||
|
||
SFG_Window *window; | ||
|
||
glutMainLoopEvent(); | ||
/* | ||
* Step through the list of windows, seeing if there are any | ||
* that are not menus | ||
*/ | ||
for ( window = (SFG_Window*)fgStructure.Windows.First; | ||
window; | ||
window = (SFG_Window*)window->Node.Next) | ||
{ | ||
if (!(window->IsMenu)) | ||
{ | ||
break; | ||
} | ||
} | ||
if (!window) | ||
{ | ||
fgState.ExecState = GLUT_EXEC_STATE_STOP; | ||
} | ||
else | ||
{ | ||
if ( fgState.IdleCallback) | ||
{ | ||
if ( fgStructure.CurrentWindow && | ||
fgStructure.CurrentWindow->IsMenu) | ||
/* fail safe */ | ||
fgSetWindow(window); | ||
fgState.IdleCallback(); | ||
} | ||
} | ||
|
||
} | ||
|
||
@end |
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,42 @@ | ||
/* | ||
* fg_cursor_ios.c | ||
* | ||
* The Windows-specific mouse cursor related stuff. | ||
* | ||
* Copyright (C) 2014 Google, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
#include <GL/freeglut.h> | ||
#include "fg_internal.h" | ||
|
||
void fgPlatformSetCursor ( SFG_Window *window, int cursorID ) | ||
{ | ||
/* No-op: no visible cursor on touchscreens */ | ||
} | ||
|
||
void fgPlatformWarpPointer ( int x, int y ) | ||
{ | ||
/* Even if there's no pointer on touchscreen, keep track of the | ||
last position, e.g. for menus */ | ||
SFG_Window* window = fgStructure.CurrentWindow; | ||
window->State.MouseX = x; | ||
window->State.MouseY = y; | ||
/* TODO: this should simulate a fake motion event */ | ||
} |
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,33 @@ | ||
/* | ||
* freeglut_display_ios.c | ||
* | ||
* Display message posting, context buffer swapping. | ||
* | ||
* Copyright (C) 2014 Google, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
#include <GL/freeglut.h> | ||
#include "fg_internal.h" | ||
#include "fg_view_controller.h" | ||
|
||
void fgPlatformGlutSwapBuffers ( SFG_PlatformDisplay *pDisplayPtr, | ||
SFG_Window* CurrentWindow ) | ||
{ | ||
} |
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,54 @@ | ||
/* | ||
* fg_ext_ios.c | ||
* | ||
* Functions related to OpenGL extensions. | ||
* | ||
* Copyright (C) 2014 Google, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
#include <GL/freeglut.h> | ||
#include "../fg_internal.h" | ||
|
||
GLUTproc fgPlatformGetGLUTProcAddress ( const char* procName ) | ||
{ | ||
/* optimization: quick initial check */ | ||
if ( strncmp( procName, "glut", 4 ) != 0 ) | ||
return NULL; | ||
|
||
#define CHECK_NAME(x) if ( strcmp( procName, #x ) == 0) return (GLUTproc)x; | ||
CHECK_NAME(glutJoystickFunc); | ||
CHECK_NAME(glutForceJoystickFunc); | ||
CHECK_NAME(glutGameModeString); | ||
CHECK_NAME(glutEnterGameMode); | ||
CHECK_NAME(glutLeaveGameMode); | ||
CHECK_NAME(glutGameModeGet); | ||
#undef CHECK_NAME | ||
|
||
return NULL; | ||
} | ||
|
||
static void nop() | ||
{ | ||
} | ||
|
||
SFG_Proc fgPlatformGetProcAddress ( const char *procName ) | ||
{ | ||
return nop; | ||
} |
Oops, something went wrong.