Răsfoiți Sursa

Merge pull request #58 from blackberry-gaming/next-setaylor

Next setaylor
Sean Paul Taylor 14 ani în urmă
părinte
comite
fbdfe132e0

+ 5 - 10
README.md

@@ -2,20 +2,16 @@
 GamePlay is a open-source, cross-platform 3D native gaming framework making it easy to learn and write mobile and desktop games. 
 
 ## Supported Platforms
-- BlackBerry PlayBook 1.0,2.0 (using BlackBerry Native SDK 1.0,2.0)
+- BlackBerry PlayBook 1.0/2.0 (using BlackBerry Native SDK 1.0/2.0)
 - Apple MacOS X (using Apple XCode 4.0)
-- Microsoft Windows 7 (using Microsoft Visual Studio 2010)
+- Microsoft Windows 7 (using Microsoft Visual Studio 2010 Pro/Express)
 	* Requires OpenAL 1.1 (http://connect.creativelabs.com/openal/Downloads/Forms/AllItems.aspx)
 
 ## Roadmap for 'next' branch
-- VisibilityController for node culling.
-- Materials/Shaders supporting multi-texturing for light maps.
-- Billboard and MeshBatch classes.
 - UI Forms with Themed Overlays.
-- Gamepad with Touch Themed Overlays.
-- Physics Sample and Tutorial.
-- New Project Setup Scripts for each platform.
-- Developer Users Guide.
+- Improvements to Lighting.
+- Developer Guide.
+- More Samples and Tutorials.
 - Apple iOS 5 Support.
 
 ## Bug Reporting and Feature Requests
@@ -25,7 +21,6 @@ to the Committers to the project to let them know that you have filed
 an [Issue](https://github.com/blackberry/GamePlay/issues).
 
 ## Disclaimer
-
 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 THE AUTHORS OR COPYRIGHT 

+ 3 - 2
gameplay-encoder/gameplay-encoder.xcodeproj/project.pbxproj

@@ -185,7 +185,7 @@
 		42475CDB147208A000610A6A = {
 			isa = PBXGroup;
 			children = (
-				42475CE9147208A000610A6A /* gameplay-encoder */,
+				42475CE9147208A000610A6A /* src */,
 				427D4F44147DC9080076760E /* Libraries */,
 				42475CE7147208A000610A6A /* Products */,
 			);
@@ -199,7 +199,7 @@
 			name = Products;
 			sourceTree = "<group>";
 		};
-		42475CE9147208A000610A6A /* gameplay-encoder */ = {
+		42475CE9147208A000610A6A /* src */ = {
 			isa = PBXGroup;
 			children = (
 				42C8EDB714724CD700E43619 /* Animation.cpp */,
@@ -286,6 +286,7 @@
 				42C8EE0814724CD700E43619 /* VertexElement.cpp */,
 				42C8EE0914724CD700E43619 /* VertexElement.h */,
 			);
+			name = src;
 			path = "gameplay-encoder";
 			sourceTree = "<group>";
 		};

+ 0 - 3
gameplay.xcworkspace/contents.xcworkspacedata

@@ -19,7 +19,4 @@
    <FileRef
       location = "group:gameplay-samples/sample03-character/sample03-character.xcodeproj">
    </FileRef>
-   <FileRef
-      location = "group:gameplay-samples/sample04-sandbox/sample04-sandbox.xcodeproj">
-   </FileRef>
 </Workspace>

+ 3 - 2
gameplay/gameplay.xcodeproj/project.pbxproj

@@ -344,7 +344,7 @@
 		4234D98A14686BB6003031B3 = {
 			isa = PBXGroup;
 			children = (
-				4234D9A314686C52003031B3 /* gameplay */,
+				4234D9A314686C52003031B3 /* src */,
 				427D4F42147DC8DE0076760E /* Libraries */,
 				42CCD4AF146D811D00353661 /* Frameworks */,
 				4234D99B14686C52003031B3 /* Products */,
@@ -359,7 +359,7 @@
 			name = Products;
 			sourceTree = "<group>";
 		};
-		4234D9A314686C52003031B3 /* gameplay */ = {
+		4234D9A314686C52003031B3 /* src */ = {
 			isa = PBXGroup;
 			children = (
 				42CD0DB1147D8FF50000361E /* Animation.cpp */,
@@ -512,6 +512,7 @@
 				42CD0E44147D8FF50000361E /* Viewport.cpp */,
 				42CD0E45147D8FF50000361E /* Viewport.h */,
 			);
+			name = src;
 			path = gameplay;
 			sourceTree = "<group>";
 		};

+ 0 - 335
gameplay/src/PlatformMacOSX.mm

@@ -1,335 +0,0 @@
-/*
- * PlatformMacOSX.cpp
- */
-
-#ifdef __APPLE__
-
-#include "Base.h"
-#include "Platform.h"
-#include "FileSystem.h"
-#include "Game.h"
-#include "Input.h"
-
-#import <Cocoa/Cocoa.h>
-#import <QuartzCore/CVDisplayLink.h>
-#import <OpenGL/OpenGL.h>
-#import <mach/mach_time.h>
-
-using namespace std;
-using namespace gameplay;
-
-
-static const float ACCELEROMETER_X_FACTOR = 90.0f / WINDOW_WIDTH;
-static const float ACCELEROMETER_Y_FACTOR = 90.0f / WINDOW_HEIGHT;
-
-static long __timeStart;
-static long __timeAbsolute;
-static bool __vsync = WINDOW_VSYNC;
-static float __pitch;
-static float __roll;
-static int __lx, __ly;
-static bool __hasMouse = false;
-static bool __leftMouseDown = false;
-static bool __rightMouseDown = false;
-static bool __shiftDown = false;
-
-long getMachTimeInMilliseconds()
-{
-    static const int64_t kOneMillion = 1000 * 1000;
-    static mach_timebase_info_data_t s_timebase_info;
-    
-    if (s_timebase_info.denom == 0) 
-        (void) mach_timebase_info(&s_timebase_info);
-    
-    // mach_absolute_time() returns billionth of seconds, so divide by one million to get milliseconds
-    return (long)((mach_absolute_time() * s_timebase_info.numer) / (kOneMillion * s_timebase_info.denom));
-}
-
-@class View;
-
-@interface View : NSOpenGLView <NSWindowDelegate> 
-{
-    CVDisplayLinkRef displayLink;
-    
-    Game* _game;
-}
-@end
-
-
-@implementation View
-
-
--(void)windowWillClose:(NSNotification*)note 
-{
-    _game->exit();
-    [[NSApplication sharedApplication] terminate:self];
-}
-
-- (CVReturn) getFrameForTime:(const CVTimeStamp*)outputTime
-{
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    
-    [self performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:NO];
-    
-    [pool release];
-    return kCVReturnSuccess;
-}
-
-
--(void) update
-{
-    [[self openGLContext] makeCurrentContext];
-    CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
-    _game->frame();
-    CGLFlushDrawable((CGLContextObj)[[self openGLContext] CGLContextObj]);
-    CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);  
-}
-
-static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime, 
-                                      CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext)
-{
-    CVReturn result = [(View*)displayLinkContext getFrameForTime:outputTime];
-    return result;
-}
-
-- (id) initWithFrame: (NSRect) frame
-{    
-    _game = Game::getInstance();
-    __timeStart = getMachTimeInMilliseconds();
-    NSOpenGLPixelFormatAttribute attrs[] = 
-    {
-        NSOpenGLPFAAccelerated,
-        NSOpenGLPFADoubleBuffer,
-        NSOpenGLPFAColorSize, 32,
-        NSOpenGLPFADepthSize, 24,
-        NSOpenGLPFAAlphaSize, 8,
-        NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy,
-        0
-    };
-    
-    NSOpenGLPixelFormat* pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
-    if (!pf)
-        NSLog(@"OpenGL pixel format not supported.");
-    
-    self = [super initWithFrame:frame pixelFormat:[pf autorelease]];  
-    
-    return self;
-}
-
-- (void) prepareOpenGL
-{
-    [super prepareOpenGL];
-    
-    NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
-    NSString* path = [bundlePath stringByAppendingString:@"/Contents/Resources/"];
-    FileSystem::setResourcePath([path cStringUsingEncoding:NSASCIIStringEncoding]);
-    _game->run(WINDOW_WIDTH, WINDOW_HEIGHT);
-    
-    [[self window] setLevel: NSFloatingWindowLevel];
-    [[self window] makeKeyAndOrderFront: self];
-    [[self window] setTitle: [NSString stringWithUTF8String: ""]];
-    
-    // Make all the OpenGL calls to setup rendering and build the necessary rendering objects
-    [[self openGLContext] makeCurrentContext];
-    // Synchronize buffer swaps with vertical refresh rate
-    GLint swapInt = __vsync ? 1 : 0;
-    [[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
-    
-    // Create a display link capable of being used with all active displays
-    CVDisplayLinkCreateWithActiveCGDisplays(&displayLink);
-    
-    // Set the renderer output callback function
-    CVDisplayLinkSetOutputCallback(displayLink, &MyDisplayLinkCallback, self);
-    
-    CGLContextObj cglContext = (CGLContextObj)[[self openGLContext] CGLContextObj];
-    CGLPixelFormatObj cglPixelFormat = (CGLPixelFormatObj)[[self pixelFormat] CGLPixelFormatObj];
-    CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(displayLink, cglContext, cglPixelFormat);
-    
-    // Activate the display link
-    CVDisplayLinkStart(displayLink);
-}
-
-- (void) dealloc
-{       
-    _game->exit();
-    
-    // Release the display link
-    CVDisplayLinkRelease(displayLink);
-    
-    [super dealloc];
-}
-
-- (void) mouseDown: (NSEvent*) theEvent
-{
-    NSPoint point = [theEvent locationInWindow];
-    _game->touch(point.x, WINDOW_HEIGHT - point.y, Input::TOUCHEVENT_PRESS);
-    __leftMouseDown = true;
-}
-
-- (void) mouseUp: (NSEvent*) theEvent
-{
-    NSPoint point = [theEvent locationInWindow];
-    __leftMouseDown = false;
-    _game->touch(point.x, WINDOW_HEIGHT - point.y, Input::TOUCHEVENT_RELEASE);
-}
-
-- (void) mouseDragged: (NSEvent*) theEvent
-{
-    NSPoint point = [theEvent locationInWindow];
-    if (__leftMouseDown)
-    {
-        gameplay::Game::getInstance()->touch(point.x, WINDOW_HEIGHT - point.y, gameplay::Input::TOUCHEVENT_MOVE);
-    }
-}
-
-- (void) rightMouseDown: (NSEvent*) theEvent
-{
-    __rightMouseDown = true;
-     NSPoint point = [theEvent locationInWindow];
-    __lx = point.x;
-    __ly = WINDOW_HEIGHT - point.y;
-}
-
-- (void) rightMouseUp: (NSEvent*) theEvent
-{
-   __rightMouseDown = false;
-}
-
-- (void) rightMouseDragged: (NSEvent*) theEvent
-{
-    NSPoint point = [theEvent locationInWindow];
-    if (__rightMouseDown)
-    {
-        // Update the pitch and roll by adding the scaled deltas.
-        __roll += -(float)(point.x - __lx) * ACCELEROMETER_X_FACTOR;
-        __pitch -= (float)(point.y - (WINDOW_HEIGHT - __ly)) * ACCELEROMETER_Y_FACTOR;
-    
-        // Clamp the values to the valid range.
-        __roll = fmaxf(fminf(__roll, 90.0), -90.0);
-        __pitch = fmaxf(fminf(__pitch, 90.0), -90.0);
-    
-        // Update the last X/Y values.
-        __lx = point.x;
-        __ly = (WINDOW_HEIGHT - point.y);
-    }
-}
-
-- (void) mouseEntered:(NSEvent *)theEvent
-{
-    __hasMouse = true;
-}
-
-- (void) mouseExited:(NSEvent *)theEvent
-{
-    __leftMouseDown = false;
-    __rightMouseDown = false;
-    __hasMouse = false;
-}
-
-@end
-
-
-namespace gameplay
-{
-
-extern void printError(const char* format, ...)
-{
-    va_list argptr;
-    va_start(argptr, format);
-    vfprintf(stderr, format, argptr);
-    fprintf(stderr, "\n");
-    va_end(argptr);
-}
-    
-    
-Platform::Platform(Game* game)
-: _game(game)
-{
-}
-
-Platform::Platform(const Platform& copy)
-{
-    // hidden
-}
-
-Platform::~Platform()
-{
-}
-
-Platform* Platform::create(Game* game)
-{
-    Platform* platform = new Platform(game);
-    
-    return platform;
-}
-
-int Platform::enterMessagePump()
-{
-    NSAutoreleasePool *pool = [NSAutoreleasePool new];
-    NSApplication* NSApp = [NSApplication sharedApplication];
-    NSRect screenBounds = [[NSScreen mainScreen] frame];
-    NSRect viewBounds = NSMakeRect(0, 0, 1024, 600);
-    
-    View* view = [[View alloc] initWithFrame:viewBounds];
-    
-    NSRect centered = NSMakeRect(NSMidX(screenBounds) - NSMidX(viewBounds),
-                                 NSMidY(screenBounds) - NSMidY(viewBounds),
-                                 viewBounds.size.width, 
-                                 viewBounds.size.height);
-    
-    NSWindow *window = [[NSWindow alloc]
-                        initWithContentRect:centered
-                        styleMask:NSTitledWindowMask | NSClosableWindowMask
-                        backing:NSBackingStoreBuffered
-                        defer:NO];
-    
-    [window setContentView:view];
-    [window setDelegate:view];
-    [view release];
-    
-    [NSApp run];
-    
-    [pool release];
-    return EXIT_SUCCESS;
-}
-    
-long Platform::getAbsoluteTime()
-{
-    __timeAbsolute = getMachTimeInMilliseconds();
-    return __timeAbsolute;
-}
-
-void Platform::setAbsoluteTime(long time)
-{
-    __timeAbsolute = time;
-}
-
-bool Platform::isVsync()
-{
-    return __vsync;
-}
-
-void Platform::setVsync(bool enable)
-{
-    __vsync = enable;
-}
-
-int Platform::getOrientationAngle()
-{
-    return 0;
-}
-
-bool Platform::isAccelerometerSupported()
-{
-    return true;
-}
-
-void Platform::getAccelerometerPitchAndRoll(float* pitch, float* roll)
-{
-    *pitch = __pitch;
-    *roll = __roll;
-}
-    
-}
-
-#endif