Changed the OpenGL header include scheme for OSX. I hope that it does not break anything as I cannot compile it under OSX. Also some indentation for the OSX stuff.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@865 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
d6f8edae35
commit
b5270f9da4
|
@ -24,11 +24,15 @@
|
|||
#pragma comment(lib, "GLu32.lib")
|
||||
#endif
|
||||
#elif defined(MACOSX)
|
||||
#define GL_EXT_texture_env_combine 1
|
||||
#include "CIrrDeviceMacOSX.h"
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#endif
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#include "glext.h"
|
||||
#endif
|
||||
#elif defined(_IRR_USE_SDL_DEVICE_)
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
|
|
|
@ -21,11 +21,15 @@
|
|||
#pragma comment(lib, "GLu32.lib")
|
||||
#endif
|
||||
#elif defined(MACOSX)
|
||||
#define GL_EXT_texture_env_combine 1
|
||||
#include "CIrrDeviceMacOSX.h"
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#endif
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#include "glext.h"
|
||||
#endif
|
||||
#elif defined(_IRR_USE_SDL_DEVICE_)
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
|
|
|
@ -9,20 +9,21 @@
|
|||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include "glext.h"
|
||||
#elif defined(MACOSX)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include "glext.h"
|
||||
#else
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#endif
|
||||
#if defined(MACOSX)
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#include "glext.h"
|
||||
#include "glext.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,19 +9,20 @@
|
|||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#elif defined(MACOSX)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#else
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#endif
|
||||
#if defined(MACOSX)
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#include "glext.h"
|
||||
#include "glext.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,19 +22,20 @@
|
|||
#pragma comment(lib, "OpenGL32.lib")
|
||||
#pragma comment(lib, "GLu32.lib")
|
||||
#endif
|
||||
#elif defined(MACOSX)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#else
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#if defined(MACOSX)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#include "glext.h"
|
||||
#endif
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ namespace irr
|
|||
public:
|
||||
|
||||
//! constructor
|
||||
CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType,
|
||||
const core::dimension2d<s32>& windowSize,
|
||||
u32 bits, bool fullscreen,
|
||||
bool sbuffer, bool vsync,
|
||||
bool antiAlias, IEventReceiver* receiver,
|
||||
const char* version);
|
||||
CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType,
|
||||
const core::dimension2d<s32>& windowSize,
|
||||
u32 bits, bool fullscreen,
|
||||
bool sbuffer, bool vsync,
|
||||
bool antiAlias, IEventReceiver* receiver,
|
||||
const char* version);
|
||||
|
||||
//! destructor
|
||||
virtual ~CIrrDeviceMacOSX();
|
||||
|
@ -60,10 +60,10 @@ namespace irr
|
|||
//! Sets if the window should be resizeable in windowed mode.
|
||||
virtual void setResizeAble(bool resize);
|
||||
|
||||
void flush();
|
||||
void setMouseLocation(int x,int y);
|
||||
void setResize(int width,int height);
|
||||
void setCursorVisible(bool visible);
|
||||
void flush();
|
||||
void setMouseLocation(int x,int y);
|
||||
void setResize(int width,int height);
|
||||
void setCursorVisible(bool visible);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -112,7 +112,7 @@ namespace irr
|
|||
//! Sets the new position of the cursor.
|
||||
virtual void setPosition(const core::position2d<s32> &pos)
|
||||
{
|
||||
if (CursorPos.X != pos.X || CursorPos.Y != pos.Y)
|
||||
if (CursorPos.X != pos.X || CursorPos.Y != pos.Y)
|
||||
setPosition(pos.X, pos.Y);
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ namespace irr
|
|||
}
|
||||
|
||||
//! Updates the internal cursor position
|
||||
void updateInternalCursorPosition(int x,int y)
|
||||
void updateInternalCursorPosition(int x,int y)
|
||||
{
|
||||
CursorPos.X = x;
|
||||
CursorPos.Y = y;
|
||||
|
@ -186,12 +186,12 @@ namespace irr
|
|||
core::rect<s32> ReferenceRect;
|
||||
};
|
||||
|
||||
bool createWindow(const irr::core::dimension2d<irr::s32>& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer);
|
||||
void initKeycodes();
|
||||
void storeMouseLocation();
|
||||
void postMouseEvent(void *event,irr::SEvent &ievent);
|
||||
void postKeyEvent(void *event,irr::SEvent &ievent,bool pressed);
|
||||
|
||||
bool createWindow(const irr::core::dimension2d<irr::s32>& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer);
|
||||
void initKeycodes();
|
||||
void storeMouseLocation();
|
||||
void postMouseEvent(void *event,irr::SEvent &ievent);
|
||||
void postKeyEvent(void *event,irr::SEvent &ievent,bool pressed);
|
||||
|
||||
video::E_DRIVER_TYPE DriverType;
|
||||
bool stencilbuffer;
|
||||
|
||||
|
|
|
@ -30,22 +30,22 @@ namespace irr
|
|||
}
|
||||
} // end namespace irr
|
||||
|
||||
static bool firstLaunch = true;
|
||||
static bool firstLaunch = true;
|
||||
|
||||
namespace irr
|
||||
{
|
||||
//! constructor
|
||||
CIrrDeviceMacOSX::CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType,
|
||||
const core::dimension2d<s32>& windowSize,
|
||||
u32 bits, bool fullscreen,
|
||||
bool sbuffer, bool vsync,
|
||||
bool antiAlias, IEventReceiver* receiver,
|
||||
const char* version)
|
||||
: CIrrDeviceStub(version, receiver), DriverType(driverType), stencilbuffer(sbuffer)
|
||||
CIrrDeviceMacOSX::CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType,
|
||||
const core::dimension2d<s32>& windowSize,
|
||||
u32 bits, bool fullscreen,
|
||||
bool sbuffer, bool vsync,
|
||||
bool antiAlias, IEventReceiver* receiver,
|
||||
const char* version)
|
||||
: CIrrDeviceStub(version, receiver), DriverType(driverType), stencilbuffer(sbuffer), _window(NULL), _active(true), _oglcontext(NULL), _cglcontext(NULL)
|
||||
{
|
||||
struct utsname name;
|
||||
NSString *path;
|
||||
|
||||
struct utsname name;
|
||||
NSString *path;
|
||||
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CIrrDeviceMacOSX");
|
||||
#endif
|
||||
|
@ -63,11 +63,6 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType,
|
|||
path = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
|
||||
chdir([path cString]);
|
||||
}
|
||||
|
||||
_window = NULL;
|
||||
_active = true;
|
||||
_oglcontext = NULL;
|
||||
_cglcontext = NULL;
|
||||
|
||||
uname(&name);
|
||||
Operator = new COSOperator(name.version);
|
||||
|
@ -85,7 +80,7 @@ CIrrDeviceMacOSX::~CIrrDeviceMacOSX()
|
|||
closeDevice();
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::closeDevice()
|
||||
void CIrrDeviceMacOSX::closeDevice()
|
||||
{
|
||||
if (_window != NULL)
|
||||
{
|
||||
|
@ -110,13 +105,13 @@ void CIrrDeviceMacOSX::closeDevice()
|
|||
CGLClearDrawable(_cglcontext);
|
||||
CGLDestroyContext(_cglcontext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_active = FALSE;
|
||||
_cglcontext = NULL;
|
||||
}
|
||||
|
||||
bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer)
|
||||
bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer)
|
||||
{
|
||||
int index;
|
||||
CGDisplayErr error;
|
||||
|
@ -129,7 +124,7 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
|
|||
NSOpenGLPixelFormatAttribute windowattribs[32];
|
||||
CFDictionaryRef displaymode,olddisplaymode;
|
||||
long numPixelFormats,newSwapInterval;
|
||||
|
||||
|
||||
result = false;
|
||||
display = CGMainDisplayID();
|
||||
_screenWidth = (int) CGDisplayPixelsWide(display);
|
||||
|
@ -141,7 +136,7 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
|
|||
if (_window != NULL)
|
||||
{
|
||||
index = 0;
|
||||
windowattribs[index++] = NSOpenGLPFANoRecovery;
|
||||
windowattribs[index++] = NSOpenGLPFANoRecovery;
|
||||
windowattribs[index++] = NSOpenGLPFADoubleBuffer;
|
||||
windowattribs[index++] = NSOpenGLPFAAccelerated;
|
||||
windowattribs[index++] = NSOpenGLPFADepthSize;
|
||||
|
@ -154,7 +149,7 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
|
|||
windowattribs[index++] = NSOpenGLPFAStencilSize;
|
||||
windowattribs[index++] = (NSOpenGLPixelFormatAttribute)1;
|
||||
}
|
||||
|
||||
|
||||
windowattribs[index++] = (NSOpenGLPixelFormatAttribute)NULL;
|
||||
|
||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
|
||||
|
@ -163,7 +158,7 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
|
|||
_oglcontext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:NULL];
|
||||
[format release];
|
||||
}
|
||||
|
||||
|
||||
if (_oglcontext != NULL)
|
||||
{
|
||||
[_window center];
|
||||
|
@ -196,7 +191,7 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
|
|||
numPixelFormats = 0;
|
||||
|
||||
index = 0;
|
||||
fullattribs[index++] = kCGLPFAFullScreen;
|
||||
fullattribs[index++] = kCGLPFAFullScreen;
|
||||
fullattribs[index++] = kCGLPFADisplayMask;
|
||||
fullattribs[index++] = (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display);
|
||||
fullattribs[index++] = kCGLPFADoubleBuffer;
|
||||
|
@ -211,16 +206,16 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
|
|||
fullattribs[index++] = kCGLPFAStencilSize;
|
||||
fullattribs[index++] = (CGLPixelFormatAttribute)1;
|
||||
}
|
||||
|
||||
|
||||
fullattribs[index++] = (CGLPixelFormatAttribute)NULL;
|
||||
CGLChoosePixelFormat(fullattribs,&pixelFormat,&numPixelFormats);
|
||||
|
||||
|
||||
if (pixelFormat != NULL)
|
||||
{
|
||||
CGLCreateContext(pixelFormat,NULL,&_cglcontext);
|
||||
CGLDestroyPixelFormat(pixelFormat);
|
||||
}
|
||||
|
||||
|
||||
if (_cglcontext != NULL)
|
||||
{
|
||||
CGLSetFullScreen(_cglcontext);
|
||||
|
@ -249,7 +244,7 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
|
|||
return (result);
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::setResize(int width,int height)
|
||||
void CIrrDeviceMacOSX::setResize(int width,int height)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
@ -257,7 +252,7 @@ void CIrrDeviceMacOSX::setResize(int width,int height)
|
|||
getVideoDriver()->OnResize(core::dimension2d<s32>(width, height));
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::createDriver(video::E_DRIVER_TYPE driverType,const core::dimension2d<s32>& windowSize,u32 bits,bool fullscreen,bool stencilbuffer, bool vsync, bool antiAlias)
|
||||
void CIrrDeviceMacOSX::createDriver(video::E_DRIVER_TYPE driverType,const core::dimension2d<s32>& windowSize,u32 bits,bool fullscreen,bool stencilbuffer, bool vsync, bool antiAlias)
|
||||
{
|
||||
switch (driverType)
|
||||
{
|
||||
|
@ -268,7 +263,7 @@ void CIrrDeviceMacOSX::createDriver(video::E_DRIVER_TYPE driverType,const core::
|
|||
os::Printer::log("No Software driver support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
case video::EDT_BURNINGSVIDEO:
|
||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
VideoDriver = video::createSoftwareDriver2(windowSize, fullscreen, FileSystem, this);
|
||||
|
@ -284,7 +279,7 @@ void CIrrDeviceMacOSX::createDriver(video::E_DRIVER_TYPE driverType,const core::
|
|||
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
case video::EDT_DIRECT3D8:
|
||||
case video::EDT_DIRECT3D9:
|
||||
os::Printer::log("This driver is not available in OSX. Try OpenGL or Software renderer.", ELL_ERROR);
|
||||
|
@ -300,7 +295,7 @@ void CIrrDeviceMacOSX::createDriver(video::E_DRIVER_TYPE driverType,const core::
|
|||
}
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::flush()
|
||||
void CIrrDeviceMacOSX::flush()
|
||||
{
|
||||
if (_cglcontext != NULL)
|
||||
{
|
||||
|
@ -309,11 +304,11 @@ void CIrrDeviceMacOSX::flush()
|
|||
}
|
||||
}
|
||||
|
||||
bool CIrrDeviceMacOSX::run()
|
||||
bool CIrrDeviceMacOSX::run()
|
||||
{
|
||||
NSEvent *event;
|
||||
irr::SEvent ievent;
|
||||
|
||||
|
||||
os::Timer::tick();
|
||||
storeMouseLocation();
|
||||
|
||||
|
@ -327,7 +322,7 @@ bool CIrrDeviceMacOSX::run()
|
|||
case NSKeyDown:
|
||||
postKeyEvent(event,ievent,true);
|
||||
break;
|
||||
|
||||
|
||||
case NSKeyUp:
|
||||
postKeyEvent(event,ievent,false);
|
||||
break;
|
||||
|
@ -351,7 +346,7 @@ bool CIrrDeviceMacOSX::run()
|
|||
ievent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
||||
postMouseEvent(event,ievent);
|
||||
break;
|
||||
|
||||
|
||||
case NSRightMouseDown:
|
||||
ievent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
ievent.MouseInput.Event = irr::EMIE_RMOUSE_PRESSED_DOWN;
|
||||
|
@ -378,12 +373,12 @@ bool CIrrDeviceMacOSX::run()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (![[NSApp delegate] isQuit] && _active);
|
||||
}
|
||||
|
||||
//! Pause the current process for the minimum time allowed only to allow other processes to execute
|
||||
void CIrrDeviceMacOSX::yield()
|
||||
void CIrrDeviceMacOSX::yield()
|
||||
{
|
||||
// TODO: Does this work or maybe is there a better way?
|
||||
struct timespec ts = {0,0};
|
||||
|
@ -394,9 +389,9 @@ void CIrrDeviceMacOSX::yield()
|
|||
void CIrrDeviceMacOSX::sleep(u32 timeMs, bool pauseTimer=false)
|
||||
{
|
||||
// TODO: Does this work or maybe is there a better way?
|
||||
|
||||
|
||||
bool wasStopped = Timer ? Timer->isStopped() : true;
|
||||
|
||||
|
||||
struct timespec ts;
|
||||
ts.tv_sec = (time_t) (timeMs / 1000);
|
||||
ts.tv_nsec = (long) (timeMs % 1000) * 1000000;
|
||||
|
@ -410,11 +405,11 @@ void CIrrDeviceMacOSX::sleep(u32 timeMs, bool pauseTimer=false)
|
|||
Timer->start();
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::present(video::IImage* image, s32 windowId, core::rect<s32>* src )
|
||||
void CIrrDeviceMacOSX::present(video::IImage* image, s32 windowId, core::rect<s32>* src )
|
||||
{
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::setWindowCaption(const wchar_t* text)
|
||||
void CIrrDeviceMacOSX::setWindowCaption(const wchar_t* text)
|
||||
{
|
||||
size_t size;
|
||||
char title[1024];
|
||||
|
@ -427,19 +422,19 @@ void CIrrDeviceMacOSX::setWindowCaption(const wchar_t* text)
|
|||
}
|
||||
}
|
||||
|
||||
bool CIrrDeviceMacOSX::isWindowActive()
|
||||
bool CIrrDeviceMacOSX::isWindowActive()
|
||||
{
|
||||
return (_active);
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed)
|
||||
void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed)
|
||||
{
|
||||
NSString *str;
|
||||
NSString *str;
|
||||
std::map<int,int>::const_iterator iter;
|
||||
unsigned int result,c,mkey,mchar;
|
||||
const unsigned char *cStr;
|
||||
BOOL skipCommand;
|
||||
|
||||
unsigned int result,c,mkey,mchar;
|
||||
const unsigned char *cStr;
|
||||
BOOL skipCommand;
|
||||
|
||||
str = [event characters];
|
||||
if (str != nil && [str length] > 0)
|
||||
{
|
||||
|
@ -474,17 +469,19 @@ void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed
|
|||
ievent.KeyInput.Control = ([event modifierFlags] & NSControlKeyMask) != 0;
|
||||
ievent.KeyInput.Char = (irr::EKEY_CODE)mchar;
|
||||
|
||||
if (skipCommand) ievent.KeyInput.Control = true;
|
||||
else if ([event modifierFlags] & NSCommandKeyMask) [NSApp sendEvent:(NSEvent *)event];
|
||||
if (skipCommand)
|
||||
ievent.KeyInput.Control = true;
|
||||
else if ([event modifierFlags] & NSCommandKeyMask)
|
||||
[NSApp sendEvent:(NSEvent *)event];
|
||||
|
||||
postEventFromUser(ievent);
|
||||
}
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent)
|
||||
void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent)
|
||||
{
|
||||
BOOL post = true;
|
||||
|
||||
|
||||
if (_window != NULL)
|
||||
{
|
||||
ievent.MouseInput.X = (int)[event locationInWindow].x;
|
||||
|
@ -501,13 +498,13 @@ void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent)
|
|||
[NSApp sendEvent:(NSEvent *)event];
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::storeMouseLocation()
|
||||
void CIrrDeviceMacOSX::storeMouseLocation()
|
||||
{
|
||||
NSPoint p;
|
||||
int x,y;
|
||||
NSPoint p;
|
||||
int x,y;
|
||||
|
||||
p = [NSEvent mouseLocation];
|
||||
|
||||
|
||||
if (_window != NULL)
|
||||
{
|
||||
p = [_window convertScreenToBase:p];
|
||||
|
@ -523,11 +520,11 @@ void CIrrDeviceMacOSX::storeMouseLocation()
|
|||
((CCursorControl *)CursorControl)->updateInternalCursorPosition(x,y);
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::setMouseLocation(int x,int y)
|
||||
void CIrrDeviceMacOSX::setMouseLocation(int x,int y)
|
||||
{
|
||||
NSPoint p;
|
||||
CGPoint c;
|
||||
|
||||
NSPoint p;
|
||||
CGPoint c;
|
||||
|
||||
if (_window != NULL)
|
||||
{
|
||||
p.x = (float) x;
|
||||
|
@ -547,7 +544,7 @@ void CIrrDeviceMacOSX::setMouseLocation(int x,int y)
|
|||
CGWarpMouseCursorPosition(c);
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::setCursorVisible(bool visible)
|
||||
void CIrrDeviceMacOSX::setCursorVisible(bool visible)
|
||||
{
|
||||
CGDirectDisplayID display;
|
||||
|
||||
|
@ -556,7 +553,7 @@ void CIrrDeviceMacOSX::setCursorVisible(bool visible)
|
|||
else CGDisplayHideCursor(display);
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::initKeycodes()
|
||||
void CIrrDeviceMacOSX::initKeycodes()
|
||||
{
|
||||
_keycodes[NSUpArrowFunctionKey] = irr::KEY_UP;
|
||||
_keycodes[NSDownArrowFunctionKey] = irr::KEY_DOWN;
|
||||
|
@ -598,23 +595,20 @@ void CIrrDeviceMacOSX::initKeycodes()
|
|||
|
||||
//! Sets if the window should be resizeable in windowed mode.
|
||||
|
||||
void CIrrDeviceMacOSX::setResizeAble(bool resize)
|
||||
|
||||
void CIrrDeviceMacOSX::setResizeAble(bool resize)
|
||||
{
|
||||
|
||||
// todo: implement resize
|
||||
|
||||
}
|
||||
|
||||
|
||||
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param)
|
||||
{
|
||||
CIrrDeviceMacOSX* dev = new CIrrDeviceMacOSX(
|
||||
param.DriverType,
|
||||
param.WindowSize,
|
||||
param.DriverType,
|
||||
param.WindowSize,
|
||||
param.Bits,
|
||||
param.Fullscreen,
|
||||
param.Stencilbuffer,
|
||||
param.Fullscreen,
|
||||
param.Stencilbuffer,
|
||||
param.Vsync,
|
||||
param.AntiAlias,
|
||||
param.EventReceiver,
|
||||
|
@ -625,7 +619,7 @@ IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationP
|
|||
dev->drop();
|
||||
dev = 0;
|
||||
}
|
||||
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue