diff --git a/Info.plist b/Info.plist
index 08c7d01..9290021 100644
--- a/Info.plist
+++ b/Info.plist
@@ -7,7 +7,7 @@
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIconFile
-
+ mappy.icns
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
diff --git a/main.cpp b/main.cpp
index 2bc4aec..d8a510e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -14,6 +14,12 @@
#define MOUSE_BUTTON_MIDDLE 1
#define MOUSE_BUTTON_RIGHT 2
+#ifdef __APPLE__
+#define CTRL SDL_SCANCODE_LGUI
+#else
+#define CTRL SDL_SCANCODE_LCTRL
+#endif
+
struct Mouse {
int x, y;
bool buttons[3];
@@ -397,7 +403,7 @@ void DoTilePal() {
void floodfill_r(const int x, const int y, const int tile) {
const int width_in_tiles = screen_width / tile_width;
const int height_in_tiles = screen_height / tile_height;
- if ( (keyboard[SDL_SCANCODE_LCTRL] ) || ( (x >= map_x && y >= map_y && x < (map_x + width_in_tiles) && y < (map_y + height_in_tiles)) ) ) {
+ if ( (keyboard[CTRL] ) || ( (x >= map_x && y >= map_y && x < (map_x + width_in_tiles) && y < (map_y + height_in_tiles)) ) ) {
if (map[x + y * map_width] == tile) {
map[x + y * map_width] = tile_sel;
floodfill_r(x + 1, y, tile);
@@ -419,7 +425,7 @@ void ReplaceTile() {
const int x = map_x + (mouse.x / tile_width);
const int y = map_y + (mouse.y / tile_height);
const int tile = map[x + y * map_width];
- const bool all_map = keyboard[SDL_SCANCODE_LCTRL];
+ const bool all_map = keyboard[CTRL];
const int xi = all_map ? 0 : map_x;
const int yi = all_map ? 0 : map_y;
const int w = all_map ? map_width : xi+(screen_width / tile_width);
@@ -468,9 +474,9 @@ void DoTileMap() {
if (mouse.buttons[MOUSE_BUTTON_LEFT]) { map[(map_x + cur_x) + (map_y + cur_y)*map_width] = tile_sel; }
if (mouse.buttons[MOUSE_BUTTON_MIDDLE]) { tile_sel = map[(map_x + cur_x) + (map_y + cur_y)*map_width]; }
- if (keyJustPressed == SDL_SCANCODE_Z && keyboard[SDL_SCANCODE_LCTRL]) { Undo_Undo(); }
- if (keyJustPressed == SDL_SCANCODE_Y && keyboard[SDL_SCANCODE_LCTRL]) { Undo_Redo(); }
- if (keyJustPressed == SDL_SCANCODE_Z && keyboard[SDL_SCANCODE_LCTRL] && keyboard[SDL_SCANCODE_LSHIFT]) { Undo_Redo(); }
+ if (keyJustPressed == SDL_SCANCODE_Z && keyboard[CTRL]) { Undo_Undo(); }
+ if (keyJustPressed == SDL_SCANCODE_Y && keyboard[CTRL]) { Undo_Redo(); }
+ if (keyJustPressed == SDL_SCANCODE_Z && keyboard[CTRL] && keyboard[SDL_SCANCODE_LSHIFT]) { Undo_Redo(); }
}
else {
if (keyJustPressed == SDL_SCANCODE_TAB) { menu = false; return; }
@@ -557,7 +563,7 @@ void DoMiniMap() {
ignoreMouse = true;
}
if (keyJustPressed == SDL_SCANCODE_E) state = STATE_TILEMAP;
- if (keyboard[SDL_SCANCODE_LCTRL]) {
+ if (keyboard[CTRL]) {
if (keyJustPressed == SDL_SCANCODE_A) ShiftMap(1, 0);
if (keyJustPressed == SDL_SCANCODE_D) ShiftMap(-1, 0);
if (keyJustPressed == SDL_SCANCODE_W) ShiftMap(0, 1);
diff --git a/mappy.icns b/mappy.icns
new file mode 100644
index 0000000..fb9bf46
Binary files /dev/null and b/mappy.icns differ
diff --git a/mappy.xcodeproj/project.pbxproj b/mappy.xcodeproj/project.pbxproj
index b1db118..9d19e7e 100644
--- a/mappy.xcodeproj/project.pbxproj
+++ b/mappy.xcodeproj/project.pbxproj
@@ -11,6 +11,7 @@
02B01D591C767C1700CD186D /* SDL2_image.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02B01D581C767C1700CD186D /* SDL2_image.framework */; };
02B01D5B1C767C2C00CD186D /* SDL2_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02B01D5A1C767C2C00CD186D /* SDL2_mixer.framework */; };
02EA2BEF1C764B3800E5A247 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02EA2BEE1C764B3800E5A247 /* SDL2.framework */; };
+ 02F256EB1CF374B90005FAE2 /* mappy.icns in Resources */ = {isa = PBXBuildFile; fileRef = 02F256EA1CF374B90005FAE2 /* mappy.icns */; };
02F8248B1C772310007AAE83 /* gif.c in Sources */ = {isa = PBXBuildFile; fileRef = 02F8248A1C772310007AAE83 /* gif.c */; };
/* End PBXBuildFile section */
@@ -23,6 +24,7 @@
02EA2BEE1C764B3800E5A247 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = ../../../../../Library/Frameworks/SDL2.framework; sourceTree = ""; };
02F23A4E1CEE2D460005FAE2 /* font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = font.h; sourceTree = ""; };
02F23A4F1CEE2D460005FAE2 /* stb_image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stb_image.h; sourceTree = ""; };
+ 02F256EA1CF374B90005FAE2 /* mappy.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = mappy.icns; sourceTree = ""; };
02F8248A1C772310007AAE83 /* gif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gif.c; sourceTree = ""; };
/* End PBXFileReference section */
@@ -43,6 +45,7 @@
02CF35B01C7649C300180C9F = {
isa = PBXGroup;
children = (
+ 02F256EA1CF374B90005FAE2 /* mappy.icns */,
02F23A4E1CEE2D460005FAE2 /* font.h */,
02F23A4F1CEE2D460005FAE2 /* stb_image.h */,
02F8248A1C772310007AAE83 /* gif.c */,
@@ -120,6 +123,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 02F256EB1CF374B90005FAE2 /* mappy.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};