Generate a 64 bit mac icon file and fixup Window.m

64 mac build doesn't show icon quite yet, still WIP
This commit is contained in:
UnknownShadow200 2020-06-11 23:38:33 +10:00
parent 18fce97418
commit 3ea64a61d0
5 changed files with 62 additions and 59 deletions

BIN
misc/CCicon_mac64 Normal file

Binary file not shown.

View File

@ -14,6 +14,7 @@ static NSApplication* appHandle;
static NSWindow* winHandle; static NSWindow* winHandle;
static int windowX, windowY; static int windowX, windowY;
struct GraphicsMode { int R, G, B, A, IsIndexed; };
extern void Window_CommonInit(void); extern void Window_CommonInit(void);
extern int Window_MapKey(UInt32 key); extern int Window_MapKey(UInt32 key);
@ -21,6 +22,7 @@ extern int Window_MapKey(UInt32 key);
@end @end
@implementation ClassiCubeWindowDelegate @implementation ClassiCubeWindowDelegate
static void Window_RefreshBounds(void);
- (void)windowDidResize:(NSNotification *)notification - (void)windowDidResize:(NSNotification *)notification
{ {
@ -36,13 +38,13 @@ extern int Window_MapKey(UInt32 key);
- (void)windowDidBecomeKey:(NSNotification *)notification - (void)windowDidBecomeKey:(NSNotification *)notification
{ {
Window_Focused = true; WindowInfo.Focused = true;
Event_RaiseVoid(&WindowEvents.FocusChanged); Event_RaiseVoid(&WindowEvents.FocusChanged);
} }
- (void)windowDidResignKey:(NSNotification *)notification - (void)windowDidResignKey:(NSNotification *)notification
{ {
Window_Focused = false; WindowInfo.Focused = false;
Event_RaiseVoid(&WindowEvents.FocusChanged); Event_RaiseVoid(&WindowEvents.FocusChanged);
} }
@ -73,8 +75,8 @@ static void Window_RefreshBounds(void) {
windowX = (int)rect.origin.x; windowX = (int)rect.origin.x;
windowY = (int)rect.origin.y; windowY = (int)rect.origin.y;
Window_Width = (int)rect.size.width; WindowInfo.Width = (int)rect.size.width;
Window_Height = (int)rect.size.height; WindowInfo.Height = (int)rect.size.height;
Platform_Log2("WINPOS: %i, %i", &windowX, &windowY); Platform_Log2("WINPOS: %i, %i", &windowX, &windowY);
} }
@ -94,15 +96,15 @@ void Window_Init1(void) {
Window_CommonInit(); Window_CommonInit();
} }
#define Display_CentreX(width) (Display_Bounds.X + (Display_Bounds.Width - width) / 2) #define Display_CentreX(width) (DisplayInfo.X + (DisplayInfo.Width - width) / 2)
#define Display_CentreY(height) (Display_Bounds.Y + (Display_Bounds.Height - height) / 2) #define Display_CentreY(height) (DisplayInfo.Y + (DisplayInfo.Height - height) / 2)
void Window_Create1(int width, int height) { void Window_Create1(int width, int height) {
NSRect rect; NSRect rect;
// TODO: don't set, RefreshBounds // TODO: don't set, RefreshBounds
Window_Width = width; WindowInfo.Width = width;
Window_Height = height; WindowInfo.Height = height;
Window_Exists = true; WindowInfo.Exists = true;
rect.origin.x = Display_CentreX(width); rect.origin.x = Display_CentreX(width);
rect.origin.y = Display_CentreY(height); rect.origin.y = Display_CentreY(height);
@ -172,7 +174,7 @@ void Window_ProcessEvents1(void) {
break; break;
case NSScrollWheel: case NSScrollWheel:
Mouse_SetWheel(Mouse_Wheel + [ev deltaY]); Mouse_ScrollWheel([ev deltaY]);
break; break;
case NSMouseMoved: case NSMouseMoved:
@ -186,10 +188,10 @@ void Window_ProcessEvents1(void) {
mouseX = (int)loc.x - windowX; mouseX = (int)loc.x - windowX;
mouseY = (int)loc.y - windowY; mouseY = (int)loc.y - windowY;
/* need to flip Y coordinates because cocoa has window origin at bottom left */ /* need to flip Y coordinates because cocoa has window origin at bottom left */
mouseY = Window_Height - mouseY; mouseY = WindowInfo.Height - mouseY;
Pointer_SetPosition(0, mouseX, mouseY); Pointer_SetPosition(0, mouseX, mouseY);
if (Input_RawMode) Event_RaiseMove(&PointerEvents.RawMoved, 0, dx, dy); if (Input_RawMode) Event_RaiseRawMove(&PointerEvents.RawMoved, dx, dy);
break; break;
} }

View File

@ -77,8 +77,9 @@ build_mac32() {
build_mac64() { build_mac64() {
echo "Building mac64.." echo "Building mac64.."
cp $SOURCE_DIR/misc/CCicon_mac64 $SOURCE_DIR/src/CCicon_mac64.o
rm cc-osx64 rm cc-osx64
$MAC64_CC *.c $ALL_FLAGS $MACOS_FLAGS -DCC_COMMIT_SHA=\"$LATEST\" -o cc-osx64 -framework Cocoa -framework OpenGL -lobjc $MAC64_CC *.c $ALL_FLAGS $MACOS_FLAGS CCicon_mac64.o -DCC_COMMIT_SHA=\"$LATEST\" -o cc-osx64 -framework Cocoa -framework OpenGL -lobjc
} }
build_web() { build_web() {

View File

@ -5,8 +5,8 @@ using System.IO;
namespace test { namespace test {
public static class Program { public static class Program {
const string src = @"H:\PortableApps\GitPortable\App\Git\ClassicalSharp\misc\CCIcon.ico"; const string src = "CCIcon.ico";
const string dst = @"H:\PortableApps\GitPortable\App\Git\ClassicalSharp\misc\CCIcon.c"; const string dst = "CCIcon.c";
static void DumpIcon(StreamWriter sw, int width, int height) { static void DumpIcon(StreamWriter sw, int width, int height) {
using (Icon icon = new Icon(src, width, height)) { using (Icon icon = new Icon(src, width, height)) {

View File

@ -69,11 +69,11 @@ Although the regular linux compiliation flags will work fine, to take full advan
#### macOS (32 bit) #### macOS (32 bit)
```gcc *.c -o ClassiCube -framework Carbon -framework AGL -framework OpenGL``` ```cc *.c -o ClassiCube -framework Carbon -framework AGL -framework OpenGL```
#### macOS (64 bit) #### macOS (64 bit)
```gcc *.c -o ClassiCube -framework Cocoa -framework OpenGL -lobjc``` ```cc *.c -o ClassiCube -framework Cocoa -framework OpenGL -lobjc```
#### FreeBSD #### FreeBSD