Added the iOS port

This commit is contained in:
Laurent 2013-08-19 21:53:50 +02:00 committed by Jonathan De Wachter
parent f2ef524b57
commit e5ee38fc26
99 changed files with 24297 additions and 156 deletions

View file

@ -35,8 +35,9 @@
////////////////////////////////////////////////////////////
// Identify the operating system
// see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
////////////////////////////////////////////////////////////
#if defined(_WIN32) || defined(__WIN32__)
#if defined(_WIN32)
// Windows
#define SFML_SYSTEM_WINDOWS
@ -44,20 +45,47 @@
#define NOMINMAX
#endif
#elif defined(linux) || defined(__linux)
#elif defined(__APPLE__) && defined(__MACH__)
// Linux
#define SFML_SYSTEM_LINUX
// Apple platform, see which one it is
#include "TargetConditionals.h"
#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
// MacOS
#define SFML_SYSTEM_MACOS
// iOS
#define SFML_SYSTEM_IOS
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#elif TARGET_OS_MAC
// FreeBSD
#define SFML_SYSTEM_FREEBSD
// MacOS
#define SFML_SYSTEM_MACOS
#else
// Unsupported Apple system
#error This Apple operating system is not supported by SFML library
#endif
#elif defined(__unix__)
// UNIX system, see which one it is
#if defined(__linux__)
// Linux
#define SFML_SYSTEM_LINUX
#elif defined(__FreeBSD__)
// FreeBSD
#define SFML_SYSTEM_FREEBSD
#else
// Unsupported UNIX system
#error This UNIX operating system is not supported by SFML library
#endif
#else

View file

@ -44,7 +44,7 @@ enum PrimitiveType
Triangles, ///< List of individual triangles
TrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
TrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
Quads ///< List of individual quads
Quads ///< List of individual quads (deprecated, don't work with OpenGL ES)
};
} // namespace sf

View file

@ -56,6 +56,11 @@
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#elif defined (SFML_SYSTEM_IOS)
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#endif

View file

@ -35,12 +35,14 @@
#include <SFML/Window/Event.hpp>
#include <SFML/Window/Joystick.hpp>
#include <SFML/Window/Keyboard.hpp>
#include <SFML/Window/Main.hpp>
#include <SFML/Window/Mouse.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <SFML/Window/Window.hpp>
#include <SFML/Window/WindowStyle.hpp>
#endif // SFML_SFML_WINDOW_HPP
////////////////////////////////////////////////////////////

View file

@ -162,6 +162,21 @@ public :
///
////////////////////////////////////////////////////////////
static bool isKeyPressed(Key key);
////////////////////////////////////////////////////////////
/// \brief Show or hide the virtual keyboard
///
/// Warning: the virtual keyboard is not supported on all
/// systems. It will typically be implemented on mobile OSes
/// (Android, iOS) but not on desktop OSes (Windows, Linux, ...).
///
/// If the virtual keyboard is not available, this function does
/// nothing.
///
/// \param visible True to show, false to hide
///
////////////////////////////////////////////////////////////
static void setVirtualKeyboardVisible(bool visible);
};
} // namespace sf

View file

@ -0,0 +1,41 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#ifndef SFML_MAIN_HPP
#define SFML_MAIN_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
// On iOS, we have no choice but to have our own main,
// so we need to rename the user one and call it later
#if defined(SFML_SYSTEM_IOS)
#define main sfmlMain
#endif
#endif // SFML_MAIN_HPP

View file

@ -56,6 +56,11 @@ namespace sf
// Window handle is NSWindow (void*) on Mac OS X - Cocoa
typedef void* WindowHandle;
#elif defined(SFML_SYSTEM_IOS)
// Window handle is UIWindow (void*) on iOS - UIKit
typedef void* WindowHandle;
#endif
} // namespace sf