Skip to content

Commit

Permalink
Merge liquidfun
Browse files Browse the repository at this point in the history
  • Loading branch information
jsanmiya committed Jul 11, 2014
2 parents 10a48a0 + 77da0dc commit 927e9d8
Show file tree
Hide file tree
Showing 1,041 changed files with 124,128 additions and 10,479 deletions.
30 changes: 20 additions & 10 deletions freeglut/include/GL/freeglut_std.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,28 @@
/* Note: FREEGLUT_GLES1 and FREEGLUT_GLES2 are only used to cleanly
bootstrap headers inclusion here; use GLES constants directly
(e.g. GL_ES_VERSION_2_0) for all other needs */
#ifdef FREEGLUT_GLES2
# include <EGL/egl.h>
# include <GLES2/gl2.h>
#if FREEGLUT_GLES2
# if __APPLE__
# include <OpenGLES/ES2/gl.h>
# else
# include <EGL/egl.h>
# include <GLES2/gl2.h>
# endif
#elif FREEGLUT_GLES1
# include <EGL/egl.h>
# include <GLES/gl.h>
#elif __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
# if __APPLE__
# include <OpenGLES/ES1/gl.h>
# else
# include <EGL/egl.h>
# include <GLES/gl.h>
# endif
#else
# include <GL/gl.h>
# include <GL/glu.h>
# if __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
# else
# include <GL/gl.h>
# include <GL/glu.h>
# endif
#endif

/*
Expand Down
62 changes: 31 additions & 31 deletions freeglut/src/fg_font_data.c

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions freeglut/src/fg_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@
# define TARGET_HOST_POSIX_X11 1

#elif defined(__APPLE__)
# include <TargetConditionals.h>
# if TARGET_OS_IPHONE
# define TARGET_HOST_IOS 1
# else
/* This is a placeholder until we get native OSX support ironed out -- JFF 11/18/09 */
# define TARGET_HOST_POSIX_X11 1
/* # define TARGET_HOST_MAC_OSX 1 */
# define TARGET_HOST_POSIX_X11 1
/* # define TARGET_HOST_MAC_OSX 1 */
# endif

#else
# error "Unrecognized target host!"
Expand All @@ -76,6 +81,10 @@
# define TARGET_HOST_MAC_OSX 0
#endif

#ifndef TARGET_HOST_IOS
# define TARGET_HOST_IOS 0
#endif

#ifndef TARGET_HOST_SOLARIS
# define TARGET_HOST_SOLARIS 0
#endif
Expand Down Expand Up @@ -198,6 +207,9 @@
#if TARGET_HOST_ANDROID
#include "android/fg_internal_android.h"
#endif
#if TARGET_HOST_IOS
#include "ios/fg_internal_ios.h"
#endif


/* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
Expand Down
7 changes: 7 additions & 0 deletions freeglut/src/ios/fg_app_delegate.h
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
132 changes: 132 additions & 0 deletions freeglut/src/ios/fg_app_delegate.m
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
42 changes: 42 additions & 0 deletions freeglut/src/ios/fg_cursor_ios.c
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 */
}
33 changes: 33 additions & 0 deletions freeglut/src/ios/fg_display_ios.m
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 )
{
}
54 changes: 54 additions & 0 deletions freeglut/src/ios/fg_ext_ios.c
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;
}
Loading

0 comments on commit 927e9d8

Please sign in to comment.