Skip to content

Commit

Permalink
fix macOS compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Feb 5, 2025
1 parent 71736da commit 5382aca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ else ifeq ($(detected_OS),Linux)
else ifeq ($(detected_OS),windows)
$(CC) $(CFLAGS) $(WARNINGS) -I. $< -lgdi32 -o $@$(EXT)
else ifeq ($(detected_OS),Darwin)
$(CC) $(CFLAGS) $(WARNINGS) -I. $< -framework Cocoa -o $@$(EXT)
$(CC) $(CFLAGS) $(WARNINGS) -I. $< -framework IOKit -framework Cocoa -o $@$(EXT)
else
$(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LIBS) $(LINK_GL3) -o $@$(EXT)
endif
Expand All @@ -254,6 +254,7 @@ debug: all
.$(OS_DIR)$$exe$(EXT); \
done

./examples/icons/icons
./examples/silk/silk
./examples/gamepad/gamepad
./examples/first-person-camera/camera
Expand Down
11 changes: 1 addition & 10 deletions RGFW.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ int main() {

#define RGFW_HEADER

#include <stddef.h>
#if !defined(u8)
#ifdef RGFW_USE_INT /* optional for any system that might not have stdint.h */
typedef unsigned char u8;
Expand All @@ -265,7 +266,6 @@ int main() {
typedef signed long long i64;
#else /* use stdint standard types instead of c ""standard"" types */
#include <stdint.h>
#include <stddef.h>

typedef uint8_t u8;
typedef int8_t i8;
Expand Down Expand Up @@ -8157,15 +8157,6 @@ RGFW_window* RGFW_createWindowPtr(const char* name, RGFW_rect rect, RGFW_windowF
}

void RGFW_window_setBorder(RGFW_window* win, RGFW_bool border) {
/* weird hack thing */
RGFW_window winSrc = *win;
{
if (!border && RGFW_window_isMaximized(win)) {
objc_msgSend_void_SEL(win->src.window, sel_registerName("toggleFullScreen:"), NULL);
}
}
*win = winSrc;

NSRect frame = ((NSRect(*)(id, SEL))abi_objc_msgSend_stret)((id)win->src.window, sel_registerName("frame"));
NSRect content = ((NSRect(*)(id, SEL))abi_objc_msgSend_stret)((id)win->src.view, sel_registerName("frame"));
float offset = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RGFW_window* win2;

int main(void) {
RGFW_setClassName("RGFW Basic");
RGFW_window* win = RGFW_createWindow("RGFW Example Window 刺猬", RGFW_RECT(500, 500, 500, 500), RGFW_windowAllowDND | RGFW_windowCenter | RGFW_windowNoBorder);
RGFW_window* win = RGFW_createWindow("RGFW Example Window 刺猬", RGFW_RECT(500, 500, 500, 500), RGFW_windowAllowDND | RGFW_windowCenter);
RGFW_window_makeCurrent(win);

RGFW_window_setIcon(win, icon, RGFW_AREA(3, 3), 4);
Expand Down
7 changes: 5 additions & 2 deletions examples/flags/flags.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "RGFW.h"

int main(void) {
RGFW_window* win = RGFW_createWindow("RGFW icons", RGFW_RECT(0, 0, 600, 400), RGFW_windowAllowDND);
RGFW_window* win = RGFW_createWindow("RGFW flags", RGFW_RECT(0, 0, 600, 400), RGFW_windowAllowDND);

while (RGFW_window_shouldClose(win) == RGFW_FALSE) {
while (RGFW_window_checkEvent(win)) {
Expand All @@ -30,7 +30,7 @@ int main(void) {
printf("Allow Drops: %s\n", RGFW_window_allowsDND(win) ? "true" : "false");
RGFW_window_setDND(win, !RGFW_window_allowsDND(win));
break;
case RGFW_f:
case RGFW_t:
printf("Mouse shown: %s\n", !RGFW_window_mouseHidden(win) ? "true" : "false");
RGFW_window_showMouse(win, RGFW_window_mouseHidden(win));
break;
Expand All @@ -39,6 +39,9 @@ int main(void) {
if (RGFW_window_isMaximized(win)) RGFW_window_restore(win);
else RGFW_window_maximize(win);
break;
case RGFW_f:
RGFW_window_fullscreen(win);
break;
case RGFW_h:
printf("Hidden: %s\n", RGFW_window_isHidden(win) ? "true" : "false");
if (RGFW_window_isHidden(win)) RGFW_window_show(win);
Expand Down
1 change: 1 addition & 0 deletions examples/silk/silk.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "silk.h"

#include <stdint.h>
#include <stddef.h>

typedef int8_t i8;
typedef uint16_t u16;
Expand Down

0 comments on commit 5382aca

Please sign in to comment.