forked from Mirrors/openclonk
mac: Move C4OpenGLView.mm/h to graphics/C4DrawGLMac.mm/h and move some C4AbstractApp functions to C4AppMac.mm to better match implementations for the other platforms
parent
7bbb3468b9
commit
562565f865
|
@ -649,8 +649,8 @@ elseif(USE_COCOA)
|
|||
src/platform/C4WindowMac.mm
|
||||
src/platform/C4AppDelegate+MainMenuActions.h
|
||||
src/platform/C4AppDelegate+MainMenuActions.mm
|
||||
src/platform/C4OpenGLView.h
|
||||
src/platform/C4OpenGLView.mm
|
||||
src/graphics/C4DrawGLMac.h
|
||||
src/graphics/C4DrawGLMac.mm
|
||||
src/platform/C4WindowController.h
|
||||
src/platform/C4WindowController.mm
|
||||
src/platform/CocoaKeycodeMap.h
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "C4AppDelegate.h"
|
||||
#import "C4EditorWindowController.h"
|
||||
#import "C4OpenGLView.h"
|
||||
#import "C4DrawGLMac.h"
|
||||
|
||||
// implementation of C4Console GUI for Mac OS X
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <C4DrawGL.h>
|
||||
|
||||
#import "C4OpenGLView.h"
|
||||
#import "C4DrawGLMac.h"
|
||||
#import "C4WindowController.h"
|
||||
#import "C4AppDelegate+MainMenuActions.h"
|
||||
|
||||
|
@ -529,27 +529,6 @@ void C4Window::EnumerateMultiSamples(std::vector<int>& samples) const
|
|||
[C4OpenGLView enumerateMultiSamples:samples];
|
||||
}
|
||||
|
||||
bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigned int iColorDepth, unsigned int iRefreshRate, unsigned int iMonitor, bool fFullScreen)
|
||||
{
|
||||
fFullScreen &= !lionAndBeyond(); // Always false for Lion since then Lion's true(tm) Fullscreen is used
|
||||
C4WindowController* controller = pWindow->objectiveCObject<C4WindowController>();
|
||||
NSWindow* window = controller.window;
|
||||
|
||||
if (iXRes == -1 && iYRes == -1)
|
||||
{
|
||||
iXRes = CGDisplayPixelsWide(C4OpenGLView.displayID);
|
||||
iYRes = CGDisplayPixelsHigh(C4OpenGLView.displayID);
|
||||
}
|
||||
pWindow->SetSize(iXRes, iYRes);
|
||||
[controller setFullscreen:fFullScreen];
|
||||
[window setAspectRatio:[[window contentView] frame].size];
|
||||
[window center];
|
||||
if (!fFullScreen)
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
OnResolutionChanged(iXRes, iYRes);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *)
|
||||
{
|
||||
// safety
|
||||
|
@ -612,38 +591,4 @@ bool CStdGLCtx::PageFlip()
|
|||
return true;
|
||||
}
|
||||
|
||||
#pragma mark CStdGLCtx: Gamma
|
||||
|
||||
bool C4AbstractApp::ApplyGammaRamp(struct _D3DGAMMARAMP &ramp, bool fForce)
|
||||
{
|
||||
CGGammaValue r[256];
|
||||
CGGammaValue g[256];
|
||||
CGGammaValue b[256];
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
r[i] = static_cast<float>(ramp.red[i])/65535.0;
|
||||
g[i] = static_cast<float>(ramp.green[i])/65535.0;
|
||||
b[i] = static_cast<float>(ramp.blue[i])/65535.0;
|
||||
}
|
||||
CGSetDisplayTransferByTable(C4OpenGLView.displayID, 256, r, g, b);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4AbstractApp::SaveDefaultGammaRamp(_D3DGAMMARAMP &ramp)
|
||||
{
|
||||
CGGammaValue r[256];
|
||||
CGGammaValue g[256];
|
||||
CGGammaValue b[256];
|
||||
uint32_t count;
|
||||
CGGetDisplayTransferByTable(C4OpenGLView.displayID, 256, r, g, b, &count);
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
ramp.red[i] = r[i]*65535;
|
||||
ramp.green[i] = g[i]*65535;
|
||||
ramp.blue[i] = b[i]*65535;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -23,7 +23,7 @@
|
|||
#import <C4DrawGL.h>
|
||||
|
||||
#import "C4AppDelegate+MainMenuActions.h"
|
||||
#import "C4OpenGLView.h"
|
||||
#import "C4DrawGLMac.h"
|
||||
#import "C4EditorWindowController.h"
|
||||
|
||||
@implementation C4AppDelegate (MainMenuActions)
|
||||
|
|
|
@ -20,12 +20,15 @@
|
|||
// based on SDL implementation
|
||||
|
||||
#include <GL/glew.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "C4WindowController.h"
|
||||
#include <string>
|
||||
|
||||
#include <C4Include.h>
|
||||
#include <C4Window.h>
|
||||
#include <string>
|
||||
#include <C4Draw.h>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "C4WindowController.h"
|
||||
#import "C4DrawGLMac.h"
|
||||
|
||||
#include "C4App.h"
|
||||
|
||||
|
@ -150,6 +153,58 @@ StdStrBuf C4AbstractApp::GetGameDataPath()
|
|||
return StdCopyStrBuf([[[NSBundle mainBundle] resourcePath] fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigned int iColorDepth, unsigned int iRefreshRate, unsigned int iMonitor, bool fFullScreen)
|
||||
{
|
||||
fFullScreen &= !lionAndBeyond(); // Always false for Lion since then Lion's true(tm) Fullscreen is used
|
||||
C4WindowController* controller = pWindow->objectiveCObject<C4WindowController>();
|
||||
NSWindow* window = controller.window;
|
||||
|
||||
if (iXRes == -1 && iYRes == -1)
|
||||
{
|
||||
iXRes = CGDisplayPixelsWide(C4OpenGLView.displayID);
|
||||
iYRes = CGDisplayPixelsHigh(C4OpenGLView.displayID);
|
||||
}
|
||||
pWindow->SetSize(iXRes, iYRes);
|
||||
[controller setFullscreen:fFullScreen];
|
||||
[window setAspectRatio:[[window contentView] frame].size];
|
||||
[window center];
|
||||
if (!fFullScreen)
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
OnResolutionChanged(iXRes, iYRes);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4AbstractApp::ApplyGammaRamp(struct _D3DGAMMARAMP &ramp, bool fForce)
|
||||
{
|
||||
CGGammaValue r[256];
|
||||
CGGammaValue g[256];
|
||||
CGGammaValue b[256];
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
r[i] = static_cast<float>(ramp.red[i])/65535.0;
|
||||
g[i] = static_cast<float>(ramp.green[i])/65535.0;
|
||||
b[i] = static_cast<float>(ramp.blue[i])/65535.0;
|
||||
}
|
||||
CGSetDisplayTransferByTable(C4OpenGLView.displayID, 256, r, g, b);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4AbstractApp::SaveDefaultGammaRamp(_D3DGAMMARAMP &ramp)
|
||||
{
|
||||
CGGammaValue r[256];
|
||||
CGGammaValue g[256];
|
||||
CGGammaValue b[256];
|
||||
uint32_t count;
|
||||
CGGetDisplayTransferByTable(C4OpenGLView.displayID, 256, r, g, b, &count);
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
ramp.red[i] = r[i]*65535;
|
||||
ramp.green[i] = g[i]*65535;
|
||||
ramp.blue[i] = b[i]*65535;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool IsGermanSystem()
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <C4EditorWindowController.h>
|
||||
#import <C4OpenGLView.h>
|
||||
#import <C4DrawGLMac.h>
|
||||
#import <C4AppDelegate.h>
|
||||
|
||||
#ifdef USE_COCOA
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#import <C4DrawGL.h>
|
||||
|
||||
#import "C4WindowController.h"
|
||||
#import "C4OpenGLView.h"
|
||||
#import "C4DrawGLMac.h"
|
||||
#import "C4EditorWindowController.h"
|
||||
#import "C4AppDelegate.h"
|
||||
#import "AppKit/NSOpenGL.h"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#import <Appkit/AppKit.h>
|
||||
#import <C4WindowController.h>
|
||||
#import <C4OpenGLView.h>
|
||||
#import <C4DrawGLMac.h>
|
||||
|
||||
#ifdef USE_COCOA
|
||||
|
||||
|
|
Loading…
Reference in New Issue