From 4a482b23859ad1aba68e475ef23288fb4f1d490d Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Sun, 22 Apr 2012 09:17:14 +0200 Subject: [PATCH 1/3] Fixed TextEntered event on Mac OS X (Close #192) --- src/SFML/Window/OSX/SFOpenGLView.mm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/SFML/Window/OSX/SFOpenGLView.mm b/src/SFML/Window/OSX/SFOpenGLView.mm index d9daad1a6..e685bf39e 100644 --- a/src/SFML/Window/OSX/SFOpenGLView.mm +++ b/src/SFML/Window/OSX/SFOpenGLView.mm @@ -562,7 +562,25 @@ NSUInteger keepOnlyMaskFromData(NSUInteger data, NSUInteger mask); // Ignore escape key and non text keycode. (See NSEvent.h) // They produce a sound alert. unichar code = [[ev characters] characterAtIndex:0]; - if ([ev keyCode] != 0x35 && (code < 0xF700 || code > 0xF8FF)) { + unsigned short keycode = [ev keyCode]; + + // Backspace and Delete unicode values are badly handled by Apple. + // We do a small workaround here : + + // Backspace + if (keycode == 0x33) { + // Send the correct unicode value (i.e. 8) instead of 127 (which is 'delete') + m_requester->textEntered(8); + } + + // Delete + else if (keycode == 0x75 || keycode == NSDeleteFunctionKey) { + // Instead of the value 63272 we send 127. + m_requester->textEntered(127); + } + + // All other unicode values + else if (keycode != 0x35 && (code < 0xF700 || code > 0xF8FF)) { // Let's see if its a valid text. NSText* text = [[self window] fieldEditor:YES forObject:self]; From 51680ac49c1308ea5e342fe8d02215f839bea947 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Sun, 8 Jul 2012 18:15:24 +0200 Subject: [PATCH 2/3] Substituted tabulations with spaces and fixed an issue similar to #233 --- .../TemplateInfo.plist | 1246 +++++++++-------- .../TemplateInfo.plist | 1152 +++++++-------- 2 files changed, 1205 insertions(+), 1193 deletions(-) diff --git a/tools/xcode/templates/SFML/SFML Application Base.xctemplate/TemplateInfo.plist b/tools/xcode/templates/SFML/SFML Application Base.xctemplate/TemplateInfo.plist index 105b1b84c..79406963c 100644 --- a/tools/xcode/templates/SFML/SFML Application Base.xctemplate/TemplateInfo.plist +++ b/tools/xcode/templates/SFML/SFML Application Base.xctemplate/TemplateInfo.plist @@ -25,79 +25,79 @@ subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. --> - Kind - Xcode.Xcode3.ProjectTemplateUnitKind - Identifier - org.sfml-dev.AppBase - - Ancestors - - com.apple.dt.unit.macBase - - + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + Identifier + org.sfml-dev.AppBase + + Ancestors + + com.apple.dt.unit.macBase + + - Options - - + Options + + - Identifier - useFrameworks - Name - Use frameworks - Description - Indicates whether frameworks should be used instead of dylibs or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_LINK_PREFIX - $(SFML_LINK_FRAMEWORKS_PREFIX) - - SFML_LINK_SUFFIX - $(SFML_LINK_FRAMEWORKS_SUFFIX) - - HEADER_SEARCH_PATHS - $(HEADER_SEARCH_PATHS) - - - - - false - - - Project - - SharedSettings - - SFML_LINK_PREFIX - $(SFML_LINK_DYLIBS_PREFIX) - - SFML_LINK_SUFFIX - $(SFML_LINK_DYLIBS_SUFFIX) - - HEADER_SEARCH_PATHS - $(HEADER_SEARCH_PATHS) /usr/local/include/ - - - - - + Identifier + useFrameworks + Name + Use frameworks + Description + Indicates whether frameworks should be used instead of dylibs or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_LINK_PREFIX + $(SFML_LINK_FRAMEWORKS_PREFIX) + + SFML_LINK_SUFFIX + $(SFML_LINK_FRAMEWORKS_SUFFIX) + + HEADER_SEARCH_PATHS + $(HEADER_SEARCH_PATHS) + + + + + false + + + Project + + SharedSettings + + SFML_LINK_PREFIX + $(SFML_LINK_DYLIBS_PREFIX) + + SFML_LINK_SUFFIX + $(SFML_LINK_DYLIBS_SUFFIX) + + HEADER_SEARCH_PATHS + $(HEADER_SEARCH_PATHS) /usr/local/include/ + + + + + @@ -115,603 +115,609 @@ subject to the following restrictions: Default false RequiredOptions - - useFrameworks - false - + + useFrameworks + false + Units true - - - Project - - SharedSettings - - SFML_LINK_DYLIBS_SUFFIX_DEBUG - -d - - - + + + Project + + SharedSettings + + SFML_LINK_DYLIBS_SUFFIX_DEBUG + -d + + + false - - - Project - - SharedSettings - - SFML_LINK_DYLIBS_SUFFIX_DEBUG - - - - + + + Project + + SharedSettings + + SFML_LINK_DYLIBS_SUFFIX_DEBUG + + + + - - - - - Identifier - windowModule - Name - Use window module - Description - Indicates whether window module should be used or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_WINDOW - $(SFML_LINK_PREFIX)sfml-window$(SFML_LINK_SUFFIX) - - - - - Definitions - - main.cpp:window:include - #include <SFML/Window.hpp> - - main.cpp:main:window:content - sf::Window window(sf::VideoMode(800, 600), "SFML window"); - - - main.cpp:system:include - - - main.cpp:main:audio_loop - - - - - false - - - Project - - SharedSettings - - SFML_WINDOW - - - - - - Definitions - - main.cpp:window:include - - - main.cpp:main:window:content - - - - main.cpp:main:event_loop - - - main.cpp:main:display - - - - - - - - - - Identifier - graphicsModule - RequiredOptions - - windowModule - true - - Name - Use graphics module - Description - Indicates whether graphics module should be used or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_GRAPHICS - $(SFML_LINK_PREFIX)sfml-graphics$(SFML_LINK_SUFFIX) - - - - - Definitions - - main.cpp:graphics:include - #include <SFML/Graphics.hpp> - - main.cpp:main:graphics_init_window - // Create the main window + + + + + Identifier + windowModule + Name + Use window module + Description + Indicates whether window module should be used or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_WINDOW + $(SFML_LINK_PREFIX)sfml-window$(SFML_LINK_SUFFIX) + + + + + Definitions + + main.cpp:window:include + #include <SFML/Window.hpp> + + main.cpp:main:window:content + sf::Window window(sf::VideoMode(800, 600), "SFML window"); + + + main.cpp:system:include + + + main.cpp:main:audio_loop + + + + + false + + + Project + + SharedSettings + + SFML_WINDOW + + + + + + Definitions + + main.cpp:window:include + + + main.cpp:main:window:content + + + + main.cpp:main:event_loop + + + main.cpp:main:display + + + + + + + + + + Identifier + graphicsModule + RequiredOptions + + windowModule + true + + Name + Use graphics module + Description + Indicates whether graphics module should be used or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_GRAPHICS + $(SFML_LINK_PREFIX)sfml-graphics$(SFML_LINK_SUFFIX) + + + + + Definitions + + main.cpp:graphics:include + #include <SFML/Graphics.hpp> + + main.cpp:main:graphics_init_window + // Create the main window sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); - - main.cpp:main:image_init - + + main.cpp:main:image_init + // Load a sprite to display sf::Texture texture; - main.cpp:main:image_finalize - return EXIT_FAILURE; + main.cpp:main:image_finalize + return EXIT_FAILURE; sf::Sprite sprite(texture); - main.cpp:main:image_load - if (!texture.loadFromFile(resourcePath() + "cute_image.jpg")) - - main.cpp:main:text_init - + main.cpp:main:image_load + if (!texture.loadFromFile(resourcePath() + "cute_image.jpg")) + + main.cpp:main:text_init + // Create a graphical text to display sf::Font font; - main.cpp:main:text_finalize - return EXIT_FAILURE; + main.cpp:main:text_finalize + return EXIT_FAILURE; sf::Text text("Hello SFML", font, 50); text.setColor(sf::Color::Black); - - main.cpp:main:text_load - if (!font.loadFromFile(resourcePath() + "sansation.ttf")) - - main.cpp:main:graphics_display - - // Clear screen - window.clear(); - - // Draw the sprite - window.draw(sprite); - - // Draw the string - window.draw(text); + + main.cpp:main:text_load + if (!font.loadFromFile(resourcePath() + "sansation.ttf")) + + main.cpp:main:graphics_display + + // Clear screen + window.clear(); + + // Draw the sprite + window.draw(sprite); + + // Draw the string + window.draw(text); - - - main.cpp:window:include - - - main.cpp:main:window:content - - - sansation.ttf - - Group - Resources - Path - sansation.ttf - - - cute_image.jpg - - Group - Resources - Path - cute_image.jpg - - - - - Nodes - - sansation.ttf - cute_image.jpg - - - - false - - - Project - - SharedSettings - - SFML_GRAPHICS - - - - - - Definitions - - main.cpp:graphics:include - - - main.cpp:main:graphics_init - - - main.cpp:main:graphics_display - - - main.cpp:main:image_load - - - - - - - - - Identifier - audioModule - Name - Use audio module - Description - Indicates whether audio module should be used or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_AUDIO - $(SFML_LINK_PREFIX)sfml-audio$(SFML_LINK_SUFFIX) - - - - - Definitions - - main.cpp:audio:include - #include <SFML/Audio.hpp> - - main.cpp:main:audio:content - + + + main.cpp:window:include + + + main.cpp:main:window:content + + + sansation.ttf + + Group + Resources + Path + sansation.ttf + + + cute_image.jpg + + Group + Resources + Path + cute_image.jpg + + + + + Nodes + + sansation.ttf + cute_image.jpg + + + + false + + + Project + + SharedSettings + + SFML_GRAPHICS + + + + + + Definitions + + main.cpp:graphics:include + + + main.cpp:main:graphics_init + + + main.cpp:main:graphics_display + + + main.cpp:main:image_load + + + + + + + + + Identifier + audioModule + Name + Use audio module + Description + Indicates whether audio module should be used or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_AUDIO + $(SFML_LINK_PREFIX)sfml-audio$(SFML_LINK_SUFFIX) + + + + + Definitions + + main.cpp:audio:include + #include <SFML/Audio.hpp> + + main.cpp:main:audio:content + // Load a music to play sf::Music music; if (!music.openFromFile(resourcePath() + "nice_music.ogg")) - return EXIT_FAILURE; + return EXIT_FAILURE; // Play the music music.play(); - nice_music.ogg - - Group - Resources - Path - nice_music.ogg - - - - - Nodes - - nice_music.ogg - - - - false - - - Project - - SharedSettings - - SFML_AUDIO - - - - - - Definitions - - main.cpp:audio:include - - - main.cpp:main:audio:content - - - main.cpp:main:audio_loop - - - - - - - - - Identifier - networkModule - Name - Use network module - Description - Indicates whether network module should be used or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_NETWORK - $(SFML_LINK_PREFIX)sfml-network$(SFML_LINK_SUFFIX) - - - - - Definitions - - main.cpp:network:include - #include <SFML/Network.hpp> - - - - - - false - - - Project - - SharedSettings - - SFML_NETWORK - - - - - - Definitions - - main.cpp:network:include - - - - - - - - + nice_music.ogg + + Group + Resources + Path + nice_music.ogg + + + + + Nodes + + nice_music.ogg + + + + false + + + Project + + SharedSettings + + SFML_AUDIO + + + + + + Definitions + + main.cpp:audio:include + + + main.cpp:main:audio:content + + + main.cpp:main:audio_loop + + + + + + + + + Identifier + networkModule + Name + Use network module + Description + Indicates whether network module should be used or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_NETWORK + $(SFML_LINK_PREFIX)sfml-network$(SFML_LINK_SUFFIX) + + + + + Definitions + + main.cpp:network:include + #include <SFML/Network.hpp> + + + + + + false + + + Project + + SharedSettings + + SFML_NETWORK + + + + + + Definitions + + main.cpp:network:include + + + + + + + + - + - Nodes - - main.cpp:system:include - main.cpp:window:include - main.cpp:graphics:include - main.cpp:audio:include - main.cpp:network:include - main.cpp:resources:include - main.cpp:main:window:content - main.cpp:main:graphics_init_window - main.cpp:main:image_init - main.cpp:main:image_load - main.cpp:main:image_finalize - main.cpp:main:text_init - main.cpp:main:text_load - main.cpp:main:text_finalize - main.cpp:main:audio:content - main.cpp:main:audio_loop - main.cpp:main:event_loop - main.cpp:main:graphics_display - main.cpp:main:display - ResourcePath.mm - ResourcePath.hpp - - - + Nodes + + main.cpp:system:include + main.cpp:window:include + main.cpp:graphics:include + main.cpp:audio:include + main.cpp:network:include + main.cpp:resources:include + main.cpp:main:window:content + main.cpp:main:graphics_init_window + main.cpp:main:image_init + main.cpp:main:image_load + main.cpp:main:image_finalize + main.cpp:main:text_init + main.cpp:main:text_load + main.cpp:main:text_finalize + main.cpp:main:audio:content + main.cpp:main:audio_loop + main.cpp:main:event_loop + main.cpp:main:graphics_display + main.cpp:main:display + ResourcePath.mm + ResourcePath.hpp + + + - Definitions - - - *:main - - Beginning - + Definitions + + + *:main + + Beginning + int main (int argc, const char * argv[]) { - End - - return EXIT_SUCCESS; + End + + return EXIT_SUCCESS; } - Indent - 1 - - - ResourcePath.mm - - Path - ResourcePath.mm - - - ResourcePath.hpp - - Path - ResourcePath.hpp - TargetIndices - - + Indent + 1 + + + ResourcePath.mm + + Path + ResourcePath.mm + + + ResourcePath.hpp + + Path + ResourcePath.hpp + TargetIndices + + - main.cpp:system:include - #include <SFML/System.hpp> - - main.cpp:main:event_loop - + main.cpp:system:include + #include <SFML/System.hpp> + + main.cpp:main:event_loop + // Start the game loop while (window.isOpen()) { - // Process events - sf::Event event; - while (window.pollEvent(event)) - { - // Close window : exit - if (event.type == sf::Event::Closed) - window.close(); + // Process events + sf::Event event; + while (window.pollEvent(event)) + { + // Close window : exit + if (event.type == sf::Event::Closed) + window.close(); - // Escape pressed : exit - if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) - window.close(); - } + // Escape pressed : exit + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) + window.close(); + } - - main.cpp:main:display - - // Update the window - window.display(); + + main.cpp:main:display + + // Update the window + window.display(); } - - main.cpp:resources:include - #include "ResourcePath.hpp" - - main.cpp:main:audio_loop - while (music.getStatus() == sf::Music::Playing) { - sf::Sleep(100); + + main.cpp:resources:include + #include "ResourcePath.hpp" + + main.cpp:main:audio_loop + while (music.getStatus() == sf::Music::Playing) { + sf::Sleep(100); } - - + + - Project - - - Name - ___PACKAGENAME___ - - - SharedSettings - - PRODUCT_NAME - $(TARGET_NAME) - - SFML_LINK_DYLIBS_PREFIX - -l - - SFML_LINK_FRAMEWORKS_PREFIX - -framework - - SFML_SYSTEM - $(SFML_LINK_PREFIX)sfml-system$(SFML_LINK_SUFFIX) - - SFML_LINK_FRAMEWORKS_SUFFIX - - - CLANG_ENABLE_OBJC_ARC - - - GCC_ENABLE_OBJC_GC - unsupported + Project + + + Name + ___PACKAGENAME___ + + + SharedSettings + + PRODUCT_NAME + $(TARGET_NAME) + + SFML_LINK_DYLIBS_PREFIX + -l + + SFML_LINK_FRAMEWORKS_PREFIX + -framework + + SFML_SYSTEM + $(SFML_LINK_PREFIX)sfml-system$(SFML_LINK_SUFFIX) + + SFML_LINK_FRAMEWORKS_SUFFIX + + + CLANG_ENABLE_OBJC_ARC + + + GCC_ENABLE_OBJC_GC + unsupported FRAMEWORK_SEARCH_PATHS $(FRAMEWORK_SEARCH_PATHS) /Library/Frameworks/** - - - Configurations - - - Debug - - SFML_LINK_DYLIBS_SUFFIX - $(SFML_LINK_DYLIBS_SUFFIX_DEBUG) - - OTHER_LDFLAGS - $(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) - - - - - Release - - SFML_LINK_DYLIBS_SUFFIX - - - OTHER_LDFLAGS - $(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) - - - - - Targets - - - Frameworks - - Foundation - - - BuildPhases - - - Class - ShellScript - - ShellPath - /bin/sh - - ShellScript - # This shell script simply copies required sfml dylibs/frameworks into the application bundle frameworks folder. + + HEADER_SEARCH_PATHS + $(HEADER_SEARCH_PATHS) /usr/local/include/** + + LIBRARY_SEARCH_PATHS + $(LIBRARY_SEARCH_PATHS) /usr/local/lib/** + + + Configurations + + + Debug + + SFML_LINK_DYLIBS_SUFFIX + $(SFML_LINK_DYLIBS_SUFFIX_DEBUG) + + OTHER_LDFLAGS + $(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) + + + + + Release + + SFML_LINK_DYLIBS_SUFFIX + + + OTHER_LDFLAGS + $(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) + + + + + Targets + + + Frameworks + + Foundation + + + BuildPhases + + + Class + ShellScript + + ShellPath + /bin/sh + + ShellScript + # This shell script simply copies required sfml dylibs/frameworks into the application bundle frameworks folder. # If you're using static libraries (which is not recommended) you should remove this script from your project. # Are we building a project that uses framework or dylibs ? @@ -779,13 +785,13 @@ if [ -n "$SFML_GRAPHICS" ] then require "graphics" fi - - - RunOnlyForDeploymentPostprocessing - NO - - - - + + + RunOnlyForDeploymentPostprocessing + NO + + + + diff --git a/tools/xcode/templates/SFML/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist b/tools/xcode/templates/SFML/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist index dc7d2246f..0e0a402de 100644 --- a/tools/xcode/templates/SFML/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist +++ b/tools/xcode/templates/SFML/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist @@ -25,79 +25,79 @@ subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. --> - Kind - Xcode.Xcode3.ProjectTemplateUnitKind - Identifier - org.sfml-dev.commandLineToolBase - - Ancestors - - com.apple.dt.unit.macBase - - + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + Identifier + org.sfml-dev.commandLineToolBase + + Ancestors + + com.apple.dt.unit.macBase + + - Options - - - - Identifier - useFrameworks - Name - Use frameworks - Description - Indicates whether frameworks should be used instead of dylibs or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_LINK_PREFIX - $(SFML_LINK_FRAMEWORKS_PREFIX) - - SFML_LINK_SUFFIX - $(SFML_LINK_FRAMEWORKS_SUFFIX) - - HEADER_SEARCH_PATHS - $(HEADER_SEARCH_PATHS) - - - - - false - - - Project - - SharedSettings - - SFML_LINK_PREFIX - $(SFML_LINK_DYLIBS_PREFIX) - - SFML_LINK_SUFFIX - $(SFML_LINK_DYLIBS_SUFFIX) - - HEADER_SEARCH_PATHS - $(HEADER_SEARCH_PATHS) /usr/local/include/ - - - - - + Options + + + + Identifier + useFrameworks + Name + Use frameworks + Description + Indicates whether frameworks should be used instead of dylibs or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_LINK_PREFIX + $(SFML_LINK_FRAMEWORKS_PREFIX) + + SFML_LINK_SUFFIX + $(SFML_LINK_FRAMEWORKS_SUFFIX) + + HEADER_SEARCH_PATHS + $(HEADER_SEARCH_PATHS) + + + + + false + + + Project + + SharedSettings + + SFML_LINK_PREFIX + $(SFML_LINK_DYLIBS_PREFIX) + + SFML_LINK_SUFFIX + $(SFML_LINK_DYLIBS_SUFFIX) + + HEADER_SEARCH_PATHS + $(HEADER_SEARCH_PATHS) /usr/local/include/ + + + + + @@ -115,500 +115,500 @@ subject to the following restrictions: Default false RequiredOptions - - useFrameworks - false - + + useFrameworks + false + Units true - - - Project - - SharedSettings - - SFML_LINK_DYLIBS_SUFFIX_DEBUG - -d - - - + + + Project + + SharedSettings + + SFML_LINK_DYLIBS_SUFFIX_DEBUG + -d + + + false - - - Project - - SharedSettings - - SFML_LINK_DYLIBS_SUFFIX_DEBUG - - - - + + + Project + + SharedSettings + + SFML_LINK_DYLIBS_SUFFIX_DEBUG + + + + - - - - Identifier - windowModule - Name - Use window module - Description - Indicates whether window module should be used or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_WINDOW - $(SFML_LINK_PREFIX)sfml-window$(SFML_LINK_SUFFIX) - - - - - Definitions - - main.cpp:window:include - #include <SFML/Window.hpp> - - main.cpp:main:window:content - sf::Window window(sf::VideoMode(800, 600), "SFML window"); - - - main.cpp:system:include - - - main.cpp:main:audio_loop - - - - - false - - - Project - - SharedSettings - - SFML_WINDOW - - - - - - Definitions - - main.cpp:window:include - - - main.cpp:main:window:content - - - - main.cpp:main:event_loop - - - main.cpp:main:display - - - - - - - - - - Identifier - graphicsModule - RequiredOptions - - windowModule - true - - Name - Use graphics module - Description - Indicates whether graphics module should be used or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_GRAPHICS - $(SFML_LINK_PREFIX)sfml-graphics$(SFML_LINK_SUFFIX) - - - - - Definitions - - main.cpp:graphics:include - #include <SFML/Graphics.hpp> - - main.cpp:main:graphics_init_window - // Create the main window + + + + Identifier + windowModule + Name + Use window module + Description + Indicates whether window module should be used or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_WINDOW + $(SFML_LINK_PREFIX)sfml-window$(SFML_LINK_SUFFIX) + + + + + Definitions + + main.cpp:window:include + #include <SFML/Window.hpp> + + main.cpp:main:window:content + sf::Window window(sf::VideoMode(800, 600), "SFML window"); + + + main.cpp:system:include + + + main.cpp:main:audio_loop + + + + + false + + + Project + + SharedSettings + + SFML_WINDOW + + + + + + Definitions + + main.cpp:window:include + + + main.cpp:main:window:content + + + + main.cpp:main:event_loop + + + main.cpp:main:display + + + + + + + + + + Identifier + graphicsModule + RequiredOptions + + windowModule + true + + Name + Use graphics module + Description + Indicates whether graphics module should be used or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_GRAPHICS + $(SFML_LINK_PREFIX)sfml-graphics$(SFML_LINK_SUFFIX) + + + + + Definitions + + main.cpp:graphics:include + #include <SFML/Graphics.hpp> + + main.cpp:main:graphics_init_window + // Create the main window sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); - - main.cpp:main:image_init - + + main.cpp:main:image_init + // Load a sprite to display sf::Texture texture; - main.cpp:main:image_finalize - return EXIT_FAILURE; + main.cpp:main:image_finalize + return EXIT_FAILURE; sf::Sprite sprite(texture); - main.cpp:main:image_load - if (!texture.loadFromFile("cute_image.jpg")) - - main.cpp:main:text_init - + main.cpp:main:image_load + if (!texture.loadFromFile("cute_image.jpg")) + + main.cpp:main:text_init + // Create a graphical text to display sf::Font font; - main.cpp:main:text_finalize - return EXIT_FAILURE; + main.cpp:main:text_finalize + return EXIT_FAILURE; sf::Text text("Hello SFML", font, 50); text.setColor(sf::Color::Black); - - main.cpp:main:text_load - if (!font.loadFromFile("sansation.ttf")) - - main.cpp:main:graphics_display - - // Clear screen - window.clear(); - - // Draw the sprite - window.draw(sprite); - - // Draw the string - window.draw(text); + + main.cpp:main:text_load + if (!font.loadFromFile("sansation.ttf")) + + main.cpp:main:graphics_display + + // Clear screen + window.clear(); + + // Draw the sprite + window.draw(sprite); + + // Draw the string + window.draw(text); - - - main.cpp:window:include - - - main.cpp:main:window:content - - - sansation.ttf - - Group - Supporting Files - Path - sansation.ttf - - - cute_image.jpg - - Group - Supporting Files - Path - cute_image.jpg - - - - - Nodes - - sansation.ttf - cute_image.jpg - - - - false - - - Project - - SharedSettings - - SFML_GRAPHICS - - - - - - Definitions - - main.cpp:graphics:include - - - main.cpp:main:graphics_init - - - main.cpp:main:graphics_display - - - main.cpp:main:image_load - - - - - - - - - Identifier - audioModule - Name - Use audio module - Description - Indicates whether audio module should be used or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_AUDIO - $(SFML_LINK_PREFIX)sfml-audio$(SFML_LINK_SUFFIX) - - - - - Definitions - - main.cpp:audio:include - #include <SFML/Audio.hpp> - - main.cpp:main:audio:content - + + + main.cpp:window:include + + + main.cpp:main:window:content + + + sansation.ttf + + Group + Supporting Files + Path + sansation.ttf + + + cute_image.jpg + + Group + Supporting Files + Path + cute_image.jpg + + + + + Nodes + + sansation.ttf + cute_image.jpg + + + + false + + + Project + + SharedSettings + + SFML_GRAPHICS + + + + + + Definitions + + main.cpp:graphics:include + + + main.cpp:main:graphics_init + + + main.cpp:main:graphics_display + + + main.cpp:main:image_load + + + + + + + + + Identifier + audioModule + Name + Use audio module + Description + Indicates whether audio module should be used or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_AUDIO + $(SFML_LINK_PREFIX)sfml-audio$(SFML_LINK_SUFFIX) + + + + + Definitions + + main.cpp:audio:include + #include <SFML/Audio.hpp> + + main.cpp:main:audio:content + // Load a music to play sf::Music music; if (!music.openFromFile("nice_music.ogg")) - return EXIT_FAILURE; + return EXIT_FAILURE; // Play the music music.play(); - nice_music.ogg - - Group - Supporting Files - Path - nice_music.ogg - - - - - Nodes - - nice_music.ogg - - - - false - - - Project - - SharedSettings - - SFML_AUDIO - - - - - - Definitions - - main.cpp:audio:include - - - main.cpp:main:audio:content - + nice_music.ogg + + Group + Supporting Files + Path + nice_music.ogg + + + + + Nodes + + nice_music.ogg + + + + false + + + Project + + SharedSettings + + SFML_AUDIO + + + + + + Definitions + + main.cpp:audio:include + + + main.cpp:main:audio:content + main.cpp:main:audio_loop - - - - - - - - Identifier - networkModule - Name - Use network module - Description - Indicates whether network module should be used or not. - Type - checkbox - SortOrder - 1 - Default - true - Units - - - true - - - Project - - SharedSettings - - SFML_NETWORK - $(SFML_LINK_PREFIX)sfml-network$(SFML_LINK_SUFFIX) - - - - - Definitions - - main.cpp:network:include - #include <SFML/Network.hpp> - - - - - - false - - - Project - - SharedSettings - - SFML_NETWORK - - - - - - Definitions - - main.cpp:network:include - - - - - - - - + + + + + + + + Identifier + networkModule + Name + Use network module + Description + Indicates whether network module should be used or not. + Type + checkbox + SortOrder + 1 + Default + true + Units + + + true + + + Project + + SharedSettings + + SFML_NETWORK + $(SFML_LINK_PREFIX)sfml-network$(SFML_LINK_SUFFIX) + + + + + Definitions + + main.cpp:network:include + #include <SFML/Network.hpp> + + + + + + false + + + Project + + SharedSettings + + SFML_NETWORK + + + + + + Definitions + + main.cpp:network:include + + + + + + + + - + - Nodes - - main.cpp:system:include - main.cpp:window:include - main.cpp:graphics:include - main.cpp:audio:include - main.cpp:network:include - main.cpp:resources_comment - main.cpp:main:window:content - main.cpp:main:graphics_init_window - main.cpp:main:image_init - main.cpp:main:image_load - main.cpp:main:image_finalize - main.cpp:main:text_init - main.cpp:main:text_load - main.cpp:main:text_finalize - main.cpp:main:audio:content - main.cpp:main:audio_loop - main.cpp:main:event_loop - main.cpp:main:graphics_display - main.cpp:main:display - - - + Nodes + + main.cpp:system:include + main.cpp:window:include + main.cpp:graphics:include + main.cpp:audio:include + main.cpp:network:include + main.cpp:resources_comment + main.cpp:main:window:content + main.cpp:main:graphics_init_window + main.cpp:main:image_init + main.cpp:main:image_load + main.cpp:main:image_finalize + main.cpp:main:text_init + main.cpp:main:text_load + main.cpp:main:text_finalize + main.cpp:main:audio:content + main.cpp:main:audio_loop + main.cpp:main:event_loop + main.cpp:main:graphics_display + main.cpp:main:display + + + - Definitions - - - *:main - - Beginning - + Definitions + + + *:main + + Beginning + int main (int argc, const char * argv[]) { - End - - return EXIT_SUCCESS; + End + + return EXIT_SUCCESS; } - Indent - 1 - + Indent + 1 + - main.cpp:system:include - #include <SFML/System.hpp> - - main.cpp:main:event_loop - + main.cpp:system:include + #include <SFML/System.hpp> + + main.cpp:main:event_loop + // Start the game loop while (window.isOpen()) { - // Process events - sf::Event event; - while (window.pollEvent(event)) - { - // Close window : exit - if (event.type == sf::Event::Closed) - window.close(); + // Process events + sf::Event event; + while (window.pollEvent(event)) + { + // Close window : exit + if (event.type == sf::Event::Closed) + window.close(); - // Escape pressed : exit - if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) - window.close(); - } + // Escape pressed : exit + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) + window.close(); + } - - main.cpp:main:display - - // Update the window - window.display(); + + main.cpp:main:display + + // Update the window + window.display(); } - - main.cpp:resources_comment - + + main.cpp:resources_comment + /* Resources : * =========== * @@ -622,72 +622,78 @@ while (window.isOpen()) * - Click OK. */ - - main.cpp:main:audio_loop - while (music.getStatus() == sf::Music::Playing) { - sf::Sleep(100); + + main.cpp:main:audio_loop + while (music.getStatus() == sf::Music::Playing) { + sf::Sleep(100); } - - + + - Project - - - Name - ___PACKAGENAME___ - - - SharedSettings - - PRODUCT_NAME - $(TARGET_NAME) - - SFML_LINK_DYLIBS_PREFIX - -l - - SFML_LINK_FRAMEWORKS_PREFIX - -framework - - SFML_SYSTEM - $(SFML_LINK_PREFIX)sfml-system$(SFML_LINK_SUFFIX) - - SFML_LINK_FRAMEWORKS_SUFFIX - - - CLANG_ENABLE_OBJC_ARC - - - GCC_ENABLE_OBJC_GC - unsupported + Project + + + Name + ___PACKAGENAME___ + + + SharedSettings + + PRODUCT_NAME + $(TARGET_NAME) + + SFML_LINK_DYLIBS_PREFIX + -l + + SFML_LINK_FRAMEWORKS_PREFIX + -framework + + SFML_SYSTEM + $(SFML_LINK_PREFIX)sfml-system$(SFML_LINK_SUFFIX) + + SFML_LINK_FRAMEWORKS_SUFFIX + + + CLANG_ENABLE_OBJC_ARC + + + GCC_ENABLE_OBJC_GC + unsupported FRAMEWORK_SEARCH_PATHS $(FRAMEWORK_SEARCH_PATHS) /Library/Frameworks/** - - - Configurations - - - Debug - - SFML_LINK_DYLIBS_SUFFIX - $(SFML_LINK_DYLIBS_SUFFIX_DEBUG) - - OTHER_LDFLAGS - $(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) - - - - - Release - - SFML_LINK_DYLIBS_SUFFIX - - - OTHER_LDFLAGS - $(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) - - - + + HEADER_SEARCH_PATHS + $(HEADER_SEARCH_PATHS) /usr/local/include/** + + LIBRARY_SEARCH_PATHS + $(LIBRARY_SEARCH_PATHS) /usr/local/lib/** + + + Configurations + + + Debug + + SFML_LINK_DYLIBS_SUFFIX + $(SFML_LINK_DYLIBS_SUFFIX_DEBUG) + + OTHER_LDFLAGS + $(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) + + + + + Release + + SFML_LINK_DYLIBS_SUFFIX + + + OTHER_LDFLAGS + $(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) + + + From bfda3b8c344461f23c6793370dc4c8a725ea1feb Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Sun, 8 Jul 2012 19:21:15 +0200 Subject: [PATCH 3/3] Improved Xcode templates and the readme (Close #224) --- .../TemplateInfo.plist | 30 ++++++++----------- .../TemplateInfo.plist | 26 +++++++--------- tools/xcode/templates/readme.txt | 19 +++++++----- 3 files changed, 34 insertions(+), 41 deletions(-) diff --git a/tools/xcode/templates/SFML/SFML Application Base.xctemplate/TemplateInfo.plist b/tools/xcode/templates/SFML/SFML Application Base.xctemplate/TemplateInfo.plist index 79406963c..1314e5ebc 100644 --- a/tools/xcode/templates/SFML/SFML Application Base.xctemplate/TemplateInfo.plist +++ b/tools/xcode/templates/SFML/SFML Application Base.xctemplate/TemplateInfo.plist @@ -66,14 +66,8 @@ subject to the following restrictions: SharedSettings - SFML_LINK_PREFIX - $(SFML_LINK_FRAMEWORKS_PREFIX) - - SFML_LINK_SUFFIX - $(SFML_LINK_FRAMEWORKS_SUFFIX) - - HEADER_SEARCH_PATHS - $(HEADER_SEARCH_PATHS) + SFML_BINARY_TYPE + FRAMEWORKS @@ -85,14 +79,8 @@ subject to the following restrictions: SharedSettings - SFML_LINK_PREFIX - $(SFML_LINK_DYLIBS_PREFIX) - - SFML_LINK_SUFFIX - $(SFML_LINK_DYLIBS_SUFFIX) - - HEADER_SEARCH_PATHS - $(HEADER_SEARCH_PATHS) /usr/local/include/ + SFML_BINARY_TYPE + DYLIBS @@ -558,7 +546,7 @@ music.play(); main.cpp:main:graphics_display main.cpp:main:display ResourcePath.mm - ResourcePath.hpp + ResourcePath.hpp @@ -652,11 +640,17 @@ while (window.isOpen()) SFML_LINK_FRAMEWORKS_PREFIX -framework - SFML_SYSTEM + SFML_SYSTEM $(SFML_LINK_PREFIX)sfml-system$(SFML_LINK_SUFFIX) SFML_LINK_FRAMEWORKS_SUFFIX + + SFML_LINK_PREFIX + $(SFML_LINK_$(SFML_BINARY_TYPE)_PREFIX) + + SFML_LINK_SUFFIX + $(SFML_LINK_$(SFML_BINARY_TYPE)_SUFFIX) CLANG_ENABLE_OBJC_ARC diff --git a/tools/xcode/templates/SFML/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist b/tools/xcode/templates/SFML/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist index 0e0a402de..bd475d26c 100644 --- a/tools/xcode/templates/SFML/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist +++ b/tools/xcode/templates/SFML/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist @@ -66,14 +66,8 @@ subject to the following restrictions: SharedSettings - SFML_LINK_PREFIX - $(SFML_LINK_FRAMEWORKS_PREFIX) - - SFML_LINK_SUFFIX - $(SFML_LINK_FRAMEWORKS_SUFFIX) - - HEADER_SEARCH_PATHS - $(HEADER_SEARCH_PATHS) + SFML_BINARY_TYPE + FRAMEWORKS @@ -85,14 +79,8 @@ subject to the following restrictions: SharedSettings - SFML_LINK_PREFIX - $(SFML_LINK_DYLIBS_PREFIX) - - SFML_LINK_SUFFIX - $(SFML_LINK_DYLIBS_SUFFIX) - - HEADER_SEARCH_PATHS - $(HEADER_SEARCH_PATHS) /usr/local/include/ + SFML_BINARY_TYPE + DYLIBS @@ -654,6 +642,12 @@ while (window.isOpen()) SFML_LINK_FRAMEWORKS_SUFFIX + + SFML_LINK_PREFIX + $(SFML_LINK_$(SFML_BINARY_TYPE)_PREFIX) + + SFML_LINK_SUFFIX + $(SFML_LINK_$(SFML_BINARY_TYPE)_SUFFIX) CLANG_ENABLE_OBJC_ARC diff --git a/tools/xcode/templates/readme.txt b/tools/xcode/templates/readme.txt index ee41b9d68..6270e8aff 100644 --- a/tools/xcode/templates/readme.txt +++ b/tools/xcode/templates/readme.txt @@ -47,13 +47,18 @@ Question & Answer 2. select your project's target on the main area, 3. go to the "Build Settings" tab, 4. go down to the bottom, - 5. update SFML_LINK_PREFIX and SFML_LINK_SUFFIX as follow : - * if you want to use frameworks, then - 1. set SFML_LINK_PREFIX to "$(SFML_LINK_FRAMEWORKS_PREFIX)", - 2. set SFML_LINK_SUFFIX to "$(SFML_LINK_FRAMEWORKS_SUFFIX)" - * if you want to use dylibs, then - 1. set SFML_LINK_PREFIX to "$(SFML_LINK_DYLIBS_PREFIX)", - 2. set SFML_LINK_SUFFIX to "$(SFML_LINK_DYLIBS_SUFFIX)" + 5. set SFML_BINARY_TYPE either to "DYLIBS" or "FRAMEWORKS". + + + * How to use/don't use debug dylibs ? + + You can choose to use or not SFML debug binaries when creating a new project. However, if you have already created your project you can do the following : + + 1. select your project from the project navigator panel, + 2. select your project's target on the main area, + 3. go to the "Build Settings" tab, + 4. go down to the bottom, + 5. set SFML_LINK_DYLIBS_SUFFIX_DEBUG to "-d" to use them or to "" (empty string) to use only release binary. * I want to use the static version of SFML. Is it possible ?