Replace spaces with tabs in OSX and iOS sources

master
MoNTE48 2021-02-26 23:31:26 +01:00
parent 0c9ba6f7fd
commit 07b8f28c2d
5 changed files with 519 additions and 519 deletions

View File

@ -23,7 +23,7 @@
namespace irr
{
class CIrrDeviceMacOSX;
class CIrrDeviceMacOSX;
}
@interface CIrrDelegateOSX : NSObject
@ -89,8 +89,8 @@ namespace irr
//! Restore the window to normal size if possible.
virtual void restoreWindow() _IRR_OVERRIDE_;
//! Get the position of this window on screen
virtual core::position2di getWindowPosition() _IRR_OVERRIDE_;
//! Get the position of this window on screen
virtual core::position2di getWindowPosition() _IRR_OVERRIDE_;
//! Activate any joysticks, and generate events for them.
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) _IRR_OVERRIDE_;
@ -108,7 +108,7 @@ namespace irr
void setMouseLocation(int x, int y);
void setResize(int width, int height);
void setCursorVisible(bool visible);
void setWindow(NSWindow* window);
void setWindow(NSWindow* window);
private:
@ -128,11 +128,11 @@ namespace irr
}
void updateWindowSize(const core::dimension2du& size)
{
WindowSize = size;
if (WindowSize.Width != 0)
InvWindowSize.Width = 1.0f / WindowSize.Width;
if (WindowSize.Height != 0)
InvWindowSize.Height = 1.0f / WindowSize.Height;
WindowSize = size;
if (WindowSize.Width != 0)
InvWindowSize.Width = 1.0f / WindowSize.Width;
if (WindowSize.Height != 0)
InvWindowSize.Height = 1.0f / WindowSize.Height;
}
//! Changes the visible state of the mouse cursor.
@ -245,7 +245,7 @@ namespace irr
void pollJoysticks();
NSWindow* Window;
CGDirectDisplayID Display;
CGDirectDisplayID Display;
NSBitmapImageRep* SoftwareDriverTarget;
std::map<int,int> KeyCodes;
int DeviceWidth;
@ -253,8 +253,8 @@ namespace irr
int ScreenWidth;
int ScreenHeight;
u32 MouseButtonStates;
u32 SoftwareRendererType;
bool IsFullscreen;
u32 SoftwareRendererType;
bool IsFullscreen;
bool IsActive;
bool IsShiftDown;
bool IsControlDown;

View File

@ -477,79 +477,79 @@ static bool firstLaunch = true;
@implementation CIrrDelegateOSX
{
irr::CIrrDeviceMacOSX* Device;
bool Quit;
irr::CIrrDeviceMacOSX* Device;
bool Quit;
}
- (id)initWithDevice:(irr::CIrrDeviceMacOSX*)device
{
self = [super init];
self = [super init];
if (self)
Device = device;
if (self)
Device = device;
Quit = false;
Quit = false;
return (self);
return (self);
}
- (void)applicationDidFinishLaunching:(NSNotification*)notification
{
Quit = false;
Quit = false;
}
- (void)orderFrontStandardAboutPanel:(id)sender
{
[NSApp orderFrontStandardAboutPanel:sender];
[NSApp orderFrontStandardAboutPanel:sender];
}
- (void)unhideAllApplications:(id)sender
{
[NSApp unhideAllApplications:sender];
[NSApp unhideAllApplications:sender];
}
- (void)hide:(id)sender
{
[NSApp hide:sender];
[NSApp hide:sender];
}
- (void)hideOtherApplications:(id)sender
{
[NSApp hideOtherApplications:sender];
[NSApp hideOtherApplications:sender];
}
- (void)terminate:(id)sender
{
Quit = true;
Quit = true;
}
- (void)windowWillClose:(id)sender
{
Device->setWindow(nil);
Quit = true;
Device->setWindow(nil);
Quit = true;
}
- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize
{
if (Device->isResizable())
return proposedFrameSize;
else
return [window frame].size;
if (Device->isResizable())
return proposedFrameSize;
else
return [window frame].size;
}
- (void)windowDidResize:(NSNotification *)aNotification
{
NSWindow *window;
NSRect frame;
NSWindow *window;
NSRect frame;
window = [aNotification object];
frame = [window contentRectForFrameRect:[window frame]];
Device->setResize((int)frame.size.width,(int)frame.size.height);
window = [aNotification object];
frame = [window contentRectForFrameRect:[window frame]];
Device->setResize((int)frame.size.width,(int)frame.size.height);
}
- (BOOL)isQuit
{
return (Quit);
return (Quit);
}
@end
@ -580,26 +580,26 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
[NSApp setDelegate:(id<NSApplicationDelegate>)[[[CIrrDelegateOSX alloc] initWithDevice:this] autorelease]];
// Create menu
// Create menu
NSString* bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSString* bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSMenu* mainMenu = [[[NSMenu alloc] initWithTitle:@"MainMenu"] autorelease];
NSMenu* menu = [[[NSMenu alloc] initWithTitle:bundleName] autorelease];
NSMenuItem* menuItem = [mainMenu addItemWithTitle:bundleName action:nil keyEquivalent:@""];
[mainMenu setSubmenu:menu forItem:menuItem];
menuItem = [menu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
[menuItem setKeyEquivalentModifierMask:NSCommandKeyMask];
NSMenu* mainMenu = [[[NSMenu alloc] initWithTitle:@"MainMenu"] autorelease];
NSMenu* menu = [[[NSMenu alloc] initWithTitle:bundleName] autorelease];
NSMenuItem* menuItem = [mainMenu addItemWithTitle:bundleName action:nil keyEquivalent:@""];
[mainMenu setSubmenu:menu forItem:menuItem];
menuItem = [menu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
[menuItem setKeyEquivalentModifierMask:NSCommandKeyMask];
[NSApp setMainMenu:mainMenu];
[NSApp setMainMenu:mainMenu];
[NSApp finishLaunching];
[NSApp finishLaunching];
}
path = [[NSBundle mainBundle] bundlePath];
path = [path stringByAppendingString:@"/Contents/Resources"];
path = [path stringByAppendingString:@"/Contents/Resources"];
chdir([path fileSystemRepresentation]);
[path release];
[path release];
}
uname(&name);
@ -654,8 +654,8 @@ void CIrrDeviceMacOSX::closeDevice()
Window = nil;
}
if (IsFullscreen)
CGReleaseAllDisplays();
if (IsFullscreen)
CGReleaseAllDisplays();
IsFullscreen = false;
IsActive = false;
@ -663,175 +663,175 @@ void CIrrDeviceMacOSX::closeDevice()
bool CIrrDeviceMacOSX::createWindow()
{
CGDisplayErr error;
bool result = false;
Display = CGMainDisplayID();
CGDisplayErr error;
bool result = false;
Display = CGMainDisplayID();
CGRect displayRect;
CGRect displayRect;
#ifdef __MAC_10_6
CGDisplayModeRef displaymode, olddisplaymode;
CGDisplayModeRef displaymode, olddisplaymode;
#else
CFDictionaryRef displaymode, olddisplaymode;
CFDictionaryRef displaymode, olddisplaymode;
#endif
ScreenWidth = (int)CGDisplayPixelsWide(Display);
ScreenHeight = (int)CGDisplayPixelsHigh(Display);
ScreenWidth = (int)CGDisplayPixelsWide(Display);
ScreenHeight = (int)CGDisplayPixelsHigh(Display);
const NSBackingStoreType type = (CreationParams.DriverType == video::EDT_OPENGL) ? NSBackingStoreBuffered : NSBackingStoreNonretained;
const NSBackingStoreType type = (CreationParams.DriverType == video::EDT_OPENGL) ? NSBackingStoreBuffered : NSBackingStoreNonretained;
if (!CreationParams.Fullscreen)
{
if (!CreationParams.WindowId) //create another window when WindowId is null
{
int x = (CreationParams.WindowPosition.X > 0) ? CreationParams.WindowPosition.X : 0;
int y = (CreationParams.WindowPosition.Y > 0) ? CreationParams.WindowPosition.Y : 0;
if (!CreationParams.Fullscreen)
{
if (!CreationParams.WindowId) //create another window when WindowId is null
{
int x = (CreationParams.WindowPosition.X > 0) ? CreationParams.WindowPosition.X : 0;
int y = (CreationParams.WindowPosition.Y > 0) ? CreationParams.WindowPosition.Y : 0;
if (CreationParams.WindowPosition.Y > -1)
{
int screenHeight = (int) [[NSScreen screens][0] frame].size.height;
y = screenHeight - y - CreationParams.WindowSize.Height;
}
if (CreationParams.WindowPosition.Y > -1)
{
int screenHeight = (int) [[NSScreen screens][0] frame].size.height;
y = screenHeight - y - CreationParams.WindowSize.Height;
}
NSWindowStyleMask style = NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask+NSMiniaturizableWindowMask;
NSWindowStyleMask style = NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask+NSMiniaturizableWindowMask;
Window = [[NSWindow alloc] initWithContentRect:NSMakeRect(x, y, CreationParams.WindowSize.Width,CreationParams.WindowSize.Height) styleMask:style backing:type defer:FALSE];
Window = [[NSWindow alloc] initWithContentRect:NSMakeRect(x, y, CreationParams.WindowSize.Width,CreationParams.WindowSize.Height) styleMask:style backing:type defer:FALSE];
NSView* view = [Window contentView];
if ([view respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)])
[view setWantsBestResolutionOpenGLSurface:YES];
NativeScale = [Window backingScaleFactor];
ScreenWidth *= NativeScale;
ScreenHeight *= NativeScale;
NSRect frame = [Window frame];
NSView* view = [Window contentView];
if ([view respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)])
[view setWantsBestResolutionOpenGLSurface:YES];
NativeScale = [Window backingScaleFactor];
ScreenWidth *= NativeScale;
ScreenHeight *= NativeScale;
NSRect frame = [Window frame];
// get title bar height
CGFloat contentHeight = [Window contentRectForFrameRect: Window.frame].size.height;
CGFloat titlebarHeight = frame.size.height - contentHeight;
// get title bar height
CGFloat contentHeight = [Window contentRectForFrameRect: Window.frame].size.height;
CGFloat titlebarHeight = frame.size.height - contentHeight;
// set correct window size
int h = CreationParams.WindowSize.Width;
int w = CreationParams.WindowSize.Height;
if (h % 2 != 0) h += 1;
if (w % 2 != 0) w += 1;
// set correct window size
int h = CreationParams.WindowSize.Width;
int w = CreationParams.WindowSize.Height;
if (h % 2 != 0) h += 1;
if (w % 2 != 0) w += 1;
frame.size.width = h / NativeScale;
frame.size.height = w / NativeScale + titlebarHeight;
[Window setFrame:frame display:YES animate:YES];
frame.size.width = h / NativeScale;
frame.size.height = w / NativeScale + titlebarHeight;
[Window setFrame:frame display:YES animate:YES];
if (CreationParams.WindowPosition.X == -1 && CreationParams.WindowPosition.Y == -1)
[Window center];
}
if (CreationParams.WindowPosition.X == -1 && CreationParams.WindowPosition.Y == -1)
[Window center];
}
int x = CreationParams.WindowSize.Width;
int y = CreationParams.WindowSize.Height;
if (x % 2 != 0) x += 1;
if (y % 2 != 0) y += 1;
int x = CreationParams.WindowSize.Width;
int y = CreationParams.WindowSize.Height;
if (x % 2 != 0) x += 1;
if (y % 2 != 0) y += 1;
DeviceWidth = (s32) (x / NativeScale);
DeviceHeight = (s32) (y / NativeScale);
DeviceWidth = (s32) (x / NativeScale);
DeviceHeight = (s32) (y / NativeScale);
result = true;
}
else
{
IsFullscreen = true;
result = true;
}
else
{
IsFullscreen = true;
#ifdef __MAC_10_6
displaymode = CGDisplayCopyDisplayMode(Display);
displaymode = CGDisplayCopyDisplayMode(Display);
CFArrayRef Modes = CGDisplayCopyAllDisplayModes(Display, NULL);
CFArrayRef Modes = CGDisplayCopyAllDisplayModes(Display, NULL);
for(int i = 0; i < CFArrayGetCount(Modes); ++i)
{
CGDisplayModeRef CurrentMode = (CGDisplayModeRef)CFArrayGetValueAtIndex(Modes, i);
for(int i = 0; i < CFArrayGetCount(Modes); ++i)
{
CGDisplayModeRef CurrentMode = (CGDisplayModeRef)CFArrayGetValueAtIndex(Modes, i);
u8 Depth = 0;
u8 Depth = 0;
CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(CurrentMode);
CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(CurrentMode);
if (CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
Depth = 32;
else if(CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
Depth = 16;
else if(CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
Depth = 8;
if (CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
Depth = 32;
else if(CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
Depth = 16;
else if(CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
Depth = 8;
if(Depth == CreationParams.Bits)
if((CGDisplayModeGetWidth(CurrentMode) == CreationParams.WindowSize.Width) && (CGDisplayModeGetHeight(CurrentMode) == CreationParams.WindowSize.Height))
{
displaymode = CurrentMode;
break;
}
}
if(Depth == CreationParams.Bits)
if((CGDisplayModeGetWidth(CurrentMode) == CreationParams.WindowSize.Width) && (CGDisplayModeGetHeight(CurrentMode) == CreationParams.WindowSize.Height))
{
displaymode = CurrentMode;
break;
}
}
#else
displaymode = CGDisplayBestModeForParameters(Display,CreationParams.Bits,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height,NULL);
displaymode = CGDisplayBestModeForParameters(Display,CreationParams.Bits,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height,NULL);
#endif
if (displaymode != NULL)
{
if (displaymode != NULL)
{
#ifdef __MAC_10_6
olddisplaymode = CGDisplayCopyDisplayMode(Display);
olddisplaymode = CGDisplayCopyDisplayMode(Display);
#else
olddisplaymode = CGDisplayCurrentMode(Display);
olddisplaymode = CGDisplayCurrentMode(Display);
#endif
error = CGCaptureAllDisplays();
if (error == CGDisplayNoErr)
{
error = CGCaptureAllDisplays();
if (error == CGDisplayNoErr)
{
#ifdef __MAC_10_6
error = CGDisplaySetDisplayMode(Display, displaymode, NULL);
error = CGDisplaySetDisplayMode(Display, displaymode, NULL);
#else
error = CGDisplaySwitchToMode(Display, displaymode);
error = CGDisplaySwitchToMode(Display, displaymode);
#endif
if (error == CGDisplayNoErr)
{
Window = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame] styleMask:NSBorderlessWindowMask backing:type defer:FALSE screen:[NSScreen mainScreen]];
if (error == CGDisplayNoErr)
{
Window = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame] styleMask:NSBorderlessWindowMask backing:type defer:FALSE screen:[NSScreen mainScreen]];
[Window setLevel: CGShieldingWindowLevel()];
[Window setBackgroundColor:[NSColor blackColor]];
[Window setLevel: CGShieldingWindowLevel()];
[Window setBackgroundColor:[NSColor blackColor]];
displayRect = CGDisplayBounds(Display);
ScreenWidth = DeviceWidth = (int)displayRect.size.width;
ScreenHeight = DeviceHeight = (int)displayRect.size.height;
CreationParams.WindowSize.set(ScreenWidth, ScreenHeight);
displayRect = CGDisplayBounds(Display);
ScreenWidth = DeviceWidth = (int)displayRect.size.width;
ScreenHeight = DeviceHeight = (int)displayRect.size.height;
CreationParams.WindowSize.set(ScreenWidth, ScreenHeight);
result = true;
}
result = true;
}
if (!result)
CGReleaseAllDisplays();
}
}
}
if (!result)
CGReleaseAllDisplays();
}
}
}
if (result)
{
if (Window)
{
[Window setDelegate:(id<NSWindowDelegate>)[NSApp delegate]];
[Window setAcceptsMouseMovedEvents:TRUE];
[Window setIsVisible:TRUE];
[Window makeKeyAndOrderFront:nil];
}
if (result)
{
if (Window)
{
[Window setDelegate:(id<NSWindowDelegate>)[NSApp delegate]];
[Window setAcceptsMouseMovedEvents:TRUE];
[Window setIsVisible:TRUE];
[Window makeKeyAndOrderFront:nil];
}
if (IsFullscreen) //hide menus in fullscreen mode only
{
if (IsFullscreen) //hide menus in fullscreen mode only
{
#ifdef __MAC_10_6
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
#else
SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
#endif
}
}
}
}
return result;
return result;
}
void CIrrDeviceMacOSX::setResize(int width, int height)
{
if (width % 2 != 0) width += 1;
if (height % 2 != 0) height += 1;
if (width % 2 != 0) width += 1;
if (height % 2 != 0) height += 1;
// set new window size
DeviceWidth = width;
@ -840,12 +840,12 @@ void CIrrDeviceMacOSX::setResize(int width, int height)
#if defined(_IRR_COMPILE_WITH_OPENGL_)
// update the size of the opengl rendering context
if (CreationParams.DriverType == video::EDT_OPENGL)
{
NSOpenGLContext* Context = (NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context;
{
NSOpenGLContext* Context = (NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context;
if (Context)
[Context update];
}
if (Context)
[Context update];
}
#endif
// resize the driver to the inner pane size
@ -858,14 +858,14 @@ void CIrrDeviceMacOSX::setResize(int width, int height)
else
getVideoDriver()->OnResize(core::dimension2d<u32>((u32) (width * NativeScale), (u32) (height * NativeScale)));
// update device size to be ready to change screen resolution
CGRect displayRect = CGDisplayBounds(CGMainDisplayID());
// update device size to be ready to change screen resolution
CGRect displayRect = CGDisplayBounds(CGMainDisplayID());
ScreenWidth = (int) (displayRect.size.width * NativeScale);
ScreenHeight = (int) (displayRect.size.height * NativeScale);
ScreenWidth = (int) (displayRect.size.width * NativeScale);
ScreenHeight = (int) (displayRect.size.height * NativeScale);
// reset mouse state on window resize
MouseButtonStates = NO;
// reset mouse state on window resize
MouseButtonStates = NO;
}
@ -893,27 +893,27 @@ void CIrrDeviceMacOSX::createDriver()
case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_
{
video::SExposedVideoData data;
data.OpenGLOSX.Window = Window;
ContextManager = new video::CNSOGLManager();
ContextManager->initialize(CreationParams, data);
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager);
if (!VideoDriver)
{
os::Printer::log("Could not create OpenGL driver.", ELL_ERROR);
}
{
video::SExposedVideoData data;
data.OpenGLOSX.Window = Window;
ContextManager = new video::CNSOGLManager();
ContextManager->initialize(CreationParams, data);
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager);
if (!VideoDriver)
{
os::Printer::log("Could not create OpenGL driver.", ELL_ERROR);
}
if (Window)
[(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:[Window contentView]];
else
[(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:(NSView*)CreationParams.WindowId];
if (Window)
[(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:[Window contentView]];
else
[(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:(NSView*)CreationParams.WindowId];
#ifndef __MAC_10_6
CGLContextObj CGLContext = (CGLContextObj)[(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context CGLContextObj];
CGLSetFullScreen(CGLContext);
CGLContextObj CGLContext = (CGLContextObj)[(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context CGLContextObj];
CGLSetFullScreen(CGLContext);
#endif
}
}
#else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif
@ -1057,13 +1057,13 @@ bool CIrrDeviceMacOSX::run()
postMouseEvent(event,ievent);
break;
}
ievent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
ievent.MouseInput.Wheel = (s32) [event deltaY];
if (ievent.MouseInput.Wheel < 1.0f)
ievent.MouseInput.Wheel *= 10.0f;
else
ievent.MouseInput.Wheel *= 5.0f;
postMouseEvent(event,ievent);
ievent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
ievent.MouseInput.Wheel = (s32) [event deltaY];
if (ievent.MouseInput.Wheel < 1.0f)
ievent.MouseInput.Wheel *= 10.0f;
else
ievent.MouseInput.Wheel *= 5.0f;
postMouseEvent(event,ievent);
break;
default:
@ -1251,8 +1251,8 @@ void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent)
{
ievent.MouseInput.Shift = ([(NSEvent *)event modifierFlags] & NSShiftKeyMask) != 0;
ievent.MouseInput.Control = ([(NSEvent *)event modifierFlags] & NSControlKeyMask) != 0;
ievent.MouseInput.X *= NativeScale;
ievent.MouseInput.Y *= NativeScale;
ievent.MouseInput.X *= NativeScale;
ievent.MouseInput.Y *= NativeScale;
postEventFromUser(ievent);
}
@ -1295,16 +1295,16 @@ void CIrrDeviceMacOSX::storeMouseLocation()
}
}
x *= NativeScale;
y *= NativeScale;
x *= NativeScale;
y *= NativeScale;
((CCursorControl *)CursorControl)->updateInternalCursorPosition(x,y);
}
void CIrrDeviceMacOSX::setMouseLocation(int x,int y)
{
x /= NativeScale;
y /= NativeScale;
x /= NativeScale;
y /= NativeScale;
NSPoint p;
CGPoint c;
@ -1326,16 +1326,16 @@ void CIrrDeviceMacOSX::setMouseLocation(int x,int y)
c.x = p.x;
c.y = p.y;
#ifdef __MAC_10_6
// CGEventRef ev = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, c, NULL);
// CGEventPost(kCGHIDEventTap, ev);
// CFRelease(ev);
/*#ifdef __MAC_10_6
CGEventRef ev = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, c, NULL);
CGEventPost(kCGHIDEventTap, ev);
CFRelease(ev);
#else
CGSetLocalEventsSuppressionInterval(0);
CGWarpMouseCursorPosition(c);
#endif*/
CGSetLocalEventsSuppressionInterval(0);
CGWarpMouseCursorPosition(c);
#else
CGSetLocalEventsSuppressionInterval(0);
CGWarpMouseCursorPosition(c);
#endif
}
@ -1350,7 +1350,7 @@ void CIrrDeviceMacOSX::setCursorVisible(bool visible)
void CIrrDeviceMacOSX::setWindow(NSWindow* window)
{
Window = window;
Window = window;
}

View File

@ -46,28 +46,28 @@ namespace irr
virtual core::position2di getWindowPosition() _IRR_OVERRIDE_;
virtual bool activateAccelerometer(float updateInterval = 0.016666f) _IRR_OVERRIDE_;
virtual bool deactivateAccelerometer() _IRR_OVERRIDE_;
virtual bool isAccelerometerActive() _IRR_OVERRIDE_;
virtual bool isAccelerometerAvailable() _IRR_OVERRIDE_;
virtual bool activateGyroscope(float updateInterval = 0.016666f) _IRR_OVERRIDE_;
virtual bool deactivateGyroscope() _IRR_OVERRIDE_;
virtual bool isGyroscopeActive() _IRR_OVERRIDE_;
virtual bool isGyroscopeAvailable() _IRR_OVERRIDE_;
virtual bool activateDeviceMotion(float updateInterval = 0.016666f) _IRR_OVERRIDE_;
virtual bool deactivateDeviceMotion() _IRR_OVERRIDE_;
virtual bool isDeviceMotionActive() _IRR_OVERRIDE_;
virtual bool isDeviceMotionAvailable() _IRR_OVERRIDE_;
virtual bool activateAccelerometer(float updateInterval = 0.016666f) _IRR_OVERRIDE_;
virtual bool deactivateAccelerometer() _IRR_OVERRIDE_;
virtual bool isAccelerometerActive() _IRR_OVERRIDE_;
virtual bool isAccelerometerAvailable() _IRR_OVERRIDE_;
virtual bool activateGyroscope(float updateInterval = 0.016666f) _IRR_OVERRIDE_;
virtual bool deactivateGyroscope() _IRR_OVERRIDE_;
virtual bool isGyroscopeActive() _IRR_OVERRIDE_;
virtual bool isGyroscopeAvailable() _IRR_OVERRIDE_;
virtual bool activateDeviceMotion(float updateInterval = 0.016666f) _IRR_OVERRIDE_;
virtual bool deactivateDeviceMotion() _IRR_OVERRIDE_;
virtual bool isDeviceMotionActive() _IRR_OVERRIDE_;
virtual bool isDeviceMotionAvailable() _IRR_OVERRIDE_;
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_;
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_;
void *getViewController();
void *getViewController();
private:
void createWindow();
void createViewAndDriver();
void createWindow();
void createViewAndDriver();
void* DataStorage;
void* DataStorage;
bool Close;
};

View File

@ -187,19 +187,19 @@ namespace irr
@implementation CIrrViewiOS
{
irr::CIrrDeviceiOS* Device;
irr::CIrrDeviceiOS* Device;
}
- (id)initWithFrame:(CGRect)frame forDevice:(irr::CIrrDeviceiOS*)device;
{
self = [super initWithFrame:frame];
self.Scale = 1.0f;
if (self)
{
Device = device;
}
self = [super initWithFrame:frame];
self.Scale = 1.0f;
if (self)
{
Device = device;
}
return self;
return self;
}
- (BOOL)isMultipleTouchEnabled
@ -216,14 +216,14 @@ namespace irr
for (UITouch* touch in touches)
{
ev.TouchInput.ID = (size_t)touch;
ev.TouchInput.ID = (size_t)touch;
CGPoint touchPoint = [touch locationInView:self];
ev.TouchInput.X = touchPoint.x * self.Scale;
ev.TouchInput.Y = touchPoint.y * self.Scale;
ev.TouchInput.X = touchPoint.x * self.Scale;
ev.TouchInput.Y = touchPoint.y * self.Scale;
Device->postEventFromUser(ev);
Device->postEventFromUser(ev);
}
}
@ -236,14 +236,14 @@ namespace irr
for (UITouch* touch in touches)
{
ev.TouchInput.ID = (size_t)touch;
ev.TouchInput.ID = (size_t)touch;
CGPoint touchPoint = [touch locationInView:self];
ev.TouchInput.X = touchPoint.x * self.Scale;
ev.TouchInput.Y = touchPoint.y * self.Scale;
ev.TouchInput.X = touchPoint.x * self.Scale;
ev.TouchInput.Y = touchPoint.y * self.Scale;
Device->postEventFromUser(ev);
Device->postEventFromUser(ev);
}
}
@ -256,14 +256,14 @@ namespace irr
for (UITouch* touch in touches)
{
ev.TouchInput.ID = (size_t)touch;
ev.TouchInput.ID = (size_t)touch;
CGPoint touchPoint = [touch locationInView:self];
ev.TouchInput.X = touchPoint.x * self.Scale;
ev.TouchInput.Y = touchPoint.y * self.Scale;
ev.TouchInput.X = touchPoint.x * self.Scale;
ev.TouchInput.Y = touchPoint.y * self.Scale;
Device->postEventFromUser(ev);
Device->postEventFromUser(ev);
}
}
@ -276,14 +276,14 @@ namespace irr
for (UITouch* touch in touches)
{
ev.TouchInput.ID = (size_t)touch;
ev.TouchInput.ID = (size_t)touch;
CGPoint touchPoint = [touch locationInView:self];
ev.TouchInput.X = touchPoint.x * self.Scale;
ev.TouchInput.Y = touchPoint.y * self.Scale;
ev.TouchInput.X = touchPoint.x * self.Scale;
ev.TouchInput.Y = touchPoint.y * self.Scale;
Device->postEventFromUser(ev);
Device->postEventFromUser(ev);
}
}
@ -313,24 +313,24 @@ namespace irr
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
}
struct SIrrDeviceiOSDataStorage
{
SIrrDeviceiOSDataStorage() : Window(0), ViewController(0), View(0), MotionManager(0), ReferenceAttitude(0)
{
MotionManager = [[CMMotionManager alloc] init];
}
struct SIrrDeviceiOSDataStorage
{
SIrrDeviceiOSDataStorage() : Window(0), ViewController(0), View(0), MotionManager(0), ReferenceAttitude(0)
{
MotionManager = [[CMMotionManager alloc] init];
}
UIWindow* Window;
UIViewController* ViewController;
CIrrViewiOS* View;
CMMotionManager* MotionManager;
CMAttitude* ReferenceAttitude;
};
UIWindow* Window;
UIViewController* ViewController;
CIrrViewiOS* View;
CMMotionManager* MotionManager;
CMAttitude* ReferenceAttitude;
};
CIrrDeviceiOS::CIrrDeviceiOS(const SIrrlichtCreationParameters& params) : CIrrDeviceStub(params), DataStorage(0), Close(false)
{
CIrrDeviceiOS::CIrrDeviceiOS(const SIrrlichtCreationParameters& params) : CIrrDeviceStub(params), DataStorage(0), Close(false)
{
#ifdef _DEBUG
setDebugName("CIrrDeviceiOS");
setDebugName("CIrrDeviceiOS");
#endif
#ifdef _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
@ -338,35 +338,35 @@ namespace irr
[delegate setDevice:this];
#endif
DataStorage = new SIrrDeviceiOSDataStorage();
DataStorage = new SIrrDeviceiOSDataStorage();
FileSystem->changeWorkingDirectoryTo([[[NSBundle mainBundle] resourcePath] UTF8String]);
FileSystem->changeWorkingDirectoryTo([[[NSBundle mainBundle] resourcePath] UTF8String]);
createWindow();
createViewAndDriver();
createViewAndDriver();
if (!VideoDriver)
return;
if (!VideoDriver)
return;
createGUIAndScene();
}
createGUIAndScene();
}
CIrrDeviceiOS::~CIrrDeviceiOS()
{
deactivateDeviceMotion();
deactivateGyroscope();
deactivateAccelerometer();
CIrrDeviceiOS::~CIrrDeviceiOS()
{
deactivateDeviceMotion();
deactivateGyroscope();
deactivateAccelerometer();
delete static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
delete static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
#ifdef _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
CIrrDelegateiOS* delegate = [UIApplication sharedApplication].delegate;
[delegate setDevice:nil];
#endif
}
}
bool CIrrDeviceiOS::run()
{
bool CIrrDeviceiOS::run()
{
if (!Close)
{
const CFTimeInterval timeInSeconds = 0.000002;
@ -432,37 +432,37 @@ namespace irr
}
return !Close;
}
}
void CIrrDeviceiOS::yield()
{
struct timespec ts = {0,0};
nanosleep(&ts, NULL);
}
void CIrrDeviceiOS::yield()
{
struct timespec ts = {0,0};
nanosleep(&ts, NULL);
}
void CIrrDeviceiOS::sleep(u32 timeMs, bool pauseTimer=false)
{
bool wasStopped = Timer ? Timer->isStopped() : true;
void CIrrDeviceiOS::sleep(u32 timeMs, bool pauseTimer=false)
{
bool wasStopped = Timer ? Timer->isStopped() : true;
struct timespec ts;
ts.tv_sec = (time_t) (timeMs / 1000);
ts.tv_nsec = (long) (timeMs % 1000) * 1000000;
struct timespec ts;
ts.tv_sec = (time_t) (timeMs / 1000);
ts.tv_nsec = (long) (timeMs % 1000) * 1000000;
if (pauseTimer && !wasStopped)
Timer->stop();
if (pauseTimer && !wasStopped)
Timer->stop();
nanosleep(&ts, NULL);
nanosleep(&ts, NULL);
if (pauseTimer && !wasStopped)
Timer->start();
}
if (pauseTimer && !wasStopped)
Timer->start();
}
void CIrrDeviceiOS::setWindowCaption(const wchar_t* text)
{
}
void CIrrDeviceiOS::setWindowCaption(const wchar_t* text)
{
}
bool CIrrDeviceiOS::isWindowActive() const
{
bool CIrrDeviceiOS::isWindowActive() const
{
#ifdef _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
CIrrDelegateiOS* delegate = [UIApplication sharedApplication].delegate;
@ -470,10 +470,10 @@ namespace irr
#else
return false;
#endif
}
}
bool CIrrDeviceiOS::isWindowFocused() const
{
bool CIrrDeviceiOS::isWindowFocused() const
{
#ifdef _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
CIrrDelegateiOS* delegate = [UIApplication sharedApplication].delegate;
@ -481,10 +481,10 @@ namespace irr
#else
return false;
#endif
}
}
bool CIrrDeviceiOS::isWindowMinimized() const
{
bool CIrrDeviceiOS::isWindowMinimized() const
{
#ifdef _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
CIrrDelegateiOS* delegate = [UIApplication sharedApplication].delegate;
@ -492,219 +492,219 @@ namespace irr
#else
return false;
#endif
}
}
bool CIrrDeviceiOS::present(video::IImage* image, void * windowId, core::rect<s32>* src)
{
return false;
}
bool CIrrDeviceiOS::present(video::IImage* image, void * windowId, core::rect<s32>* src)
{
return false;
}
void CIrrDeviceiOS::closeDevice()
{
CFRunLoopStop(CFRunLoopGetMain());
void CIrrDeviceiOS::closeDevice()
{
CFRunLoopStop(CFRunLoopGetMain());
Close = true;
}
}
void CIrrDeviceiOS::setResizable(bool resize)
{
}
void CIrrDeviceiOS::setResizable(bool resize)
{
}
void CIrrDeviceiOS::minimizeWindow()
{
}
void CIrrDeviceiOS::minimizeWindow()
{
}
void CIrrDeviceiOS::maximizeWindow()
{
}
void CIrrDeviceiOS::maximizeWindow()
{
}
void CIrrDeviceiOS::restoreWindow()
{
}
void CIrrDeviceiOS::restoreWindow()
{
}
core::position2di CIrrDeviceiOS::getWindowPosition()
{
return core::position2di(0, 0);
}
core::position2di CIrrDeviceiOS::getWindowPosition()
{
return core::position2di(0, 0);
}
bool CIrrDeviceiOS::activateAccelerometer(float updateInterval)
{
bool status = false;
bool CIrrDeviceiOS::activateAccelerometer(float updateInterval)
{
bool status = false;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
if (motionManager.isAccelerometerAvailable)
{
if (!motionManager.isAccelerometerActive)
{
motionManager.accelerometerUpdateInterval = updateInterval;
[motionManager startAccelerometerUpdates];
}
if (motionManager.isAccelerometerAvailable)
{
if (!motionManager.isAccelerometerActive)
{
motionManager.accelerometerUpdateInterval = updateInterval;
[motionManager startAccelerometerUpdates];
}
status = true;
}
status = true;
}
return status;
}
return status;
}
bool CIrrDeviceiOS::deactivateAccelerometer()
{
bool status = false;
bool CIrrDeviceiOS::deactivateAccelerometer()
{
bool status = false;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
if (motionManager.isAccelerometerAvailable)
{
if (motionManager.isAccelerometerActive)
[motionManager stopAccelerometerUpdates];
if (motionManager.isAccelerometerAvailable)
{
if (motionManager.isAccelerometerActive)
[motionManager stopAccelerometerUpdates];
status = true;
}
status = true;
}
return status;
}
return status;
}
bool CIrrDeviceiOS::isAccelerometerActive()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
bool CIrrDeviceiOS::isAccelerometerActive()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
return (dataStorage->MotionManager.isAccelerometerActive);
}
return (dataStorage->MotionManager.isAccelerometerActive);
}
bool CIrrDeviceiOS::isAccelerometerAvailable()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
bool CIrrDeviceiOS::isAccelerometerAvailable()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
return (dataStorage->MotionManager.isAccelerometerAvailable);
}
return (dataStorage->MotionManager.isAccelerometerAvailable);
}
bool CIrrDeviceiOS::activateGyroscope(float updateInterval)
{
bool status = false;
bool CIrrDeviceiOS::activateGyroscope(float updateInterval)
{
bool status = false;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
if (motionManager.isGyroAvailable)
{
if (!motionManager.isGyroActive)
{
motionManager.gyroUpdateInterval = updateInterval;
[motionManager startGyroUpdates];
}
if (motionManager.isGyroAvailable)
{
if (!motionManager.isGyroActive)
{
motionManager.gyroUpdateInterval = updateInterval;
[motionManager startGyroUpdates];
}
status = true;
}
status = true;
}
return status;
}
return status;
}
bool CIrrDeviceiOS::deactivateGyroscope()
{
bool status = false;
bool CIrrDeviceiOS::deactivateGyroscope()
{
bool status = false;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
if (motionManager.isGyroAvailable)
{
if (motionManager.isGyroActive)
[motionManager stopGyroUpdates];
if (motionManager.isGyroAvailable)
{
if (motionManager.isGyroActive)
[motionManager stopGyroUpdates];
status = true;
}
status = true;
}
return status;
}
return status;
}
bool CIrrDeviceiOS::isGyroscopeActive()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
bool CIrrDeviceiOS::isGyroscopeActive()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
return (dataStorage->MotionManager.isGyroActive);
}
return (dataStorage->MotionManager.isGyroActive);
}
bool CIrrDeviceiOS::isGyroscopeAvailable()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
bool CIrrDeviceiOS::isGyroscopeAvailable()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
return (dataStorage->MotionManager.isGyroAvailable);
}
return (dataStorage->MotionManager.isGyroAvailable);
}
bool CIrrDeviceiOS::activateDeviceMotion(float updateInterval)
{
bool status = false;
bool CIrrDeviceiOS::activateDeviceMotion(float updateInterval)
{
bool status = false;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
if (motionManager.isDeviceMotionAvailable)
{
if (!motionManager.isDeviceMotionActive)
{
dataStorage->ReferenceAttitude = nil;
if (motionManager.isDeviceMotionAvailable)
{
if (!motionManager.isDeviceMotionActive)
{
dataStorage->ReferenceAttitude = nil;
motionManager.deviceMotionUpdateInterval = updateInterval;
[motionManager startDeviceMotionUpdates];
}
motionManager.deviceMotionUpdateInterval = updateInterval;
[motionManager startDeviceMotionUpdates];
}
status = true;
}
status = true;
}
return status;
}
return status;
}
bool CIrrDeviceiOS::deactivateDeviceMotion()
{
bool status = false;
bool CIrrDeviceiOS::deactivateDeviceMotion()
{
bool status = false;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
CMMotionManager* motionManager = dataStorage->MotionManager;
if (motionManager.isDeviceMotionAvailable)
{
if (motionManager.isDeviceMotionActive)
{
[motionManager stopDeviceMotionUpdates];
if (motionManager.isDeviceMotionAvailable)
{
if (motionManager.isDeviceMotionActive)
{
[motionManager stopDeviceMotionUpdates];
dataStorage->ReferenceAttitude = nil;
}
dataStorage->ReferenceAttitude = nil;
}
status = true;
}
status = true;
}
return status;
}
return status;
}
bool CIrrDeviceiOS::isDeviceMotionActive()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
bool CIrrDeviceiOS::isDeviceMotionActive()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
return (dataStorage->MotionManager.isDeviceMotionActive);
}
return (dataStorage->MotionManager.isDeviceMotionActive);
}
bool CIrrDeviceiOS::isDeviceMotionAvailable()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
bool CIrrDeviceiOS::isDeviceMotionAvailable()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
return (dataStorage->MotionManager.isDeviceMotionAvailable);
}
return (dataStorage->MotionManager.isDeviceMotionAvailable);
}
E_DEVICE_TYPE CIrrDeviceiOS::getType() const
{
return EIDT_IOS;
}
E_DEVICE_TYPE CIrrDeviceiOS::getType() const
{
return EIDT_IOS;
}
void *CIrrDeviceiOS::getViewController()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
return (__bridge void*) dataStorage->ViewController;
}
void *CIrrDeviceiOS::getViewController()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
return (__bridge void*) dataStorage->ViewController;
}
void CIrrDeviceiOS::createWindow()
{
void CIrrDeviceiOS::createWindow()
{
if (CreationParams.DriverType != video::EDT_NULL)
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
@ -748,10 +748,10 @@ namespace irr
while (currentResponder != nil);
}
}
}
}
void CIrrDeviceiOS::createViewAndDriver()
{
void CIrrDeviceiOS::createViewAndDriver()
{
SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
video::SExposedVideoData data;
@ -762,11 +762,11 @@ namespace irr
CGRect resolution = (externalView == nil) ? [[UIScreen mainScreen] bounds] : externalView.bounds;
switch (CreationParams.DriverType)
{
case video::EDT_OGLES1:
switch (CreationParams.DriverType)
{
case video::EDT_OGLES1:
#ifdef _IRR_COMPILE_WITH_OGLES1_
{
{
CIrrViewEAGLiOS* view = [[CIrrViewEAGLiOS alloc] initWithFrame:resolution forDevice:this];
view.contentScaleFactor = dataStorage->Window.screen.nativeScale;
view.Scale = view.contentScaleFactor;
@ -779,30 +779,30 @@ namespace irr
dataStorage->View = view;
data.OpenGLiOS.View = (__bridge void*)view;
ContextManager = new video::CEAGLManager();
ContextManager->initialize(CreationParams, data);
ContextManager = new video::CEAGLManager();
ContextManager->initialize(CreationParams, data);
VideoDriver = video::createOGLES1Driver(CreationParams, FileSystem, ContextManager);
VideoDriver = video::createOGLES1Driver(CreationParams, FileSystem, ContextManager);
if (!VideoDriver)
os::Printer::log("Could not create OpenGL ES 1.x driver.", ELL_ERROR);
}
if (!VideoDriver)
os::Printer::log("Could not create OpenGL ES 1.x driver.", ELL_ERROR);
}
#else
os::Printer::log("No OpenGL ES 1.x support compiled in.", ELL_ERROR);
os::Printer::log("No OpenGL ES 1.x support compiled in.", ELL_ERROR);
#endif
break;
break;
case video::EDT_OGLES2:
#ifdef _IRR_COMPILE_WITH_OGLES2_
{
CIrrViewEAGLiOS* view = [[CIrrViewEAGLiOS alloc] initWithFrame:resolution forDevice:this];
view.contentScaleFactor = dataStorage->Window.screen.nativeScale;
view.Scale = view.contentScaleFactor;
CreationParams.WindowSize =
{
view.frame.size.width * view.contentScaleFactor,
view.frame.size.height * view.contentScaleFactor
};
view.contentScaleFactor = dataStorage->Window.screen.nativeScale;
view.Scale = view.contentScaleFactor;
CreationParams.WindowSize =
{
view.frame.size.width * view.contentScaleFactor,
view.frame.size.height * view.contentScaleFactor
};
dataStorage->View = view;
data.OpenGLiOS.View = (__bridge void*)view;
@ -820,22 +820,22 @@ namespace irr
#endif
break;
case video::EDT_SOFTWARE:
case video::EDT_BURNINGSVIDEO:
case video::DEPRECATED_EDT_DIRECT3D8_NO_LONGER_EXISTS:
case video::EDT_DIRECT3D9:
case video::EDT_OPENGL:
os::Printer::log("This driver is not available in iOS. Try OpenGL ES.", ELL_ERROR);
break;
case video::EDT_SOFTWARE:
case video::EDT_BURNINGSVIDEO:
case video::DEPRECATED_EDT_DIRECT3D8_NO_LONGER_EXISTS:
case video::EDT_DIRECT3D9:
case video::EDT_OPENGL:
os::Printer::log("This driver is not available in iOS. Try OpenGL ES.", ELL_ERROR);
break;
case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break;
case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break;
default:
os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR);
break;
}
default:
os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR);
break;
}
if (externalView == nil)
dataStorage->ViewController.view = dataStorage->View;
@ -847,9 +847,9 @@ namespace irr
#ifdef _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
int main(int argc, char** argv)
{
int result = UIApplicationMain(argc, argv, 0, NSStringFromClass([CIrrDelegateiOS class]));
int result = UIApplicationMain(argc, argv, 0, NSStringFromClass([CIrrDelegateiOS class]));
return result;
return result;
}
#endif

View File

@ -902,8 +902,8 @@
5E34C8051B7F51D900F212E8 /* irrXML.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = irrXML.cpp; sourceTree = "<group>"; };
5E34C80D1B7F52AC00F212E8 /* CIrrDeviceStub.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CIrrDeviceStub.cpp; sourceTree = "<group>"; };
5E34C80E1B7F52AC00F212E8 /* CIrrDeviceStub.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIrrDeviceStub.h; sourceTree = "<group>"; };
5E34C8131B7F535C00F212E8 /* CIrrDeviceOSX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIrrDeviceOSX.h; sourceTree = "<group>"; };
5E34C8141B7F535C00F212E8 /* CIrrDeviceOSX.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CIrrDeviceOSX.mm; sourceTree = "<group>"; };
5E34C8131B7F535C00F212E8 /* CIrrDeviceOSX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIrrDeviceOSX.h; sourceTree = "<group>"; usesTabs = 1; };
5E34C8141B7F535C00F212E8 /* CIrrDeviceOSX.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CIrrDeviceOSX.mm; sourceTree = "<group>"; usesTabs = 1; };
5E34C8151B7F540B00F212E8 /* aes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = aes.h; path = aesGladman/aes.h; sourceTree = "<group>"; };
5E34C8161B7F540B00F212E8 /* aescrypt.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = aescrypt.cpp; path = aesGladman/aescrypt.cpp; sourceTree = "<group>"; };
5E34C8171B7F540B00F212E8 /* aeskey.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = aeskey.cpp; path = aesGladman/aeskey.cpp; sourceTree = "<group>"; };
@ -1330,8 +1330,8 @@
5E34C9EE1B7F6CCC00F212E8 /* CNSOGLManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CNSOGLManager.mm; sourceTree = "<group>"; };
5E34C9F31B7F6E3400F212E8 /* libIrrlicht.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIrrlicht.a; sourceTree = BUILT_PRODUCTS_DIR; };
5E5733E51C18E212003F664E /* libIrrlicht.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIrrlicht.a; sourceTree = BUILT_PRODUCTS_DIR; };
5E5733E61C18E254003F664E /* CIrrDeviceiOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CIrrDeviceiOS.h; sourceTree = "<group>"; };
5E5733E71C18E254003F664E /* CIrrDeviceiOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CIrrDeviceiOS.mm; sourceTree = "<group>"; };
5E5733E61C18E254003F664E /* CIrrDeviceiOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CIrrDeviceiOS.h; sourceTree = "<group>"; usesTabs = 1; };
5E5733E71C18E254003F664E /* CIrrDeviceiOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CIrrDeviceiOS.mm; sourceTree = "<group>"; usesTabs = 1; };
5E5733EC1C18E2C0003F664E /* COGLESCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = COGLESCommon.h; sourceTree = "<group>"; };
5E5733ED1C18E2C0003F664E /* COGLESDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = COGLESDriver.cpp; sourceTree = "<group>"; };
5E5733EE1C18E2C0003F664E /* COGLESDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = COGLESDriver.h; sourceTree = "<group>"; };