summaryrefslogtreecommitdiff
path: root/macosx/plugins/PeopsXgl/macsrc/drawgl.m
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-02-18 08:58:58 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-02-18 08:58:58 +0000
commit34cfcc5169cafa8ae9e0d6469e20dc11c122c077 (patch)
tree47ddff4f53156e888c370b12c405a6849a9cb2a6 /macosx/plugins/PeopsXgl/macsrc/drawgl.m
parent394f7a2b4a604dc40cf29f23a7121deb19eed79c (diff)
downloadpcsxr-34cfcc5169cafa8ae9e0d6469e20dc11c122c077.tar.gz
-(SysBeep)Added Mac OS X port of P.E.Op.S OpenGL plugin. (Patch #8361)
-Fixed help message for Windows. (Issue #8028). git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@63522 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/PeopsXgl/macsrc/drawgl.m')
-rw-r--r--macosx/plugins/PeopsXgl/macsrc/drawgl.m234
1 files changed, 234 insertions, 0 deletions
diff --git a/macosx/plugins/PeopsXgl/macsrc/drawgl.m b/macosx/plugins/PeopsXgl/macsrc/drawgl.m
new file mode 100644
index 00000000..91c7ecbf
--- /dev/null
+++ b/macosx/plugins/PeopsXgl/macsrc/drawgl.m
@@ -0,0 +1,234 @@
+/***************************************************************************
+ drawgl.m
+ an odd set of functions that seem misplaced ATM.
+ presumably this is the glue to the C GPU plugin stuff
+ but a much better place might be "PluginWindowController.m" as
+ gluing is what a controller is made for.
+
+ PeopsOpenGPU
+
+ Created by Gil Pedersen on Sun April 18 2004.
+ Copyright (c) 2004 Gil Pedersen.
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. See also the license.txt file for *
+ * additional informations. *
+ * *
+ ***************************************************************************/
+
+#import "PluginWindowController.h"
+#import "PluginGLView.h"
+#include "ExtendedKeys.h"
+#include "externals.h"
+#include "draw.h"
+#include "gpu.h"
+#include "menu.h"
+
+////////////////////////////////////////////////////////////////////////////////////
+// misc globals
+////////////////////////////////////////////////////////////////////////////////////
+#if 0 // globals for OpenGL (vs. SoftGPU) are owned by others... weird
+int iResX;
+int iResY;
+long lLowerpart;
+BOOL bIsFirstFrame = TRUE;
+BOOL bCheckMask=FALSE;
+unsigned short sSetMask=0;
+/* unsigned long lSetMask=0; */
+uint32_t sSetMassk=0;
+int iDesktopCol=16;
+int iShowFPS=0;
+int iWinSize;
+int iUseScanLines=0;
+int iUseNoStretchBlt=0;
+int iFastFwd=0;
+int iDebugMode=0;
+int iFVDisplay=0;
+PSXPoint_t ptCursorPoint[8];
+unsigned short usCursorActive=0;
+char * Xpixels;
+char * pCaptionText;
+#endif
+
+
+extern BOOL bCheckMask;
+extern BOOL bIsFirstFrame;
+extern int iShowFPS;
+extern unsigned short sSetMask;
+extern int iUseScanLines;
+extern unsigned short usCursorActive;
+
+
+
+int iResX;
+int iResY;
+long lLowerpart;
+
+uint32_t sSetMassk=0;
+int iDesktopCol=16;
+int iWinSize;
+int iUseNoStretchBlt=0;
+int iFastFwd=0;
+int iDebugMode=0;
+int iFVDisplay=0;
+PSXPoint_t ptCursorPoint[8];
+char * Xpixels;
+char * pCaptionText;
+
+
+
+
+//static PluginWindowController *windowController;
+// static is BAD NEWS if user uses other plug ins
+PluginGLView *glView;
+
+////////////////////////////////////////////////////////////////////////
+
+void DoBufferSwap(void) // SWAP BUFFERS
+{
+#if 1
+ [glView swapBuffer];
+#else
+ static long long lastTickCount = -1;
+ static int skipCount = 0;
+ long long microTickCount;
+ long deltaTime;
+
+ Microseconds((struct UnsignedWide *)&microTickCount);
+ deltaTime = (long)(microTickCount - lastTickCount);
+ if (deltaTime <= (PSXDisplay.PAL ? 1000000/50 : 100000000 / 5994) ||
+ skipCount >= 3) {
+ skipCount = 0;
+ [glView swapBuffer];
+ } else {
+ skipCount++;
+ }
+ NSLog(@"count: %i", deltaTime);
+ lastTickCount = microTickCount;
+#endif
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+void DoClearScreenBuffer(void) // CLEAR DX BUFFER
+{
+ // clear the screen, and DON'T flush it
+ [glView clearBuffer:NO];
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+void DoClearFrontBuffer(void) // CLEAR DX BUFFER
+{
+ // clear the screen, and flush it
+ [glView clearBuffer:YES];
+}
+
+////////////////////////////////////////////////////////////////////////
+
+unsigned long ulInitDisplay(void) // OPEN GAME WINDOW
+{
+ bUsingTWin=FALSE;
+
+// InitMenu(); // This function does nothing
+
+ bIsFirstFrame = FALSE;
+
+ if(iShowFPS)
+ {
+ //iShowFPS=0;
+ ulKeybits|=KEY_SHOWFPS;
+ szDispBuf[0]=0;
+ BuildDispMenu(0);
+ }
+
+ PluginWindowController *windowController = [PluginWindowController openGameView];
+ glView = [windowController getOpenGLView];
+
+ [[windowController window] setTitle:[NSString stringWithCString:pCaptionText]];
+
+ return (unsigned long)[windowController window];
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+void CloseDisplay(void)
+{
+ if (gameController) {
+ [gameController close];
+ [gameController release];
+ gameController = nil;
+ gameWindow = nil;
+ }
+}
+
+void BringContextForward(void)
+{
+ [[glView openGLContext] makeCurrentContext];
+}
+
+void SendContextBack(void)
+{
+ [NSOpenGLContext clearCurrentContext];
+}
+
+void SetVSync(long myValue)
+{
+ long DoItMyFriend = myValue;
+ [[glView openGLContext] setValues: &DoItMyFriend forParameter: NSOpenGLCPSwapInterval];
+
+}
+////////////////////////////////////////////////////////////////////////
+
+/* taken care of in menu.c
+void CreatePic(unsigned char * pMem)
+{
+}
+*/
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+/* taken care of in menu.c
+void DestroyPic(void)
+{
+}
+*/
+
+///////////////////////////////////////////////////////////////////////////////////////
+/* taken care of in menu.c
+void DisplayPic(void)
+{
+}
+*/
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void ShowGpuPic(void)
+{
+ // this is the default implementation...
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void ShowTextGpuPic(void)
+{
+ // this is the default implementation...
+}
+
+
+void HandleKey(int keycode)
+{
+ switch (keycode) {
+ case GPU_FULLSCREEN_KEY:
+ [gameController setFullscreen:![gameController fullscreen]];
+ break;
+ }
+}