mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 20:15:35 -04:00
Mac: Make cocoa backend compile on macOS 10.3
This commit is contained in:
parent
40fbd0cf05
commit
0a4f26c296
@ -244,12 +244,12 @@ static void RefreshWindowBounds(void) {
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
static void DoDrawFramebuffer(CGRect dirty);
|
static void DoDrawFramebuffer(NSRect dirty);
|
||||||
@interface CCView : NSView { }
|
@interface CCView : NSView { }
|
||||||
@end
|
@end
|
||||||
@implementation CCView
|
@implementation CCView
|
||||||
|
|
||||||
- (void)drawRect:(CGRect)dirty { DoDrawFramebuffer(dirty); }
|
- (void)drawRect:(NSRect)dirty { DoDrawFramebuffer(dirty); }
|
||||||
|
|
||||||
- (void)viewDidEndLiveResize {
|
- (void)viewDidEndLiveResize {
|
||||||
// When the user users left mouse to drag reisze window, this enters 'live resize' mode
|
// When the user users left mouse to drag reisze window, this enters 'live resize' mode
|
||||||
@ -443,6 +443,7 @@ static int TryGetKey(NSEvent* ev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void DebugScrollEvent(NSEvent* ev) {
|
static void DebugScrollEvent(NSEvent* ev) {
|
||||||
|
#ifdef kCGScrollWheelEventDeltaAxis1
|
||||||
float dy = [ev deltaY];
|
float dy = [ev deltaY];
|
||||||
int steps = dy > 0.0f ? Math_Ceil(dy) : Math_Floor(dy);
|
int steps = dy > 0.0f ? Math_Ceil(dy) : Math_Floor(dy);
|
||||||
|
|
||||||
@ -451,12 +452,13 @@ static void DebugScrollEvent(NSEvent* ev) {
|
|||||||
int raw = CGEventGetIntegerValueField(ref, kCGScrollWheelEventDeltaAxis1);
|
int raw = CGEventGetIntegerValueField(ref, kCGScrollWheelEventDeltaAxis1);
|
||||||
|
|
||||||
Platform_Log3("SCROLL: %i.0 = (%i, %f3)", &steps, &raw, &dy);
|
Platform_Log3("SCROLL: %i.0 = (%i, %f3)", &steps, &raw, &dy);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_ProcessEvents(double delta) {
|
void Window_ProcessEvents(double delta) {
|
||||||
NSEvent* ev;
|
NSEvent* ev;
|
||||||
int key, type, steps, x, y;
|
int key, type, steps, x, y;
|
||||||
CGFloat dx, dy;
|
float dx, dy;
|
||||||
|
|
||||||
// https://wiki.freepascal.org/Cocoa_Internals/Application
|
// https://wiki.freepascal.org/Cocoa_Internals/Application
|
||||||
[pool release];
|
[pool release];
|
||||||
@ -560,7 +562,9 @@ void ShowDialogCore(const char* title, const char* msg) {
|
|||||||
|
|
||||||
static NSMutableArray* GetOpenSaveFilters(const char* const* filters) {
|
static NSMutableArray* GetOpenSaveFilters(const char* const* filters) {
|
||||||
NSMutableArray* types = [NSMutableArray array];
|
NSMutableArray* types = [NSMutableArray array];
|
||||||
for (int i = 0; filters[i]; i++)
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; filters[i]; i++)
|
||||||
{
|
{
|
||||||
NSString* filter = [NSString stringWithUTF8String:filters[i]];
|
NSString* filter = [NSString stringWithUTF8String:filters[i]];
|
||||||
filter = [filter substringFromIndex:1];
|
filter = [filter substringFromIndex:1];
|
||||||
@ -630,7 +634,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
|
|||||||
fb_bmp = *bmp;
|
fb_bmp = *bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DoDrawFramebuffer(CGRect dirty) {
|
static void DoDrawFramebuffer(NSRect dirty) {
|
||||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||||
CGContextRef context = NULL;
|
CGContextRef context = NULL;
|
||||||
CGDataProviderRef provider;
|
CGDataProviderRef provider;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user