Mac: Fix cocoa backend not compiling on 32 bit

This commit is contained in:
UnknownShadow200 2021-02-08 07:52:33 +11:00
parent 1f1b9f983d
commit 11d21a711a

View File

@ -20,7 +20,7 @@ extern void Window_CommonInit(void);
extern int MapNativeKey(UInt32 key);
static void RefreshWindowBounds(void) {
CGRect win, view;
NSRect win, view;
int viewY;
win = [winHandle frame];
@ -31,9 +31,9 @@ static void RefreshWindowBounds(void) {
/* Then just subtract from screen height to make relative to top instead of bottom of the screen. */
/* Of course this is only half the story, since we're really after Y position of the content. */
/* To work out top Y of view relative to window, it's just win.height - (view.y + view.height) */
viewY = (int)win.size.height - ((int)view.origin.y + (int)view.size.height);
windowX = (int)win.origin.x + (int)view.origin.x;
windowY = DisplayInfo.Height - ((int)win.origin.y + (int)win.size.height) + viewY;
viewY = (int)win.size.height - ((int)view.origin.y + (int)view.size.height);
windowX = (int)win.origin.x + (int)view.origin.x;
windowY = DisplayInfo.Height - ((int)win.origin.y + (int)win.size.height) + viewY;
WindowInfo.Width = (int)view.size.width;
WindowInfo.Height = (int)view.size.height;
@ -102,7 +102,7 @@ static void DoDrawFramebuffer(CGRect dirty);
static void MakeContentView(void) {
CGRect rect;
NSRect rect;
NSView* view;
view = [winHandle contentView];
@ -153,7 +153,7 @@ static void ApplyIcon(void) { }
#define WIN_MASK (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask)
void Window_Create(int width, int height) {
CCWindowDelegate* del;
CGRect rect;
NSRect rect;
/* Technically the coordinates for the origin are at bottom left corner */
/* But since the window is in centre of the screen, don't need to care here */
@ -213,7 +213,7 @@ cc_result Window_ExitFullscreen(void) {
void Window_SetSize(int width, int height) {
/* Can't use setContentSize:, because that resizes from the bottom left corner. */
CGRect rect = [winHandle frame];
NSRect rect = [winHandle frame];
rect.origin.y += WindowInfo.Height - height;
rect.size.width += width - WindowInfo.Width;
@ -257,7 +257,7 @@ static void ProcessKeyChars(id ev) {
}
static cc_bool GetMouseCoords(int* x, int* y) {
CGPoint loc = [NSEvent mouseLocation];
NSPoint loc = [NSEvent mouseLocation];
*x = (int)loc.x - windowX;
*y = (DisplayInfo.Height - (int)loc.y) - windowY;
// TODO: this seems to be off by 1
@ -413,7 +413,7 @@ static void DoDrawFramebuffer(CGRect dirty) {
}
void Window_DrawFramebuffer(Rect2D r) {
CGRect rect;
NSRect rect;
rect.origin.x = r.X;
rect.origin.y = WindowInfo.Height - r.Y - r.Height;
rect.size.width = r.Width;