Update libSDL2 and imgui.
Disable HIGHDPI on macOS.
@@ -1,119 +0,0 @@
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake")
|
||||
endif()
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake")
|
||||
endif()
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake")
|
||||
endif()
|
||||
|
||||
# on static-only builds create an alias
|
||||
if(NOT TARGET SDL2::SDL2 AND TARGET SDL2::SDL2-static)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.18")
|
||||
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
||||
set_target_properties(SDL2::SDL2-static PROPERTIES IMPORTED_GLOBAL TRUE)
|
||||
endif()
|
||||
add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static)
|
||||
endif()
|
||||
|
||||
# provide ${SDL2_LIBRARIES}, ${SDL2_INCLUDE_DIRS} etc, like sdl2-config.cmake does,
|
||||
# for compatibility between SDL2 built with autotools and SDL2 built with CMake
|
||||
|
||||
# the following seems to work on Windows for both MSVC and MINGW+MSYS and with both SDL2Config/Target.cmake
|
||||
# from vcpkg and from building myself with cmake from latest git
|
||||
# AND on Linux when building SDL2 (tested current git) with CMake
|
||||
|
||||
# the headers are easy - but note that this adds both .../include/ and .../include/SDL2/
|
||||
# while the SDL2_INCLUDE_DIRS of sdl2-config.cmake only add ...include/SDL2/
|
||||
# But at least if building worked with sdl2-config.cmake it will also work with this.
|
||||
get_target_property(SDL2_INCLUDE_DIRS SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
# get the paths to the files to link against (.lib or .dll.a on Windows, .so or .a on Unix, ...) for both SDL2 and SDL2main
|
||||
|
||||
# for the "normal"/release build they could be in lots of different properties..
|
||||
set(relprops IMPORTED_IMPLIB_RELEASE IMPORTED_IMPLIB_NOCONFIG IMPORTED_IMPLIB IMPORTED_IMPLIB_MINSIZEREL IMPORTED_IMPLIB_RELWITHDEBINFO
|
||||
IMPORTED_LOCATION_RELEASE IMPORTED_LOCATION_NOCONFIG IMPORTED_LOCATION IMPORTED_LOCATION_MINSIZEREL IMPORTED_LOCATION_RELWITHDEBINFO)
|
||||
|
||||
# fewer possibilities for debug builds
|
||||
set(dbgprops IMPORTED_IMPLIB_DEBUG IMPORTED_LOCATION_DEBUG)
|
||||
|
||||
foreach(prop ${relprops})
|
||||
get_target_property(sdl2implib SDL2::SDL2 ${prop})
|
||||
if(sdl2implib)
|
||||
#message("set sdl2implib from ${prop}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(prop ${relprops})
|
||||
get_target_property(sdl2mainimplib SDL2::SDL2main ${prop})
|
||||
if(sdl2mainimplib)
|
||||
#message("set sdl2mainimplib from ${prop}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(prop ${dbgprops})
|
||||
get_target_property(sdl2implibdbg SDL2::SDL2 ${prop})
|
||||
if(sdl2implibdbg)
|
||||
#message("set sdl2implibdbg from ${prop}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(prop ${dbgprops})
|
||||
get_target_property(sdl2mainimplibdbg SDL2::SDL2main ${prop})
|
||||
if(sdl2mainimplibdbg)
|
||||
#message("set sdl2mainimplibdbg from ${prop}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if( sdl2implib AND sdl2mainimplib AND sdl2implibdbg AND sdl2mainimplibdbg )
|
||||
# we have both release and debug builds of SDL2 and SDL2main, so use this ugly
|
||||
# generator expression in SDL2_LIBRARIES to support both in MSVC, depending on build type configured there
|
||||
set(SDL2_LIBRARIES $<IF:$<CONFIG:Debug>,${sdl2mainimplibdbg},${sdl2mainimplib}> $<IF:$<CONFIG:Debug>,${sdl2implibdbg},${sdl2implib}>)
|
||||
else()
|
||||
if( (NOT sdl2implib) AND sdl2implibdbg ) # if we only have a debug version of the lib
|
||||
set(sdl2implib ${sdl2implibdbg})
|
||||
endif()
|
||||
if( (NOT sdl2mainimplib) AND sdl2mainimplibdbg ) # if we only have a debug version of the lib
|
||||
set(sdl2mainimplib ${sdl2mainimplibdbg})
|
||||
endif()
|
||||
|
||||
if( sdl2implib AND sdl2mainimplib )
|
||||
set(SDL2_LIBRARIES ${sdl2mainimplib} ${sdl2implib})
|
||||
elseif(WIN32 OR APPLE) # I think these platforms have a non-dummy SDLmain?
|
||||
message(FATAL_ERROR, "SDL2::SDL2 and/or SDL2::SDL2main don't seem to contain any kind of IMPORTED_IMPLIB* or IMPORTED_LOCATION*")
|
||||
elseif(sdl2implib) # on other platforms just libSDL2 will hopefully do?
|
||||
set(SDL2_LIBRARIES ${sdl2implib})
|
||||
message(STATUS, "No SDL2main lib not found, I hope you don't need it..")
|
||||
else()
|
||||
message(FATAL_ERROR, "SDL2::SDL2 doesn't seem to contain any kind of lib to link against in IMPORTED_IMPLIB* or IMPORTED_LOCATION*")
|
||||
endif()
|
||||
|
||||
# TODO: should something like INTERFACE_LINK_LIBRARIES be appended? or wherever -mwindows and things like that
|
||||
# might be defined (if they were defined by the CMake build at all; autotools has @SDL_RLD_FLAGS@ @SDL_LIBS@)?
|
||||
# LINK_DEPENDS? LINK_FLAGS?
|
||||
|
||||
endif()
|
||||
|
||||
get_filename_component(SDL2_LIBDIR ${sdl2implib} PATH)
|
||||
|
||||
# NOTE: SDL2_LIBRARIES now looks like "c:/path/to/SDL2main.lib;c:/path/to/SDL2.lib"
|
||||
# which is different to what it looks like when coming from sdl2-config.cmake
|
||||
# (there it's more like "-L${SDL2_LIBDIR} -lSDL2main -lSDL2" - and also -lmingw32 and -mwindows)
|
||||
# This seems to work with both MSVC and MinGW though, while the other only worked with MinGW
|
||||
# On Linux it looks like "/tmp/sdl2inst/lib/libSDL2main.a;/tmp/sdl2inst/lib/libSDL2-2.0.so.0.14.1" which also seems to work
|
||||
|
||||
# the exec prefix is one level up from lib/ - TODO: really, always? at least on Linux there's /usr/lib/x86_64-bla-blub/libSDL2-asdf.so.0 ..
|
||||
get_filename_component(SDL2_EXEC_PREFIX ${SDL2_LIBDIR} PATH)
|
||||
set(SDL2_PREFIX ${SDL2_EXEC_PREFIX}) # TODO: could this be somewhere else? parent dir of include or sth?
|
||||
|
||||
unset(sdl2implib)
|
||||
unset(sdl2mainimplib)
|
||||
unset(sdl2implibdbg)
|
||||
unset(sdl2mainimplibdbg)
|
||||
unset(relprops)
|
||||
unset(dbgprops)
|
||||
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string></string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>iOS Launch Screen</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,43 +0,0 @@
|
||||
==============================================================================
|
||||
About the iPhone OS Demo Applications
|
||||
==============================================================================
|
||||
|
||||
Demos.xcodeproj contains several targets for iPhone oriented SDL demos. These demos are written strictly using SDL 2.0 calls. All the demos except for Fireworks (which requires OpenGL ES) should work on platforms other than iPhone OS, though you'll need to write your own compile script.
|
||||
|
||||
Common files:
|
||||
|
||||
common.c and common.h contain code common to all demo applications. This includes functions about delta timing (in seconds), simple error handling, and functions for generating random numbers.
|
||||
|
||||
Rectangles (rectangles.c):
|
||||
|
||||
Draws randomly sized and colored rectangles all over the screen by using SDL_RenderFillRect. This is the simplest of all the demos.
|
||||
|
||||
Happy (happy.c):
|
||||
|
||||
Loads the classic happy-face bitmap and draws a large number of happy faces bouncing around the screen. Shows how you can load a bitmap into an SDL_Texture.
|
||||
|
||||
Accelerometer (accelerometer.c):
|
||||
|
||||
Uses the iPhone's accelerometer as a joystick device to move a spaceship around the screen. Note the use of the macro SDL_IPHONE_MAX_GFORCE (normally defined in SDL_config_iphoneos.h) which converts between the Sint16 number returned by SDL_JoystickGetAxis, and the floating point units of g-force reported natively by the iPhone.
|
||||
|
||||
Touch (touch.c):
|
||||
|
||||
Acts as a finger-paint type program. Demonstrates how you can use SDL mouse input to accept touch input from the iPhone. If SDL for iPhone is compiled with multitouch as multiple mouse emulation (SDL_IPHONE_MULTIPLE_MICE in SDL_config_iphoneos.h) then the program will accept multiple finger inputs simultaneously.
|
||||
|
||||
Mixer (mixer.c):
|
||||
|
||||
Displays several rectangular buttons which can be used as a virtual drumkit. Demonstrates how you can play .wav sounds in SDL and how you can use SDL_MixAudioFormat to build a software mixer that can play multiple sounds at once.
|
||||
|
||||
Keyboard (keyboard.c):
|
||||
|
||||
Loads a bitmap font and let's the user type words, numbers, and symbols using the iPhone's virtual keyboard. The iPhone's onscreen keyboard visibility is toggled when the user taps the screen. If the user types ':)' a happy face is displayed. Demonstrates how to use functions added to the iPhone implementation of SDL to toggle keyboard onscreen visibility.
|
||||
|
||||
Fireworks (fireworks.c):
|
||||
|
||||
Displays a fireworks show. When you tap the iPhone's screen, fireworks fly from the bottom of the screen and explode at the point that you tapped. Demonstrates how you can use SDL on iPhone to build an OpenGL ES based application. Shows you how you can use SDL_LoadBMP to load a bmp image and convert it to an OpenGL ES texture. Of lesser importance, shows how you can use OpenGL ES point sprites to build an efficient particle system.
|
||||
|
||||
==============================================================================
|
||||
Building and Running the demos
|
||||
==============================================================================
|
||||
|
||||
Before building the demos you must first build SDL as a static library for BOTH the iPhone Simulator and the iPhone itself. See the iPhone SDL main README file for directions on how to do this. Once this is done, simply launch XCode, select the target you'd like to build, select the active SDK (simulator or device), and then build and go.
|
||||
|
Before Width: | Height: | Size: 44 KiB |
@@ -1,258 +0,0 @@
|
||||
__ _ _
|
||||
/ _| | | | |
|
||||
| |_ ___ _ __ | |_ _ __ __ _ ___| | __
|
||||
| _/ _ \| '_ \| __| '_ \ / _` |/ __| |/ /
|
||||
| || (_) | | | | |_| |_) | (_| | (__| <
|
||||
|_| \___/|_| |_|\__| .__/ \__,_|\___|_|\_\
|
||||
| |
|
||||
|_|
|
||||
----------------------------------------------------------------------
|
||||
Product : font-pack.zip
|
||||
Website : http://www.spicypixel.net
|
||||
Author : Marc Russell
|
||||
Released: 16th January 2008
|
||||
----------------------------------------------------------------------
|
||||
|
||||
What is this?
|
||||
-------------
|
||||
font-pack is a package of free art assets to be used under the terms of this document. It is available to game developers and hobbyists alike.
|
||||
|
||||
Contents
|
||||
--------
|
||||
The contents of the font-pack ZIP file include 20 bitmap fonts
|
||||
|
||||
Usage License & Restrictions
|
||||
----------------------------
|
||||
font-pack is distributed under the "Common Public License Version 1.0."
|
||||
The terms of which are given below. If you do not understand the terms of the license please refer to a solicitor. It should however, be relatively clear how this package can be used.
|
||||
|
||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON
|
||||
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
|
||||
THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||
|
||||
1. DEFINITIONS
|
||||
|
||||
"Contribution" means:
|
||||
|
||||
a) in the case of the initial Contributor, the initial code and
|
||||
documentation distributed under this Agreement, and
|
||||
|
||||
b) in the case of each subsequent Contributor:
|
||||
|
||||
i) changes to the Program, and
|
||||
|
||||
ii) additions to the Program;
|
||||
|
||||
where such changes and/or additions to the Program originate from
|
||||
and are distributed by that particular Contributor. A Contribution
|
||||
'originates' from a Contributor if it was added to the Program by
|
||||
such Contributor itself or anyone acting on such Contributor's
|
||||
behalf. Contributions do not include additions to the Program which:
|
||||
(i) are separate modules of software distributed in conjunction with
|
||||
the Program under their own license agreement, and (ii) are not
|
||||
derivative works of the Program.
|
||||
|
||||
"Contributor" means any person or entity that distributes the Program.
|
||||
|
||||
"Licensed Patents " mean patent claims licensable by a Contributor which
|
||||
are necessarily infringed by the use or sale of its Contribution alone
|
||||
or when combined with the Program.
|
||||
|
||||
"Program" means the Contributions distributed in accordance with this
|
||||
Agreement.
|
||||
|
||||
"Recipient" means anyone who receives the Program under this Agreement,
|
||||
including all Contributors.
|
||||
|
||||
2. GRANT OF RIGHTS
|
||||
|
||||
a) Subject to the terms of this Agreement, each Contributor hereby
|
||||
grants Recipient a non-exclusive, worldwide, royalty-free copyright
|
||||
license to reproduce, prepare derivative works of, publicly display,
|
||||
publicly perform, distribute and sublicense the Contribution of such
|
||||
Contributor, if any, and such derivative works, in source code and
|
||||
object code form.
|
||||
|
||||
b) Subject to the terms of this Agreement, each Contributor hereby
|
||||
grants Recipient a non-exclusive, worldwide, royalty-free patent
|
||||
license under Licensed Patents to make, use, sell, offer to sell,
|
||||
import and otherwise transfer the Contribution of such Contributor,
|
||||
if any, in source code and object code form. This patent license
|
||||
shall apply to the combination of the Contribution and the Program
|
||||
if, at the time the Contribution is added by the Contributor, such
|
||||
addition of the Contribution causes such combination to be covered
|
||||
by the Licensed Patents. The patent license shall not apply to any
|
||||
other combinations which include the Contribution. No hardware per
|
||||
se is licensed hereunder.
|
||||
|
||||
c) Recipient understands that although each Contributor grants the
|
||||
licenses to its Contributions set forth herein, no assurances are
|
||||
provided by any Contributor that the Program does not infringe the
|
||||
patent or other intellectual property rights of any other entity.
|
||||
Each Contributor disclaims any liability to Recipient for claims
|
||||
brought by any other entity based on infringement of intellectual
|
||||
property rights or otherwise. As a condition to exercising the
|
||||
rights and licenses granted hereunder, each Recipient hereby assumes
|
||||
sole responsibility to secure any other intellectual property rights
|
||||
needed, if any. For example, if a third party patent license is
|
||||
required to allow Recipient to distribute the Program, it is
|
||||
Recipient's responsibility to acquire that license before
|
||||
distributing the Program.
|
||||
|
||||
d) Each Contributor represents that to its knowledge it has
|
||||
sufficient copyright rights in its Contribution, if any, to grant
|
||||
the copyright license set forth in this Agreement.
|
||||
|
||||
3. REQUIREMENTS
|
||||
|
||||
A Contributor may choose to distribute the Program in object code form
|
||||
under its own license agreement, provided that:
|
||||
|
||||
a) it complies with the terms and conditions of this Agreement; and
|
||||
|
||||
b) its license agreement:
|
||||
|
||||
i) effectively disclaims on behalf of all Contributors all
|
||||
warranties and conditions, express and implied, including warranties
|
||||
or conditions of title and non-infringement, and implied warranties
|
||||
or conditions of merchantability and fitness for a particular
|
||||
purpose;
|
||||
|
||||
ii) effectively excludes on behalf of all Contributors all liability
|
||||
for damages, including direct, indirect, special, incidental and
|
||||
consequential damages, such as lost profits;
|
||||
|
||||
iii) states that any provisions which differ from this Agreement are
|
||||
offered by that Contributor alone and not by any other party; and
|
||||
|
||||
iv) states that source code for the Program is available from such
|
||||
Contributor, and informs licensees how to obtain it in a reasonable
|
||||
manner on or through a medium customarily used for software
|
||||
exchange.
|
||||
|
||||
When the Program is made available in source code form:
|
||||
|
||||
a) it must be made available under this Agreement; and
|
||||
|
||||
b) a copy of this Agreement must be included with each copy of the
|
||||
Program.
|
||||
|
||||
Contributors may not remove or alter any copyright notices contained
|
||||
within the Program.
|
||||
|
||||
Each Contributor must identify itself as the originator of its
|
||||
Contribution, if any, in a manner that reasonably allows subsequent
|
||||
Recipients to identify the originator of the Contribution.
|
||||
|
||||
4. COMMERCIAL DISTRIBUTION
|
||||
|
||||
Commercial distributors of software may accept certain responsibilities
|
||||
with respect to end users, business partners and the like. While this
|
||||
license is intended to facilitate the commercial use of the Program, the
|
||||
Contributor who includes the Program in a commercial product offering
|
||||
should do so in a manner which does not create potential liability for
|
||||
other Contributors. Therefore, if a Contributor includes the Program in
|
||||
a commercial product offering, such Contributor ("Commercial
|
||||
Contributor") hereby agrees to defend and indemnify every other
|
||||
Contributor ("Indemnified Contributor") against any losses, damages and
|
||||
costs (collectively "Losses") arising from claims, lawsuits and other
|
||||
legal actions brought by a third party against the Indemnified
|
||||
Contributor to the extent caused by the acts or omissions of such
|
||||
Commercial Contributor in connection with its distribution of the
|
||||
Program in a commercial product offering. The obligations in this
|
||||
section do not apply to any claims or Losses relating to any actual or
|
||||
alleged intellectual property infringement. In order to qualify, an
|
||||
Indemnified Contributor must: a) promptly notify the Commercial
|
||||
Contributor in writing of such claim, and b) allow the Commercial
|
||||
Contributor to control, and cooperate with the Commercial Contributor
|
||||
in, the defense and any related settlement negotiations. The Indemnified
|
||||
Contributor may participate in any such claim at its own expense.
|
||||
|
||||
For example, a Contributor might include the Program in a commercial
|
||||
product offering, Product X. That Contributor is then a Commercial
|
||||
Contributor. If that Commercial Contributor then makes performance
|
||||
claims, or offers warranties related to Product X, those performance
|
||||
claims and warranties are such Commercial Contributor's responsibility
|
||||
alone. Under this section, the Commercial Contributor would have to
|
||||
defend claims against the other Contributors related to those
|
||||
performance claims and warranties, and if a court requires any other
|
||||
Contributor to pay any damages as a result, the Commercial Contributor
|
||||
must pay those damages.
|
||||
|
||||
5. NO WARRANTY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED
|
||||
ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES
|
||||
OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR
|
||||
A PARTICULAR PURPOSE. Each Recipient is solely responsible for
|
||||
determining the appropriateness of using and distributing the Program
|
||||
and assumes all risks associated with its exercise of rights under this
|
||||
Agreement, including but not limited to the risks and costs of program
|
||||
errors, compliance with applicable laws, damage to or loss of data,
|
||||
programs or equipment, and unavailability or interruption of operations.
|
||||
|
||||
6. DISCLAIMER OF LIABILITY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
|
||||
ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
|
||||
WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
|
||||
DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
|
||||
HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. GENERAL
|
||||
|
||||
If any provision of this Agreement is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of
|
||||
the remainder of the terms of this Agreement, and without further action
|
||||
by the parties hereto, such provision shall be reformed to the minimum
|
||||
extent necessary to make such provision valid and enforceable.
|
||||
|
||||
If Recipient institutes patent litigation against a Contributor with
|
||||
respect to a patent applicable to software (including a cross-claim or
|
||||
counterclaim in a lawsuit), then any patent licenses granted by that
|
||||
Contributor to such Recipient under this Agreement shall terminate as of
|
||||
the date such litigation is filed. In addition, if Recipient institutes
|
||||
patent litigation against any entity (including a cross-claim or
|
||||
counterclaim in a lawsuit) alleging that the Program itself (excluding
|
||||
combinations of the Program with other software or hardware) infringes
|
||||
such Recipient's patent(s), then such Recipient's rights granted under
|
||||
Section 2(b) shall terminate as of the date such litigation is filed.
|
||||
|
||||
All Recipient's rights under this Agreement shall terminate if it fails
|
||||
to comply with any of the material terms or conditions of this Agreement
|
||||
and does not cure such failure in a reasonable period of time after
|
||||
becoming aware of such noncompliance. If all Recipient's rights under
|
||||
this Agreement terminate, Recipient agrees to cease use and distribution
|
||||
of the Program as soon as reasonably practicable. However, Recipient's
|
||||
obligations under this Agreement and any licenses granted by Recipient
|
||||
relating to the Program shall continue and survive.
|
||||
|
||||
Everyone is permitted to copy and distribute copies of this Agreement,
|
||||
but in order to avoid inconsistency the Agreement is copyrighted and may
|
||||
only be modified in the following manner. The Agreement Steward reserves
|
||||
the right to publish new versions (including revisions) of this
|
||||
Agreement from time to time. No one other than the Agreement Steward has
|
||||
the right to modify this Agreement. IBM is the initial Agreement
|
||||
Steward. IBM may assign the responsibility to serve as the Agreement
|
||||
Steward to a suitable separate entity. Each new version of the Agreement
|
||||
will be given a distinguishing version number. The Program (including
|
||||
Contributions) may always be distributed subject to the version of the
|
||||
Agreement under which it was received. In addition, after a new version
|
||||
of the Agreement is published, Contributor may elect to distribute the
|
||||
Program (including its Contributions) under the new version. Except as
|
||||
expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
|
||||
rights or licenses to the intellectual property of any Contributor under
|
||||
this Agreement, whether expressly, by implication, estoppel or
|
||||
otherwise. All rights in the Program not expressly granted under this
|
||||
Agreement are reserved.
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the
|
||||
intellectual property laws of the United States of America. No party to
|
||||
this Agreement will bring a legal action under this Agreement more than
|
||||
one year after the cause of action arose. Each party waives its rights
|
||||
to a jury trial in any resulting litigation.
|
||||
|
||||
|
Before Width: | Height: | Size: 578 B |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 450 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Default.png" translatesAutoresizingMaskIntoConstraints="NO" id="VeL-6u-rS3"/>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="VeL-6u-rS3" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="C5X-Vg-tvO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="VeL-6u-rS3" secondAttribute="trailing" id="X4i-1U-3JE"/>
|
||||
<constraint firstItem="VeL-6u-rS3" firstAttribute="bottom" secondItem="xb3-aO-Qok" secondAttribute="top" id="dSu-2l-DcF"/>
|
||||
<constraint firstItem="VeL-6u-rS3" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="xKC-uj-bxE"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="52" y="374.66266866566718"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Default.png" width="320" height="480"/>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -1,226 +0,0 @@
|
||||
/*
|
||||
* accelerometer.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include <math.h>
|
||||
#include "common.h"
|
||||
|
||||
#define DAMPING 0.5f; /* after bouncing off a wall, damping coefficient determines final speed */
|
||||
#define FRICTION 0.0008f /* coefficient of acceleration that opposes direction of motion */
|
||||
#define GRAVITY_CONSTANT 0.004f /* how sensitive the ship is to the accelerometer */
|
||||
|
||||
/* If we aren't on an iPhone, then this definition ought to yield reasonable behavior */
|
||||
#ifndef SDL_IPHONE_MAX_GFORCE
|
||||
#define SDL_IPHONE_MAX_GFORCE 5.0f
|
||||
#endif
|
||||
|
||||
static SDL_Joystick *accelerometer; /* used for controlling the ship */
|
||||
|
||||
static struct
|
||||
{
|
||||
float x, y; /* position of ship */
|
||||
float vx, vy; /* velocity of ship (in pixels per millesecond) */
|
||||
SDL_Rect rect; /* (drawn) position and size of ship */
|
||||
} shipData;
|
||||
|
||||
static SDL_Texture *ship = 0; /* texture for spaceship */
|
||||
static SDL_Texture *space = 0; /* texture for space (background */
|
||||
|
||||
void
|
||||
render(SDL_Renderer *renderer, int w, int h, double deltaTime)
|
||||
{
|
||||
double deltaMilliseconds = deltaTime * 1000;
|
||||
float speed;
|
||||
|
||||
/* get joystick (accelerometer) axis values and normalize them */
|
||||
float ax = SDL_JoystickGetAxis(accelerometer, 0);
|
||||
float ay = SDL_JoystickGetAxis(accelerometer, 1);
|
||||
|
||||
/* ship screen constraints */
|
||||
Uint32 minx = 0.0f;
|
||||
Uint32 maxx = w - shipData.rect.w;
|
||||
Uint32 miny = 0.0f;
|
||||
Uint32 maxy = h - shipData.rect.h;
|
||||
|
||||
#define SINT16_MAX ((float)(0x7FFF))
|
||||
|
||||
/* update velocity from accelerometer
|
||||
the factor SDL_IPHONE_MAX_G_FORCE / SINT16_MAX converts between
|
||||
SDL's units reported from the joytick, and units of g-force, as reported by the accelerometer
|
||||
*/
|
||||
shipData.vx +=
|
||||
ax * SDL_IPHONE_MAX_GFORCE / SINT16_MAX * GRAVITY_CONSTANT *
|
||||
deltaMilliseconds;
|
||||
shipData.vy +=
|
||||
ay * SDL_IPHONE_MAX_GFORCE / SINT16_MAX * GRAVITY_CONSTANT *
|
||||
deltaMilliseconds;
|
||||
|
||||
speed = SDL_sqrt(shipData.vx * shipData.vx + shipData.vy * shipData.vy);
|
||||
|
||||
if (speed > 0) {
|
||||
/* compensate for friction */
|
||||
float dirx = shipData.vx / speed; /* normalized x velocity */
|
||||
float diry = shipData.vy / speed; /* normalized y velocity */
|
||||
|
||||
/* update velocity due to friction */
|
||||
if (speed - FRICTION * deltaMilliseconds > 0) {
|
||||
/* apply friction */
|
||||
shipData.vx -= dirx * FRICTION * deltaMilliseconds;
|
||||
shipData.vy -= diry * FRICTION * deltaMilliseconds;
|
||||
} else {
|
||||
/* applying friction would MORE than stop the ship, so just stop the ship */
|
||||
shipData.vx = 0.0f;
|
||||
shipData.vy = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* update ship location */
|
||||
shipData.x += shipData.vx * deltaMilliseconds;
|
||||
shipData.y += shipData.vy * deltaMilliseconds;
|
||||
|
||||
if (shipData.x > maxx) {
|
||||
shipData.x = maxx;
|
||||
shipData.vx = -shipData.vx * DAMPING;
|
||||
} else if (shipData.x < minx) {
|
||||
shipData.x = minx;
|
||||
shipData.vx = -shipData.vx * DAMPING;
|
||||
}
|
||||
if (shipData.y > maxy) {
|
||||
shipData.y = maxy;
|
||||
shipData.vy = -shipData.vy * DAMPING;
|
||||
} else if (shipData.y < miny) {
|
||||
shipData.y = miny;
|
||||
shipData.vy = -shipData.vy * DAMPING;
|
||||
}
|
||||
|
||||
/* draw the background */
|
||||
SDL_RenderCopy(renderer, space, NULL, NULL);
|
||||
|
||||
/* draw the ship */
|
||||
shipData.rect.x = shipData.x;
|
||||
shipData.rect.y = shipData.y;
|
||||
|
||||
SDL_RenderCopy(renderer, ship, NULL, &shipData.rect);
|
||||
|
||||
/* update screen */
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initializeTextures(SDL_Renderer *renderer)
|
||||
{
|
||||
|
||||
SDL_Surface *bmp_surface;
|
||||
|
||||
/* load the ship */
|
||||
bmp_surface = SDL_LoadBMP("ship.bmp");
|
||||
if (bmp_surface == NULL) {
|
||||
fatalError("could not ship.bmp");
|
||||
}
|
||||
/* set blue to transparent on the ship */
|
||||
SDL_SetColorKey(bmp_surface, 1,
|
||||
SDL_MapRGB(bmp_surface->format, 0, 0, 255));
|
||||
|
||||
/* create ship texture from surface */
|
||||
ship = SDL_CreateTextureFromSurface(renderer, bmp_surface);
|
||||
if (ship == 0) {
|
||||
fatalError("could not create ship texture");
|
||||
}
|
||||
SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
|
||||
|
||||
/* set the width and height of the ship from the surface dimensions */
|
||||
shipData.rect.w = bmp_surface->w;
|
||||
shipData.rect.h = bmp_surface->h;
|
||||
|
||||
SDL_FreeSurface(bmp_surface);
|
||||
|
||||
/* load the space background */
|
||||
bmp_surface = SDL_LoadBMP("space.bmp");
|
||||
if (bmp_surface == NULL) {
|
||||
fatalError("could not load space.bmp");
|
||||
}
|
||||
/* create space texture from surface */
|
||||
space = SDL_CreateTextureFromSurface(renderer, bmp_surface);
|
||||
if (space == 0) {
|
||||
fatalError("could not create space texture");
|
||||
}
|
||||
SDL_FreeSurface(bmp_surface);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
SDL_Window *window; /* main window */
|
||||
SDL_Renderer *renderer;
|
||||
int done; /* should we clean up and exit? */
|
||||
int w, h;
|
||||
|
||||
/* initialize SDL */
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
||||
fatalError("Could not initialize SDL");
|
||||
}
|
||||
|
||||
/* create main window and renderer */
|
||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
renderer = SDL_CreateRenderer(window, 0, 0);
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_RenderSetLogicalSize(renderer, w, h);
|
||||
|
||||
/* print out some info about joysticks and try to open accelerometer for use */
|
||||
printf("There are %d joysticks available\n", SDL_NumJoysticks());
|
||||
printf("Default joystick (index 0) is %s\n", SDL_JoystickName(0));
|
||||
accelerometer = SDL_JoystickOpen(0);
|
||||
if (accelerometer == NULL) {
|
||||
fatalError("Could not open joystick (accelerometer)");
|
||||
}
|
||||
printf("joystick number of axis = %d\n",
|
||||
SDL_JoystickNumAxes(accelerometer));
|
||||
printf("joystick number of hats = %d\n",
|
||||
SDL_JoystickNumHats(accelerometer));
|
||||
printf("joystick number of balls = %d\n",
|
||||
SDL_JoystickNumBalls(accelerometer));
|
||||
printf("joystick number of buttons = %d\n",
|
||||
SDL_JoystickNumButtons(accelerometer));
|
||||
|
||||
/* load graphics */
|
||||
initializeTextures(renderer);
|
||||
|
||||
/* setup ship */
|
||||
shipData.x = (w - shipData.rect.w) / 2;
|
||||
shipData.y = (h - shipData.rect.h) / 2;
|
||||
shipData.vx = 0.0f;
|
||||
shipData.vy = 0.0f;
|
||||
|
||||
done = 0;
|
||||
/* enter main loop */
|
||||
while (!done) {
|
||||
double deltaTime = updateDeltaTime();
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
render(renderer, w, h, deltaTime);
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
/* delete textures */
|
||||
SDL_DestroyTexture(ship);
|
||||
SDL_DestroyTexture(space);
|
||||
|
||||
/* shutdown SDL */
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* common.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "SDL.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
Produces a random int x, min <= x <= max
|
||||
following a uniform distribution
|
||||
*/
|
||||
int
|
||||
randomInt(int min, int max)
|
||||
{
|
||||
return min + rand() % (max - min + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
Produces a random float x, min <= x <= max
|
||||
following a uniform distribution
|
||||
*/
|
||||
float
|
||||
randomFloat(float min, float max)
|
||||
{
|
||||
return rand() / (float) RAND_MAX *(max - min) + min;
|
||||
}
|
||||
|
||||
void
|
||||
fatalError(const char *string)
|
||||
{
|
||||
printf("%s: %s\n", string, SDL_GetError());
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, string, SDL_GetError(), NULL);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static Uint64 prevTime = 0;
|
||||
|
||||
double
|
||||
updateDeltaTime(void)
|
||||
{
|
||||
Uint64 curTime;
|
||||
double deltaTime;
|
||||
|
||||
if (prevTime == 0) {
|
||||
prevTime = SDL_GetPerformanceCounter();
|
||||
}
|
||||
|
||||
curTime = SDL_GetPerformanceCounter();
|
||||
deltaTime = (double) (curTime - prevTime) / (double) SDL_GetPerformanceFrequency();
|
||||
prevTime = curTime;
|
||||
|
||||
return deltaTime;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/*
|
||||
* common.h
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
extern int randomInt(int min, int max);
|
||||
extern float randomFloat(float min, float max);
|
||||
extern void fatalError(const char *string);
|
||||
extern double updateDeltaTime(void);
|
||||
@@ -1,474 +0,0 @@
|
||||
/*
|
||||
* fireworks.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_opengles.h"
|
||||
#include "common.h"
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#define ACCEL 0.0001f /* acceleration due to gravity, units in pixels per millesecond squared */
|
||||
#define WIND_RESISTANCE 0.00005f /* acceleration per unit velocity due to wind resistance */
|
||||
#define MAX_PARTICLES 2000 /* maximum number of particles displayed at once */
|
||||
|
||||
static GLuint particleTextureID; /* OpenGL particle texture id */
|
||||
static SDL_bool pointSizeExtensionSupported; /* is GL_OES_point_size_array supported ? */
|
||||
static float pointSizeScale;
|
||||
/*
|
||||
used to describe what type of particle a given struct particle is.
|
||||
emitter - this particle flies up, shooting off trail particles, then finally explodes into dust particles.
|
||||
trail - shoots off, following emitter particle
|
||||
dust - radiates outwards from emitter explosion
|
||||
*/
|
||||
enum particleType
|
||||
{
|
||||
emitter = 0,
|
||||
trail,
|
||||
dust
|
||||
};
|
||||
/*
|
||||
struct particle is used to describe each particle displayed on screen
|
||||
*/
|
||||
struct particle
|
||||
{
|
||||
GLfloat x; /* x position of particle */
|
||||
GLfloat y; /* y position of particle */
|
||||
GLubyte color[4]; /* rgba color of particle */
|
||||
GLfloat size; /* size of particle in pixels */
|
||||
GLfloat xvel; /* x velocity of particle in pixels per milesecond */
|
||||
GLfloat yvel; /* y velocity of particle in pixels per millescond */
|
||||
int isActive; /* if not active, then particle is overwritten */
|
||||
enum particleType type; /* see enum particleType */
|
||||
} particles[MAX_PARTICLES]; /* this array holds all our particles */
|
||||
|
||||
static int num_active_particles; /* how many members of the particle array are actually being drawn / animated? */
|
||||
static int screen_w, screen_h;
|
||||
|
||||
/* function declarations */
|
||||
void spawnTrailFromEmitter(struct particle *emitter);
|
||||
void spawnEmitterParticle(GLfloat x, GLfloat y);
|
||||
void explodeEmitter(struct particle *emitter);
|
||||
void initializeParticles(void);
|
||||
void initializeTexture();
|
||||
int nextPowerOfTwo(int x);
|
||||
void drawParticles();
|
||||
void stepParticles(double deltaTime);
|
||||
|
||||
/* helper function (used in texture loading)
|
||||
returns next power of two greater than or equal to x
|
||||
*/
|
||||
int
|
||||
nextPowerOfTwo(int x)
|
||||
{
|
||||
int val = 1;
|
||||
while (val < x) {
|
||||
val *= 2;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
steps each active particle by timestep deltaTime
|
||||
*/
|
||||
void
|
||||
stepParticles(double deltaTime)
|
||||
{
|
||||
float deltaMilliseconds = deltaTime * 1000;
|
||||
int i;
|
||||
struct particle *slot = particles;
|
||||
struct particle *curr = particles;
|
||||
for (i = 0; i < num_active_particles; i++) {
|
||||
/* is the particle actually active, or is it marked for deletion? */
|
||||
if (curr->isActive) {
|
||||
/* is the particle off the screen? */
|
||||
if (curr->y > screen_h)
|
||||
curr->isActive = 0;
|
||||
else if (curr->y < 0)
|
||||
curr->isActive = 0;
|
||||
if (curr->x > screen_w)
|
||||
curr->isActive = 0;
|
||||
else if (curr->x < 0)
|
||||
curr->isActive = 0;
|
||||
|
||||
/* step velocity, then step position */
|
||||
curr->yvel += ACCEL * deltaMilliseconds;
|
||||
curr->xvel += 0.0f;
|
||||
curr->y += curr->yvel * deltaMilliseconds;
|
||||
curr->x += curr->xvel * deltaMilliseconds;
|
||||
|
||||
/* particle behavior */
|
||||
if (curr->type == emitter) {
|
||||
/* if we're an emitter, spawn a trail */
|
||||
spawnTrailFromEmitter(curr);
|
||||
/* if we've reached our peak, explode */
|
||||
if (curr->yvel > 0.0) {
|
||||
explodeEmitter(curr);
|
||||
}
|
||||
} else {
|
||||
float speed =
|
||||
SDL_sqrt(curr->xvel * curr->xvel + curr->yvel * curr->yvel);
|
||||
/* if wind resistance is not powerful enough to stop us completely,
|
||||
then apply winde resistance, otherwise just stop us completely */
|
||||
if (WIND_RESISTANCE * deltaMilliseconds < speed) {
|
||||
float normx = curr->xvel / speed;
|
||||
float normy = curr->yvel / speed;
|
||||
curr->xvel -=
|
||||
normx * WIND_RESISTANCE * deltaMilliseconds;
|
||||
curr->yvel -=
|
||||
normy * WIND_RESISTANCE * deltaMilliseconds;
|
||||
} else {
|
||||
curr->xvel = curr->yvel = 0; /* stop particle */
|
||||
}
|
||||
|
||||
if (curr->color[3] <= deltaMilliseconds * 0.1275f) {
|
||||
/* if this next step will cause us to fade out completely
|
||||
then just mark for deletion */
|
||||
curr->isActive = 0;
|
||||
} else {
|
||||
/* otherwise, let's fade a bit more */
|
||||
curr->color[3] -= deltaMilliseconds * 0.1275f;
|
||||
}
|
||||
|
||||
/* if we're a dust particle, shrink our size */
|
||||
if (curr->type == dust)
|
||||
curr->size -= deltaMilliseconds * 0.010f;
|
||||
|
||||
}
|
||||
|
||||
/* if we're still active, pack ourselves in the array next
|
||||
to the last active guy (pack the array tightly) */
|
||||
if (curr->isActive)
|
||||
*(slot++) = *curr;
|
||||
} /* endif (curr->isActive) */
|
||||
curr++;
|
||||
}
|
||||
/* the number of active particles is computed as the difference between
|
||||
old number of active particles, where slot points, and the
|
||||
new size of the array, where particles points */
|
||||
num_active_particles = (int) (slot - particles);
|
||||
}
|
||||
|
||||
/*
|
||||
This draws all the particles shown on screen
|
||||
*/
|
||||
void
|
||||
drawParticles()
|
||||
{
|
||||
|
||||
/* draw the background */
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* set up the position and color pointers */
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(struct particle), particles);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(struct particle),
|
||||
particles[0].color);
|
||||
|
||||
if (pointSizeExtensionSupported) {
|
||||
/* pass in our array of point sizes */
|
||||
glPointSizePointerOES(GL_FLOAT, sizeof(struct particle),
|
||||
&(particles[0].size));
|
||||
}
|
||||
|
||||
/* draw our particles! */
|
||||
glDrawArrays(GL_POINTS, 0, num_active_particles);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
This causes an emitter to explode in a circular bloom of dust particles
|
||||
*/
|
||||
void
|
||||
explodeEmitter(struct particle *emitter)
|
||||
{
|
||||
/* first off, we're done with this particle, so turn active off */
|
||||
emitter->isActive = 0;
|
||||
int i;
|
||||
for (i = 0; i < 200; i++) {
|
||||
|
||||
if (num_active_particles >= MAX_PARTICLES)
|
||||
return;
|
||||
|
||||
/* come up with a random angle and speed for new particle */
|
||||
float theta = randomFloat(0, 2.0f * 3.141592);
|
||||
float exponent = 3.0f;
|
||||
float speed = randomFloat(0.00, SDL_powf(0.17, exponent));
|
||||
speed = SDL_powf(speed, 1.0f / exponent);
|
||||
|
||||
/* select the particle at the end of our array */
|
||||
struct particle *p = &particles[num_active_particles];
|
||||
|
||||
/* set the particles properties */
|
||||
p->xvel = speed * SDL_cos(theta);
|
||||
p->yvel = speed * SDL_sin(theta);
|
||||
p->x = emitter->x + emitter->xvel;
|
||||
p->y = emitter->y + emitter->yvel;
|
||||
p->isActive = 1;
|
||||
p->type = dust;
|
||||
p->size = 15 * pointSizeScale;
|
||||
/* inherit emitter's color */
|
||||
p->color[0] = emitter->color[0];
|
||||
p->color[1] = emitter->color[1];
|
||||
p->color[2] = emitter->color[2];
|
||||
p->color[3] = 255;
|
||||
/* our array has expanded at the end */
|
||||
num_active_particles++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
This spawns a trail particle from an emitter
|
||||
*/
|
||||
void
|
||||
spawnTrailFromEmitter(struct particle *emitter)
|
||||
{
|
||||
|
||||
if (num_active_particles >= MAX_PARTICLES)
|
||||
return;
|
||||
|
||||
/* select the particle at the slot at the end of our array */
|
||||
struct particle *p = &particles[num_active_particles];
|
||||
|
||||
/* set position and velocity to roughly that of the emitter */
|
||||
p->x = emitter->x + randomFloat(-3.0, 3.0);
|
||||
p->y = emitter->y + emitter->size / 2.0f;
|
||||
p->xvel = emitter->xvel + randomFloat(-0.005, 0.005);
|
||||
p->yvel = emitter->yvel + 0.1;
|
||||
|
||||
/* set the color to a random-ish orangy type color */
|
||||
p->color[0] = (0.8f + randomFloat(-0.1, 0.0)) * 255;
|
||||
p->color[1] = (0.4f + randomFloat(-0.1, 0.1)) * 255;
|
||||
p->color[2] = (0.0f + randomFloat(0.0, 0.2)) * 255;
|
||||
p->color[3] = (0.7f) * 255;
|
||||
|
||||
/* set other attributes */
|
||||
p->size = 10 * pointSizeScale;
|
||||
p->type = trail;
|
||||
p->isActive = 1;
|
||||
|
||||
/* our array has expanded at the end */
|
||||
num_active_particles++;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
spawns a new emitter particle at the bottom of the screen
|
||||
destined for the point (x,y).
|
||||
*/
|
||||
void
|
||||
spawnEmitterParticle(GLfloat x, GLfloat y)
|
||||
{
|
||||
|
||||
if (num_active_particles >= MAX_PARTICLES)
|
||||
return;
|
||||
|
||||
/* find particle at endpoint of array */
|
||||
struct particle *p = &particles[num_active_particles];
|
||||
|
||||
/* set the color randomly */
|
||||
switch (rand() % 4) {
|
||||
case 0:
|
||||
p->color[0] = 255;
|
||||
p->color[1] = 100;
|
||||
p->color[2] = 100;
|
||||
break;
|
||||
case 1:
|
||||
p->color[0] = 100;
|
||||
p->color[1] = 255;
|
||||
p->color[2] = 100;
|
||||
break;
|
||||
case 2:
|
||||
p->color[0] = 100;
|
||||
p->color[1] = 100;
|
||||
p->color[2] = 255;
|
||||
break;
|
||||
case 3:
|
||||
p->color[0] = 255;
|
||||
p->color[1] = 150;
|
||||
p->color[2] = 50;
|
||||
break;
|
||||
}
|
||||
p->color[3] = 255;
|
||||
/* set position to (x, screen_h) */
|
||||
p->x = x;
|
||||
p->y = screen_h;
|
||||
/* set velocity so that terminal point is (x,y) */
|
||||
p->xvel = 0;
|
||||
p->yvel = -SDL_sqrt(2 * ACCEL * (screen_h - y));
|
||||
/* set other attributes */
|
||||
p->size = 10 * pointSizeScale;
|
||||
p->type = emitter;
|
||||
p->isActive = 1;
|
||||
/* our array has expanded at the end */
|
||||
num_active_particles++;
|
||||
}
|
||||
|
||||
/* just sets the endpoint of the particle array to element zero */
|
||||
void
|
||||
initializeParticles(void)
|
||||
{
|
||||
num_active_particles = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
loads the particle texture
|
||||
*/
|
||||
void
|
||||
initializeTexture()
|
||||
{
|
||||
|
||||
int bpp; /* texture bits per pixel */
|
||||
Uint32 Rmask, Gmask, Bmask, Amask; /* masks for pixel format passed into OpenGL */
|
||||
SDL_Surface *bmp_surface; /* the bmp is loaded here */
|
||||
SDL_Surface *bmp_surface_rgba8888; /* this serves as a destination to convert the BMP
|
||||
to format passed into OpenGL */
|
||||
|
||||
bmp_surface = SDL_LoadBMP("stroke.bmp");
|
||||
if (bmp_surface == NULL) {
|
||||
fatalError("could not load stroke.bmp");
|
||||
}
|
||||
|
||||
/* Grab info about format that will be passed into OpenGL */
|
||||
SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ABGR8888, &bpp, &Rmask, &Gmask,
|
||||
&Bmask, &Amask);
|
||||
/* Create surface that will hold pixels passed into OpenGL */
|
||||
bmp_surface_rgba8888 =
|
||||
SDL_CreateRGBSurface(0, bmp_surface->w, bmp_surface->h, bpp, Rmask,
|
||||
Gmask, Bmask, Amask);
|
||||
/* Blit to this surface, effectively converting the format */
|
||||
SDL_BlitSurface(bmp_surface, NULL, bmp_surface_rgba8888, NULL);
|
||||
|
||||
glGenTextures(1, &particleTextureID);
|
||||
glBindTexture(GL_TEXTURE_2D, particleTextureID);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
nextPowerOfTwo(bmp_surface->w),
|
||||
nextPowerOfTwo(bmp_surface->h),
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
/* this is where we actually pass in the pixel data */
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bmp_surface->w, bmp_surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, bmp_surface_rgba8888->pixels);
|
||||
|
||||
/* free bmp surface and converted bmp surface */
|
||||
SDL_FreeSurface(bmp_surface);
|
||||
SDL_FreeSurface(bmp_surface_rgba8888);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Window *window; /* main window */
|
||||
SDL_GLContext context;
|
||||
int drawableW, drawableH;
|
||||
int done; /* should we clean up and exit? */
|
||||
|
||||
/* initialize SDL */
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
fatalError("Could not initialize SDL");
|
||||
}
|
||||
/* seed the random number generator */
|
||||
srand(time(NULL));
|
||||
/*
|
||||
request some OpenGL parameters
|
||||
that may speed drawing
|
||||
*/
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
|
||||
/* create main window and renderer */
|
||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480,
|
||||
SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
context = SDL_GL_CreateContext(window);
|
||||
|
||||
/* The window size and drawable size may be different when highdpi is enabled,
|
||||
* due to the increased pixel density of the drawable. */
|
||||
SDL_GetWindowSize(window, &screen_w, &screen_h);
|
||||
SDL_GL_GetDrawableSize(window, &drawableW, &drawableH);
|
||||
|
||||
/* In OpenGL, point sizes are always in pixels. We don't want them looking
|
||||
* tiny on a retina screen. */
|
||||
pointSizeScale = (float) drawableH / (float) screen_h;
|
||||
|
||||
/* load the particle texture */
|
||||
initializeTexture();
|
||||
|
||||
/* check if GL_POINT_SIZE_ARRAY_OES is supported
|
||||
this is used to give each particle its own size
|
||||
*/
|
||||
pointSizeExtensionSupported =
|
||||
SDL_GL_ExtensionSupported("GL_OES_point_size_array");
|
||||
|
||||
/* set up some OpenGL state */
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glViewport(0, 0, drawableW, drawableH);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrthof((GLfloat) 0,
|
||||
(GLfloat) screen_w,
|
||||
(GLfloat) screen_h,
|
||||
(GLfloat) 0, 0.0, 1.0);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
glEnable(GL_POINT_SPRITE_OES);
|
||||
glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, 1);
|
||||
|
||||
if (pointSizeExtensionSupported) {
|
||||
/* we use this to set the sizes of all the particles */
|
||||
glEnableClientState(GL_POINT_SIZE_ARRAY_OES);
|
||||
} else {
|
||||
/* if extension not available then all particles have size 10 */
|
||||
glPointSize(10 * pointSizeScale);
|
||||
}
|
||||
|
||||
done = 0;
|
||||
/* enter main loop */
|
||||
while (!done) {
|
||||
SDL_Event event;
|
||||
double deltaTime = updateDeltaTime();
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
done = 1;
|
||||
}
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
spawnEmitterParticle(x, y);
|
||||
}
|
||||
}
|
||||
stepParticles(deltaTime);
|
||||
drawParticles();
|
||||
SDL_GL_SwapWindow(window);
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
/* delete textures */
|
||||
glDeleteTextures(1, &particleTextureID);
|
||||
/* shutdown SDL */
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* happy.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include "common.h"
|
||||
|
||||
#define NUM_HAPPY_FACES 100 /* number of faces to draw */
|
||||
#define HAPPY_FACE_SIZE 32 /* width and height of happyface */
|
||||
|
||||
static SDL_Texture *texture = 0; /* reference to texture holding happyface */
|
||||
|
||||
static struct
|
||||
{
|
||||
float x, y; /* position of happyface */
|
||||
float xvel, yvel; /* velocity of happyface */
|
||||
} faces[NUM_HAPPY_FACES];
|
||||
|
||||
/*
|
||||
Sets initial positions and velocities of happyfaces
|
||||
units of velocity are pixels per millesecond
|
||||
*/
|
||||
void
|
||||
initializeHappyFaces(SDL_Renderer *renderer)
|
||||
{
|
||||
int i;
|
||||
int w;
|
||||
int h;
|
||||
SDL_RenderGetLogicalSize(renderer, &w, &h);
|
||||
|
||||
for (i = 0; i < NUM_HAPPY_FACES; i++) {
|
||||
faces[i].x = randomFloat(0.0f, w - HAPPY_FACE_SIZE);
|
||||
faces[i].y = randomFloat(0.0f, h - HAPPY_FACE_SIZE);
|
||||
faces[i].xvel = randomFloat(-60.0f, 60.0f);
|
||||
faces[i].yvel = randomFloat(-60.0f, 60.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
render(SDL_Renderer *renderer, double deltaTime)
|
||||
{
|
||||
int i;
|
||||
SDL_Rect srcRect;
|
||||
SDL_Rect dstRect;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
SDL_RenderGetLogicalSize(renderer, &w, &h);
|
||||
|
||||
/* setup boundaries for happyface bouncing */
|
||||
int maxx = w - HAPPY_FACE_SIZE;
|
||||
int maxy = h - HAPPY_FACE_SIZE;
|
||||
int minx = 0;
|
||||
int miny = 0;
|
||||
|
||||
/* setup rects for drawing */
|
||||
srcRect.x = 0;
|
||||
srcRect.y = 0;
|
||||
srcRect.w = HAPPY_FACE_SIZE;
|
||||
srcRect.h = HAPPY_FACE_SIZE;
|
||||
dstRect.w = HAPPY_FACE_SIZE;
|
||||
dstRect.h = HAPPY_FACE_SIZE;
|
||||
|
||||
/* fill background in with black */
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
/*
|
||||
loop through all the happy faces:
|
||||
- update position
|
||||
- update velocity (if boundary is hit)
|
||||
- draw
|
||||
*/
|
||||
for (i = 0; i < NUM_HAPPY_FACES; i++) {
|
||||
faces[i].x += faces[i].xvel * deltaTime;
|
||||
faces[i].y += faces[i].yvel * deltaTime;
|
||||
if (faces[i].x > maxx) {
|
||||
faces[i].x = maxx;
|
||||
faces[i].xvel = -faces[i].xvel;
|
||||
} else if (faces[i].y > maxy) {
|
||||
faces[i].y = maxy;
|
||||
faces[i].yvel = -faces[i].yvel;
|
||||
}
|
||||
if (faces[i].x < minx) {
|
||||
faces[i].x = minx;
|
||||
faces[i].xvel = -faces[i].xvel;
|
||||
} else if (faces[i].y < miny) {
|
||||
faces[i].y = miny;
|
||||
faces[i].yvel = -faces[i].yvel;
|
||||
}
|
||||
dstRect.x = faces[i].x;
|
||||
dstRect.y = faces[i].y;
|
||||
SDL_RenderCopy(renderer, texture, &srcRect, &dstRect);
|
||||
}
|
||||
/* update screen */
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
loads the happyface graphic into a texture
|
||||
*/
|
||||
void
|
||||
initializeTexture(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_Surface *bmp_surface;
|
||||
/* load the bmp */
|
||||
bmp_surface = SDL_LoadBMP("icon.bmp");
|
||||
if (bmp_surface == NULL) {
|
||||
fatalError("could not load bmp");
|
||||
}
|
||||
/* set white to transparent on the happyface */
|
||||
SDL_SetColorKey(bmp_surface, 1,
|
||||
SDL_MapRGB(bmp_surface->format, 255, 255, 255));
|
||||
|
||||
/* convert RGBA surface to texture */
|
||||
texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
|
||||
if (texture == 0) {
|
||||
fatalError("could not create texture");
|
||||
}
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
|
||||
/* free up allocated memory */
|
||||
SDL_FreeSurface(bmp_surface);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
int done;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
/* initialize SDL */
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
fatalError("Could not initialize SDL");
|
||||
}
|
||||
|
||||
/* The specified window size doesn't matter - except for its aspect ratio,
|
||||
* which determines whether the window is in portrait or landscape on iOS
|
||||
* (if SDL_WINDOW_RESIZABLE isn't specified). */
|
||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
|
||||
SDL_GetWindowSize(window, &width, &height);
|
||||
SDL_RenderSetLogicalSize(renderer, width, height);
|
||||
|
||||
initializeTexture(renderer);
|
||||
initializeHappyFaces(renderer);
|
||||
|
||||
|
||||
/* main loop */
|
||||
done = 0;
|
||||
while (!done) {
|
||||
SDL_Event event;
|
||||
double deltaTime = updateDeltaTime();
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
render(renderer, deltaTime);
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
SDL_DestroyTexture(texture);
|
||||
/* shutdown SDL */
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -1,301 +0,0 @@
|
||||
/*
|
||||
* keyboard.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include "common.h"
|
||||
|
||||
#define TEST_INPUT_RECT
|
||||
|
||||
#define GLYPH_SIZE_IMAGE 16 /* size of glyphs (characters) in the bitmap font file */
|
||||
#define GLYPH_SIZE_SCREEN 32 /* size of glyphs (characters) as shown on the screen */
|
||||
|
||||
#define MAX_CHARS 1024
|
||||
|
||||
static SDL_Texture *texture; /* texture where we'll hold our font */
|
||||
|
||||
static SDL_Renderer *renderer;
|
||||
static int numChars = 0; /* number of characters we've typed so far */
|
||||
static SDL_Color bg_color = { 50, 50, 100, 255 }; /* color of background */
|
||||
|
||||
static int glyphs[MAX_CHARS];
|
||||
|
||||
/* this structure maps a scancode to an index in our bitmap font.
|
||||
it also contains data about under which modifiers the mapping is valid
|
||||
(for example, we don't want shift + 1 to produce the character '1',
|
||||
but rather the character '!')
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
SDL_Scancode scancode; /* scancode of the key we want to map */
|
||||
int allow_no_mod; /* is the map valid if the key has no modifiers? */
|
||||
SDL_Keymod mod; /* what modifiers are allowed for the mapping */
|
||||
int index; /* what index in the font does the scancode map to */
|
||||
} fontMapping;
|
||||
|
||||
#define TABLE_SIZE 51 /* size of our table which maps keys and modifiers to font indices */
|
||||
|
||||
/* Below is the table that defines the mapping between scancodes and modifiers to indices in the
|
||||
bitmap font. As an example, then line '{ SDL_SCANCODE_A, 1, KMOD_SHIFT, 33 }' means, map
|
||||
the key A (which has scancode SDL_SCANCODE_A) to index 33 in the font (which is a picture of an A),
|
||||
The '1' means that the mapping is valid even if there are no modifiers, and KMOD_SHIFT means the
|
||||
mapping is also valid if the user is holding shift.
|
||||
*/
|
||||
fontMapping map[TABLE_SIZE] = {
|
||||
|
||||
{SDL_SCANCODE_A, 1, KMOD_SHIFT, 33}, /* A */
|
||||
{SDL_SCANCODE_B, 1, KMOD_SHIFT, 34}, /* B */
|
||||
{SDL_SCANCODE_C, 1, KMOD_SHIFT, 35}, /* C */
|
||||
{SDL_SCANCODE_D, 1, KMOD_SHIFT, 36}, /* D */
|
||||
{SDL_SCANCODE_E, 1, KMOD_SHIFT, 37}, /* E */
|
||||
{SDL_SCANCODE_F, 1, KMOD_SHIFT, 38}, /* F */
|
||||
{SDL_SCANCODE_G, 1, KMOD_SHIFT, 39}, /* G */
|
||||
{SDL_SCANCODE_H, 1, KMOD_SHIFT, 40}, /* H */
|
||||
{SDL_SCANCODE_I, 1, KMOD_SHIFT, 41}, /* I */
|
||||
{SDL_SCANCODE_J, 1, KMOD_SHIFT, 42}, /* J */
|
||||
{SDL_SCANCODE_K, 1, KMOD_SHIFT, 43}, /* K */
|
||||
{SDL_SCANCODE_L, 1, KMOD_SHIFT, 44}, /* L */
|
||||
{SDL_SCANCODE_M, 1, KMOD_SHIFT, 45}, /* M */
|
||||
{SDL_SCANCODE_N, 1, KMOD_SHIFT, 46}, /* N */
|
||||
{SDL_SCANCODE_O, 1, KMOD_SHIFT, 47}, /* O */
|
||||
{SDL_SCANCODE_P, 1, KMOD_SHIFT, 48}, /* P */
|
||||
{SDL_SCANCODE_Q, 1, KMOD_SHIFT, 49}, /* Q */
|
||||
{SDL_SCANCODE_R, 1, KMOD_SHIFT, 50}, /* R */
|
||||
{SDL_SCANCODE_S, 1, KMOD_SHIFT, 51}, /* S */
|
||||
{SDL_SCANCODE_T, 1, KMOD_SHIFT, 52}, /* T */
|
||||
{SDL_SCANCODE_U, 1, KMOD_SHIFT, 53}, /* U */
|
||||
{SDL_SCANCODE_V, 1, KMOD_SHIFT, 54}, /* V */
|
||||
{SDL_SCANCODE_W, 1, KMOD_SHIFT, 55}, /* W */
|
||||
{SDL_SCANCODE_X, 1, KMOD_SHIFT, 56}, /* X */
|
||||
{SDL_SCANCODE_Y, 1, KMOD_SHIFT, 57}, /* Y */
|
||||
{SDL_SCANCODE_Z, 1, KMOD_SHIFT, 58}, /* Z */
|
||||
{SDL_SCANCODE_0, 1, 0, 16}, /* 0 */
|
||||
{SDL_SCANCODE_1, 1, 0, 17}, /* 1 */
|
||||
{SDL_SCANCODE_2, 1, 0, 18}, /* 2 */
|
||||
{SDL_SCANCODE_3, 1, 0, 19}, /* 3 */
|
||||
{SDL_SCANCODE_4, 1, 0, 20}, /* 4 */
|
||||
{SDL_SCANCODE_5, 1, 0, 21}, /* 5 */
|
||||
{SDL_SCANCODE_6, 1, 0, 22}, /* 6 */
|
||||
{SDL_SCANCODE_7, 1, 0, 23}, /* 7 */
|
||||
{SDL_SCANCODE_8, 1, 0, 24}, /* 8 */
|
||||
{SDL_SCANCODE_9, 1, 0, 25}, /* 9 */
|
||||
{SDL_SCANCODE_SPACE, 1, 0, 0}, /* ' ' */
|
||||
{SDL_SCANCODE_1, 0, KMOD_SHIFT, 1}, /* ! */
|
||||
{SDL_SCANCODE_SLASH, 0, KMOD_SHIFT, 31}, /* ? */
|
||||
{SDL_SCANCODE_SLASH, 1, 0, 15}, /* / */
|
||||
{SDL_SCANCODE_COMMA, 1, 0, 12}, /* , */
|
||||
{SDL_SCANCODE_SEMICOLON, 1, 0, 27}, /* ; */
|
||||
{SDL_SCANCODE_SEMICOLON, 0, KMOD_SHIFT, 26}, /* : */
|
||||
{SDL_SCANCODE_PERIOD, 1, 0, 14}, /* . */
|
||||
{SDL_SCANCODE_MINUS, 1, 0, 13}, /* - */
|
||||
{SDL_SCANCODE_EQUALS, 0, KMOD_SHIFT, 11}, /* = */
|
||||
{SDL_SCANCODE_APOSTROPHE, 1, 0, 7}, /* ' */
|
||||
{SDL_SCANCODE_APOSTROPHE, 0, KMOD_SHIFT, 2}, /* " */
|
||||
{SDL_SCANCODE_5, 0, KMOD_SHIFT, 5}, /* % */
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
This function maps an SDL_KeySym to an index in the bitmap font.
|
||||
It does so by scanning through the font mapping table one entry
|
||||
at a time.
|
||||
|
||||
If a match is found (scancode and allowed modifiers), the proper
|
||||
index is returned.
|
||||
|
||||
If there is no entry for the key, -1 is returned
|
||||
*/
|
||||
int
|
||||
keyToGlyphIndex(SDL_Keysym key)
|
||||
{
|
||||
int i, index = -1;
|
||||
for (i = 0; i < TABLE_SIZE; i++) {
|
||||
fontMapping compare = map[i];
|
||||
if (key.scancode == compare.scancode) {
|
||||
/* if this entry is valid with no key mod and we have no keymod, or if
|
||||
the key's modifiers are allowed modifiers for that mapping */
|
||||
if ((compare.allow_no_mod && key.mod == 0)
|
||||
|| (key.mod & compare.mod)) {
|
||||
index = compare.index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
/*
|
||||
This function returns and x,y position for a given character number.
|
||||
It is used for positioning each character of text
|
||||
*/
|
||||
void
|
||||
getPositionForCharNumber(int n, int *x, int *y)
|
||||
{
|
||||
int renderW, renderH;
|
||||
SDL_RenderGetLogicalSize(renderer, &renderW, &renderH);
|
||||
|
||||
int x_padding = 16; /* padding space on left and right side of screen */
|
||||
int y_padding = 32; /* padding space at top of screen */
|
||||
/* figure out the number of characters that can fit horizontally across the screen */
|
||||
int max_x_chars = (renderW - 2 * x_padding) / GLYPH_SIZE_SCREEN;
|
||||
int line_separation = 5; /* pixels between each line */
|
||||
*x = (n % max_x_chars) * GLYPH_SIZE_SCREEN + x_padding;
|
||||
#ifdef TEST_INPUT_RECT
|
||||
*y = renderH - GLYPH_SIZE_SCREEN;
|
||||
#else
|
||||
*y = (n / max_x_chars) * (GLYPH_SIZE_SCREEN + line_separation) + y_padding;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
drawGlyph(int glyph, int positionIndex)
|
||||
{
|
||||
int x, y;
|
||||
getPositionForCharNumber(positionIndex, &x, &y);
|
||||
SDL_Rect srcRect = { GLYPH_SIZE_IMAGE * glyph, 0, GLYPH_SIZE_IMAGE, GLYPH_SIZE_IMAGE };
|
||||
SDL_Rect dstRect = { x, y, GLYPH_SIZE_SCREEN, GLYPH_SIZE_SCREEN };
|
||||
SDL_RenderCopy(renderer, texture, &srcRect, &dstRect);
|
||||
}
|
||||
|
||||
/* this function loads our font into an SDL_Texture and returns the SDL_Texture */
|
||||
SDL_Texture*
|
||||
loadFont(void)
|
||||
{
|
||||
SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp");
|
||||
|
||||
if (!surface) {
|
||||
printf("Error loading bitmap: %s\n", SDL_GetError());
|
||||
return 0;
|
||||
} else {
|
||||
/* set the transparent color for the bitmap font (hot pink) */
|
||||
SDL_SetColorKey(surface, 1, SDL_MapRGB(surface->format, 238, 0, 252));
|
||||
/* now we convert the surface to our desired pixel format */
|
||||
int format = SDL_PIXELFORMAT_ABGR8888; /* desired texture format */
|
||||
Uint32 Rmask, Gmask, Bmask, Amask; /* masks for desired format */
|
||||
int bpp; /* bits per pixel for desired format */
|
||||
SDL_PixelFormatEnumToMasks(format, &bpp, &Rmask, &Gmask, &Bmask,
|
||||
&Amask);
|
||||
SDL_Surface *converted =
|
||||
SDL_CreateRGBSurface(0, surface->w, surface->h, bpp, Rmask, Gmask,
|
||||
Bmask, Amask);
|
||||
SDL_BlitSurface(surface, NULL, converted, NULL);
|
||||
/* create our texture */
|
||||
texture = SDL_CreateTextureFromSurface(renderer, converted);
|
||||
if (texture == 0) {
|
||||
printf("texture creation failed: %s\n", SDL_GetError());
|
||||
} else {
|
||||
/* set blend mode for our texture */
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_FreeSurface(converted);
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
draw()
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
for (int i = 0; i < numChars; i++) {
|
||||
drawGlyph(glyphs[i], i);
|
||||
}
|
||||
|
||||
drawGlyph(29, numChars); /* cursor is at index 29 in the bitmap font */
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Window *window;
|
||||
SDL_Event event; /* last event received */
|
||||
SDL_Scancode scancode; /* scancode of last key we pushed */
|
||||
int width;
|
||||
int height;
|
||||
int done;
|
||||
SDL_Rect textrect;
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
printf("Error initializing SDL: %s", SDL_GetError());
|
||||
}
|
||||
/* create window */
|
||||
window = SDL_CreateWindow("iOS keyboard test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
/* create renderer */
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC);
|
||||
|
||||
SDL_GetWindowSize(window, &width, &height);
|
||||
SDL_RenderSetLogicalSize(renderer, width, height);
|
||||
|
||||
/* load up our font */
|
||||
loadFont();
|
||||
|
||||
/* Show onscreen keyboard */
|
||||
#ifdef TEST_INPUT_RECT
|
||||
textrect.x = 0;
|
||||
textrect.y = height - GLYPH_SIZE_IMAGE;
|
||||
textrect.w = width;
|
||||
textrect.h = GLYPH_SIZE_IMAGE;
|
||||
SDL_SetTextInputRect(&textrect);
|
||||
#endif
|
||||
SDL_StartTextInput();
|
||||
|
||||
done = 0;
|
||||
while (!done) {
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
case SDL_WINDOWEVENT:
|
||||
if (event.window.event == SDL_WINDOWEVENT_RESIZED) {
|
||||
width = event.window.data1;
|
||||
height = event.window.data2;
|
||||
SDL_RenderSetLogicalSize(renderer, width, height);
|
||||
#ifdef TEST_INPUT_RECT
|
||||
textrect.x = 0;
|
||||
textrect.y = height - GLYPH_SIZE_IMAGE;
|
||||
textrect.w = width;
|
||||
textrect.h = GLYPH_SIZE_IMAGE;
|
||||
SDL_SetTextInputRect(&textrect);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_BACKSPACE) {
|
||||
if (numChars > 0) {
|
||||
numChars--;
|
||||
}
|
||||
} else if (numChars + 1 < MAX_CHARS) {
|
||||
int index = keyToGlyphIndex(event.key.keysym);
|
||||
if (index >= 0) {
|
||||
glyphs[numChars++] = index;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
/* mouse up toggles onscreen keyboard visibility */
|
||||
if (SDL_IsTextInputActive()) {
|
||||
SDL_StopTextInput();
|
||||
} else {
|
||||
SDL_StartTextInput();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
draw();
|
||||
SDL_Delay(15);
|
||||
}
|
||||
|
||||
SDL_DestroyTexture(texture);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,344 +0,0 @@
|
||||
/*
|
||||
* mixer.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include "common.h"
|
||||
|
||||
#define NUM_CHANNELS 8 /* max number of sounds we can play at once */
|
||||
#define NUM_DRUMS 4 /* number of drums in our set */
|
||||
|
||||
static struct
|
||||
{
|
||||
SDL_Rect rect; /* where the button is drawn */
|
||||
SDL_Color upColor; /* color when button is not active */
|
||||
SDL_Color downColor; /* color when button is active */
|
||||
int isPressed; /* is the button being pressed ? */
|
||||
int touchIndex; /* what mouse (touch) index pressed the button ? */
|
||||
} buttons[NUM_DRUMS];
|
||||
|
||||
struct sound
|
||||
{
|
||||
Uint8 *buffer; /* audio buffer for sound file */
|
||||
Uint32 length; /* length of the buffer (in bytes) */
|
||||
};
|
||||
|
||||
/* this array holds the audio for the drum noises */
|
||||
static struct sound drums[NUM_DRUMS];
|
||||
|
||||
/* function declarations */
|
||||
void handleMouseButtonDown(SDL_Event * event);
|
||||
void handleMouseButtonUp(SDL_Event * event);
|
||||
int playSound(struct sound *);
|
||||
void initializeButtons(SDL_Renderer *);
|
||||
void audioCallback(void *userdata, Uint8 * stream, int len);
|
||||
void loadSound(const char *file, struct sound *s);
|
||||
|
||||
struct
|
||||
{
|
||||
/* channel array holds information about currently playing sounds */
|
||||
struct
|
||||
{
|
||||
Uint8 *position; /* what is the current position in the buffer of this sound ? */
|
||||
Uint32 remaining; /* how many bytes remaining before we're done playing the sound ? */
|
||||
Uint32 timestamp; /* when did this sound start playing ? */
|
||||
} channels[NUM_CHANNELS];
|
||||
SDL_AudioSpec outputSpec; /* what audio format are we using for output? */
|
||||
int numSoundsPlaying; /* how many sounds are currently playing */
|
||||
} mixer;
|
||||
|
||||
/* sets up the buttons (color, position, state) */
|
||||
void
|
||||
initializeButtons(SDL_Renderer *renderer)
|
||||
{
|
||||
int i;
|
||||
int spacing = 10; /* gap between drum buttons */
|
||||
SDL_Rect buttonRect; /* keeps track of where to position drum */
|
||||
SDL_Color upColor = { 86, 86, 140, 255 }; /* color of drum when not pressed */
|
||||
SDL_Color downColor = { 191, 191, 221, 255 }; /* color of drum when pressed */
|
||||
int renderW, renderH;
|
||||
|
||||
SDL_RenderGetLogicalSize(renderer, &renderW, &renderH);
|
||||
|
||||
buttonRect.x = spacing;
|
||||
buttonRect.y = spacing;
|
||||
buttonRect.w = renderW - 2 * spacing;
|
||||
buttonRect.h = (renderH - (NUM_DRUMS + 1) * spacing) / NUM_DRUMS;
|
||||
|
||||
/* setup each button */
|
||||
for (i = 0; i < NUM_DRUMS; i++) {
|
||||
|
||||
buttons[i].rect = buttonRect;
|
||||
buttons[i].isPressed = 0;
|
||||
buttons[i].upColor = upColor;
|
||||
buttons[i].downColor = downColor;
|
||||
|
||||
buttonRect.y += spacing + buttonRect.h; /* setup y coordinate for next drum */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
loads a wav file (stored in 'file'), converts it to the mixer's output format,
|
||||
and stores the resulting buffer and length in the sound structure
|
||||
*/
|
||||
void
|
||||
loadSound(const char *file, struct sound *s)
|
||||
{
|
||||
SDL_AudioSpec spec; /* the audio format of the .wav file */
|
||||
SDL_AudioCVT cvt; /* used to convert .wav to output format when formats differ */
|
||||
int result;
|
||||
if (SDL_LoadWAV(file, &spec, &s->buffer, &s->length) == NULL) {
|
||||
fatalError("could not load .wav");
|
||||
}
|
||||
/* build the audio converter */
|
||||
result = SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq,
|
||||
mixer.outputSpec.format,
|
||||
mixer.outputSpec.channels,
|
||||
mixer.outputSpec.freq);
|
||||
if (result == -1) {
|
||||
fatalError("could not build audio CVT");
|
||||
} else if (result != 0) {
|
||||
/*
|
||||
this happens when the .wav format differs from the output format.
|
||||
we convert the .wav buffer here
|
||||
*/
|
||||
cvt.buf = (Uint8 *) SDL_malloc(s->length * cvt.len_mult); /* allocate conversion buffer */
|
||||
cvt.len = s->length; /* set conversion buffer length */
|
||||
SDL_memcpy(cvt.buf, s->buffer, s->length); /* copy sound to conversion buffer */
|
||||
if (SDL_ConvertAudio(&cvt) == -1) { /* convert the sound */
|
||||
fatalError("could not convert .wav");
|
||||
}
|
||||
SDL_free(s->buffer); /* Free the original (unconverted) buffer */
|
||||
s->buffer = cvt.buf; /* point sound buffer to converted buffer */
|
||||
s->length = cvt.len_cvt; /* set sound buffer's new length */
|
||||
}
|
||||
}
|
||||
|
||||
/* called from main event loop */
|
||||
void
|
||||
handleMouseButtonDown(SDL_Event * event)
|
||||
{
|
||||
|
||||
int x, y, mouseIndex, i, drumIndex;
|
||||
|
||||
mouseIndex = 0;
|
||||
drumIndex = -1;
|
||||
|
||||
SDL_GetMouseState(&x, &y);
|
||||
/* check if we hit any of the drum buttons */
|
||||
for (i = 0; i < NUM_DRUMS; i++) {
|
||||
if (x >= buttons[i].rect.x
|
||||
&& x < buttons[i].rect.x + buttons[i].rect.w
|
||||
&& y >= buttons[i].rect.y
|
||||
&& y < buttons[i].rect.y + buttons[i].rect.h) {
|
||||
drumIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (drumIndex != -1) {
|
||||
/* if we hit a button */
|
||||
buttons[drumIndex].touchIndex = mouseIndex;
|
||||
buttons[drumIndex].isPressed = 1;
|
||||
playSound(&drums[drumIndex]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* called from main event loop */
|
||||
void
|
||||
handleMouseButtonUp(SDL_Event * event)
|
||||
{
|
||||
int i;
|
||||
int mouseIndex = 0;
|
||||
/* check if this should cause any of the buttons to become unpressed */
|
||||
for (i = 0; i < NUM_DRUMS; i++) {
|
||||
if (buttons[i].touchIndex == mouseIndex) {
|
||||
buttons[i].isPressed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* draws buttons to screen */
|
||||
void
|
||||
render(SDL_Renderer *renderer)
|
||||
{
|
||||
int i;
|
||||
SDL_SetRenderDrawColor(renderer, 50, 50, 50, 255);
|
||||
SDL_RenderClear(renderer); /* draw background (gray) */
|
||||
/* draw the drum buttons */
|
||||
for (i = 0; i < NUM_DRUMS; i++) {
|
||||
SDL_Color color =
|
||||
buttons[i].isPressed ? buttons[i].downColor : buttons[i].upColor;
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, color.a);
|
||||
SDL_RenderFillRect(renderer, &buttons[i].rect);
|
||||
}
|
||||
/* update the screen */
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
/*
|
||||
finds a sound channel in the mixer for a sound
|
||||
and sets it up to start playing
|
||||
*/
|
||||
int
|
||||
playSound(struct sound *s)
|
||||
{
|
||||
/*
|
||||
find an empty channel to play on.
|
||||
if no channel is available, use oldest channel
|
||||
*/
|
||||
int i;
|
||||
int selected_channel = -1;
|
||||
int oldest_channel = 0;
|
||||
|
||||
if (mixer.numSoundsPlaying == 0) {
|
||||
/* we're playing a sound now, so start audio callback back up */
|
||||
SDL_PauseAudio(0);
|
||||
}
|
||||
|
||||
/* find a sound channel to play the sound on */
|
||||
for (i = 0; i < NUM_CHANNELS; i++) {
|
||||
if (mixer.channels[i].position == NULL) {
|
||||
/* if no sound on this channel, select it */
|
||||
selected_channel = i;
|
||||
break;
|
||||
}
|
||||
/* if this channel's sound is older than the oldest so far, set it to oldest */
|
||||
if (mixer.channels[i].timestamp <
|
||||
mixer.channels[oldest_channel].timestamp)
|
||||
oldest_channel = i;
|
||||
}
|
||||
|
||||
/* no empty channels, take the oldest one */
|
||||
if (selected_channel == -1)
|
||||
selected_channel = oldest_channel;
|
||||
else
|
||||
mixer.numSoundsPlaying++;
|
||||
|
||||
/* point channel data to wav data */
|
||||
mixer.channels[selected_channel].position = s->buffer;
|
||||
mixer.channels[selected_channel].remaining = s->length;
|
||||
mixer.channels[selected_channel].timestamp = SDL_GetTicks();
|
||||
|
||||
return selected_channel;
|
||||
}
|
||||
|
||||
/*
|
||||
Called from SDL's audio system. Supplies sound input with data by mixing together all
|
||||
currently playing sound effects.
|
||||
*/
|
||||
void
|
||||
audioCallback(void *userdata, Uint8 * stream, int len)
|
||||
{
|
||||
int i;
|
||||
int copy_amt;
|
||||
SDL_memset(stream, mixer.outputSpec.silence, len); /* initialize buffer to silence */
|
||||
/* for each channel, mix in whatever is playing on that channel */
|
||||
for (i = 0; i < NUM_CHANNELS; i++) {
|
||||
if (mixer.channels[i].position == NULL) {
|
||||
/* if no sound is playing on this channel */
|
||||
continue; /* nothing to do for this channel */
|
||||
}
|
||||
|
||||
/* copy len bytes to the buffer, unless we have fewer than len bytes remaining */
|
||||
copy_amt =
|
||||
mixer.channels[i].remaining <
|
||||
len ? mixer.channels[i].remaining : len;
|
||||
|
||||
/* mix this sound effect with the output */
|
||||
SDL_MixAudioFormat(stream, mixer.channels[i].position,
|
||||
mixer.outputSpec.format, copy_amt, SDL_MIX_MAXVOLUME);
|
||||
|
||||
/* update buffer position in sound effect and the number of bytes left */
|
||||
mixer.channels[i].position += copy_amt;
|
||||
mixer.channels[i].remaining -= copy_amt;
|
||||
|
||||
/* did we finish playing the sound effect ? */
|
||||
if (mixer.channels[i].remaining == 0) {
|
||||
mixer.channels[i].position = NULL; /* indicates no sound playing on channel anymore */
|
||||
mixer.numSoundsPlaying--;
|
||||
if (mixer.numSoundsPlaying == 0) {
|
||||
/* if no sounds left playing, pause audio callback */
|
||||
SDL_PauseAudio(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int done; /* has user tried to quit ? */
|
||||
SDL_Window *window; /* main window */
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Event event;
|
||||
int i;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
||||
fatalError("could not initialize SDL");
|
||||
}
|
||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
renderer = SDL_CreateRenderer(window, 0, 0);
|
||||
|
||||
SDL_GetWindowSize(window, &width, &height);
|
||||
SDL_RenderSetLogicalSize(renderer, width, height);
|
||||
|
||||
/* initialize the mixer */
|
||||
SDL_memset(&mixer, 0, sizeof(mixer));
|
||||
/* setup output format */
|
||||
mixer.outputSpec.freq = 44100;
|
||||
mixer.outputSpec.format = AUDIO_S16LSB;
|
||||
mixer.outputSpec.channels = 2;
|
||||
mixer.outputSpec.samples = 256;
|
||||
mixer.outputSpec.callback = audioCallback;
|
||||
mixer.outputSpec.userdata = NULL;
|
||||
|
||||
/* open audio for output */
|
||||
if (SDL_OpenAudio(&mixer.outputSpec, NULL) != 0) {
|
||||
fatalError("Opening audio failed");
|
||||
}
|
||||
|
||||
/* load our drum noises */
|
||||
loadSound("ds_kick_big_amb.wav", &drums[3]);
|
||||
loadSound("ds_brush_snare.wav", &drums[2]);
|
||||
loadSound("ds_loose_skin_mute.wav", &drums[1]);
|
||||
loadSound("ds_china.wav", &drums[0]);
|
||||
|
||||
/* setup positions, colors, and state of buttons */
|
||||
initializeButtons(renderer);
|
||||
|
||||
/* enter main loop */
|
||||
done = 0;
|
||||
while (!done) {
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
handleMouseButtonDown(&event);
|
||||
break;
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
handleMouseButtonUp(&event);
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
render(renderer); /* draw buttons */
|
||||
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
/* cleanup code, let's free up those sound buffers */
|
||||
for (i = 0; i < NUM_DRUMS; i++) {
|
||||
SDL_free(drums[i].buffer);
|
||||
}
|
||||
/* let SDL do its exit code */
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* rectangles.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include <time.h>
|
||||
#include "common.h"
|
||||
|
||||
void
|
||||
render(SDL_Renderer *renderer)
|
||||
{
|
||||
Uint8 r, g, b;
|
||||
int renderW;
|
||||
int renderH;
|
||||
|
||||
SDL_RenderGetLogicalSize(renderer, &renderW, &renderH);
|
||||
|
||||
/* Come up with a random rectangle */
|
||||
SDL_Rect rect;
|
||||
rect.w = randomInt(64, 128);
|
||||
rect.h = randomInt(64, 128);
|
||||
rect.x = randomInt(0, renderW);
|
||||
rect.y = randomInt(0, renderH);
|
||||
|
||||
/* Come up with a random color */
|
||||
r = randomInt(50, 255);
|
||||
g = randomInt(50, 255);
|
||||
b = randomInt(50, 255);
|
||||
|
||||
/* Fill the rectangle in the color */
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, 255);
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
/* update screen */
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
int done;
|
||||
SDL_Event event;
|
||||
int windowW;
|
||||
int windowH;
|
||||
|
||||
/* initialize SDL */
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
fatalError("Could not initialize SDL");
|
||||
}
|
||||
|
||||
/* seed random number generator */
|
||||
srand(time(NULL));
|
||||
|
||||
/* create window and renderer */
|
||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
if (window == 0) {
|
||||
fatalError("Could not initialize Window");
|
||||
}
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
if (!renderer) {
|
||||
fatalError("Could not create renderer");
|
||||
}
|
||||
|
||||
SDL_GetWindowSize(window, &windowW, &windowH);
|
||||
SDL_RenderSetLogicalSize(renderer, windowW, windowH);
|
||||
|
||||
/* Fill screen with black */
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
/* Enter render loop, waiting for user to quit */
|
||||
done = 0;
|
||||
while (!done) {
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
render(renderer);
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
/* shutdown SDL */
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* touch.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include <math.h>
|
||||
#include "common.h"
|
||||
|
||||
#define BRUSH_SIZE 32 /* width and height of the brush */
|
||||
#define PIXELS_PER_ITERATION 5 /* number of pixels between brush blots when forming a line */
|
||||
|
||||
static SDL_Texture *brush = 0; /* texture for the brush */
|
||||
|
||||
/*
|
||||
draws a line from (startx, starty) to (startx + dx, starty + dy)
|
||||
this is accomplished by drawing several blots spaced PIXELS_PER_ITERATION apart
|
||||
*/
|
||||
void
|
||||
drawLine(SDL_Renderer *renderer, float startx, float starty, float dx, float dy)
|
||||
{
|
||||
|
||||
float distance = SDL_sqrt(dx * dx + dy * dy); /* length of line segment (pythagoras) */
|
||||
int iterations = distance / PIXELS_PER_ITERATION + 1; /* number of brush sprites to draw for the line */
|
||||
float dx_prime = dx / iterations; /* x-shift per iteration */
|
||||
float dy_prime = dy / iterations; /* y-shift per iteration */
|
||||
SDL_Rect dstRect; /* rect to draw brush sprite into */
|
||||
float x;
|
||||
float y;
|
||||
int i;
|
||||
|
||||
dstRect.w = BRUSH_SIZE;
|
||||
dstRect.h = BRUSH_SIZE;
|
||||
|
||||
/* setup x and y for the location of the first sprite */
|
||||
x = startx - BRUSH_SIZE / 2.0f;
|
||||
y = starty - BRUSH_SIZE / 2.0f;
|
||||
|
||||
/* draw a series of blots to form the line */
|
||||
for (i = 0; i < iterations; i++) {
|
||||
dstRect.x = x;
|
||||
dstRect.y = y;
|
||||
/* shift x and y for next sprite location */
|
||||
x += dx_prime;
|
||||
y += dy_prime;
|
||||
/* draw brush blot */
|
||||
SDL_RenderCopy(renderer, brush, NULL, &dstRect);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
loads the brush texture
|
||||
*/
|
||||
void
|
||||
initializeTexture(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_Surface *bmp_surface;
|
||||
bmp_surface = SDL_LoadBMP("stroke.bmp");
|
||||
if (bmp_surface == NULL) {
|
||||
fatalError("could not load stroke.bmp");
|
||||
}
|
||||
brush =
|
||||
SDL_CreateTextureFromSurface(renderer, bmp_surface);
|
||||
SDL_FreeSurface(bmp_surface);
|
||||
if (brush == 0) {
|
||||
fatalError("could not create brush texture");
|
||||
}
|
||||
/* additive blending -- laying strokes on top of eachother makes them brighter */
|
||||
SDL_SetTextureBlendMode(brush, SDL_BLENDMODE_ADD);
|
||||
/* set brush color (red) */
|
||||
SDL_SetTextureColorMod(brush, 255, 100, 100);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
int x, y, dx, dy; /* mouse location */
|
||||
Uint8 state; /* mouse (touch) state */
|
||||
SDL_Event event;
|
||||
SDL_Window *window; /* main window */
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Texture *target;
|
||||
int done; /* does user want to quit? */
|
||||
int w, h;
|
||||
|
||||
/* initialize SDL */
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
fatalError("Could not initialize SDL");
|
||||
}
|
||||
|
||||
/* create main window and renderer */
|
||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
renderer = SDL_CreateRenderer(window, 0, 0);
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_RenderSetLogicalSize(renderer, w, h);
|
||||
|
||||
/* load brush texture */
|
||||
initializeTexture(renderer);
|
||||
|
||||
/* fill canvass initially with all black */
|
||||
target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, w, h);
|
||||
SDL_SetRenderTarget(renderer, target);
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_SetRenderTarget(renderer, NULL);
|
||||
|
||||
done = 0;
|
||||
while (!done) {
|
||||
while (SDL_PollEvent(&event) == 1) {
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
state = SDL_GetMouseState(&x, &y); /* get its location */
|
||||
SDL_GetRelativeMouseState(&dx, &dy); /* find how much the mouse moved */
|
||||
if (state & SDL_BUTTON_LMASK) { /* is the mouse (touch) down? */
|
||||
SDL_SetRenderTarget(renderer, target);
|
||||
drawLine(renderer, x - dx, y - dy, dx, dy); /* draw line segment */
|
||||
SDL_SetRenderTarget(renderer, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_RenderCopy(renderer, target, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
SDL_DestroyTexture(brush);
|
||||
SDL_DestroyTexture(target);
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,422 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
AA1EE462176059AB0029C7A5 /* SDL_test_common.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE454176059AB0029C7A5 /* SDL_test_common.c */; };
|
||||
AA1EE463176059AB0029C7A5 /* SDL_test_compare.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE455176059AB0029C7A5 /* SDL_test_compare.c */; };
|
||||
AA1EE464176059AB0029C7A5 /* SDL_test_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE456176059AB0029C7A5 /* SDL_test_crc32.c */; };
|
||||
AA1EE465176059AB0029C7A5 /* SDL_test_font.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE457176059AB0029C7A5 /* SDL_test_font.c */; };
|
||||
AA1EE466176059AB0029C7A5 /* SDL_test_fuzzer.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE458176059AB0029C7A5 /* SDL_test_fuzzer.c */; };
|
||||
AA1EE467176059AB0029C7A5 /* SDL_test_harness.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE459176059AB0029C7A5 /* SDL_test_harness.c */; };
|
||||
AA1EE468176059AB0029C7A5 /* SDL_test_imageBlit.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45A176059AB0029C7A5 /* SDL_test_imageBlit.c */; };
|
||||
AA1EE469176059AB0029C7A5 /* SDL_test_imageBlitBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45B176059AB0029C7A5 /* SDL_test_imageBlitBlend.c */; };
|
||||
AA1EE46A176059AB0029C7A5 /* SDL_test_imageFace.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45C176059AB0029C7A5 /* SDL_test_imageFace.c */; };
|
||||
AA1EE46B176059AB0029C7A5 /* SDL_test_imagePrimitives.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45D176059AB0029C7A5 /* SDL_test_imagePrimitives.c */; };
|
||||
AA1EE46C176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45E176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c */; };
|
||||
AA1EE46D176059AB0029C7A5 /* SDL_test_log.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */; };
|
||||
AA1EE46E176059AB0029C7A5 /* SDL_test_md5.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */; };
|
||||
AA1EE46F176059AB0029C7A5 /* SDL_test_random.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE461176059AB0029C7A5 /* SDL_test_random.c */; };
|
||||
AAF030011F9009B100B9A9FB /* SDL_test_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = AAF02FFF1F9009B100B9A9FB /* SDL_test_memory.c */; };
|
||||
AAF030021F9009B100B9A9FB /* SDL_test_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = AAF030001F9009B100B9A9FB /* SDL_test_assert.c */; };
|
||||
FA3D99011BC4E5BC002C96C8 /* SDL_test_common.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE454176059AB0029C7A5 /* SDL_test_common.c */; };
|
||||
FA3D99021BC4E5BC002C96C8 /* SDL_test_compare.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE455176059AB0029C7A5 /* SDL_test_compare.c */; };
|
||||
FA3D99031BC4E5BC002C96C8 /* SDL_test_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE456176059AB0029C7A5 /* SDL_test_crc32.c */; };
|
||||
FA3D99041BC4E5BC002C96C8 /* SDL_test_font.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE457176059AB0029C7A5 /* SDL_test_font.c */; };
|
||||
FA3D99051BC4E5BC002C96C8 /* SDL_test_fuzzer.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE458176059AB0029C7A5 /* SDL_test_fuzzer.c */; };
|
||||
FA3D99061BC4E5BC002C96C8 /* SDL_test_harness.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE459176059AB0029C7A5 /* SDL_test_harness.c */; };
|
||||
FA3D99071BC4E5BC002C96C8 /* SDL_test_imageBlit.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45A176059AB0029C7A5 /* SDL_test_imageBlit.c */; };
|
||||
FA3D99081BC4E5BC002C96C8 /* SDL_test_imageBlitBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45B176059AB0029C7A5 /* SDL_test_imageBlitBlend.c */; };
|
||||
FA3D99091BC4E5BC002C96C8 /* SDL_test_imageFace.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45C176059AB0029C7A5 /* SDL_test_imageFace.c */; };
|
||||
FA3D990A1BC4E5BC002C96C8 /* SDL_test_imagePrimitives.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45D176059AB0029C7A5 /* SDL_test_imagePrimitives.c */; };
|
||||
FA3D990B1BC4E5BC002C96C8 /* SDL_test_imagePrimitivesBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45E176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c */; };
|
||||
FA3D990C1BC4E5BC002C96C8 /* SDL_test_log.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */; };
|
||||
FA3D990D1BC4E5BC002C96C8 /* SDL_test_md5.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */; };
|
||||
FA3D990E1BC4E5BC002C96C8 /* SDL_test_random.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE461176059AB0029C7A5 /* SDL_test_random.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
FA3D98F61BC4E5A2002C96C8 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
AA1EE4461760589B0029C7A5 /* libSDL2test.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2test.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
AA1EE454176059AB0029C7A5 /* SDL_test_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_common.c; sourceTree = "<group>"; };
|
||||
AA1EE455176059AB0029C7A5 /* SDL_test_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_compare.c; sourceTree = "<group>"; };
|
||||
AA1EE456176059AB0029C7A5 /* SDL_test_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_crc32.c; sourceTree = "<group>"; };
|
||||
AA1EE457176059AB0029C7A5 /* SDL_test_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_font.c; sourceTree = "<group>"; };
|
||||
AA1EE458176059AB0029C7A5 /* SDL_test_fuzzer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_fuzzer.c; sourceTree = "<group>"; };
|
||||
AA1EE459176059AB0029C7A5 /* SDL_test_harness.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_harness.c; sourceTree = "<group>"; };
|
||||
AA1EE45A176059AB0029C7A5 /* SDL_test_imageBlit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageBlit.c; sourceTree = "<group>"; };
|
||||
AA1EE45B176059AB0029C7A5 /* SDL_test_imageBlitBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageBlitBlend.c; sourceTree = "<group>"; };
|
||||
AA1EE45C176059AB0029C7A5 /* SDL_test_imageFace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageFace.c; sourceTree = "<group>"; };
|
||||
AA1EE45D176059AB0029C7A5 /* SDL_test_imagePrimitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imagePrimitives.c; sourceTree = "<group>"; };
|
||||
AA1EE45E176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imagePrimitivesBlend.c; sourceTree = "<group>"; };
|
||||
AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_log.c; sourceTree = "<group>"; };
|
||||
AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_md5.c; sourceTree = "<group>"; };
|
||||
AA1EE461176059AB0029C7A5 /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_random.c; sourceTree = "<group>"; };
|
||||
AAF02FFF1F9009B100B9A9FB /* SDL_test_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_memory.c; sourceTree = "<group>"; };
|
||||
AAF030001F9009B100B9A9FB /* SDL_test_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_assert.c; sourceTree = "<group>"; };
|
||||
FA3D98F81BC4E5A2002C96C8 /* libSDL2test-TV.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libSDL2test-TV.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
AA1EE4431760589B0029C7A5 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FA3D98F51BC4E5A2002C96C8 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
AA1EE43D1760589B0029C7A5 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA1EE453176059770029C7A5 /* Library Source */,
|
||||
AA1EE4471760589B0029C7A5 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA1EE4471760589B0029C7A5 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA1EE4461760589B0029C7A5 /* libSDL2test.a */,
|
||||
FA3D98F81BC4E5A2002C96C8 /* libSDL2test-TV.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA1EE453176059770029C7A5 /* Library Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AAF030001F9009B100B9A9FB /* SDL_test_assert.c */,
|
||||
AA1EE454176059AB0029C7A5 /* SDL_test_common.c */,
|
||||
AA1EE455176059AB0029C7A5 /* SDL_test_compare.c */,
|
||||
AA1EE456176059AB0029C7A5 /* SDL_test_crc32.c */,
|
||||
AA1EE457176059AB0029C7A5 /* SDL_test_font.c */,
|
||||
AA1EE458176059AB0029C7A5 /* SDL_test_fuzzer.c */,
|
||||
AA1EE459176059AB0029C7A5 /* SDL_test_harness.c */,
|
||||
AA1EE45A176059AB0029C7A5 /* SDL_test_imageBlit.c */,
|
||||
AA1EE45B176059AB0029C7A5 /* SDL_test_imageBlitBlend.c */,
|
||||
AA1EE45C176059AB0029C7A5 /* SDL_test_imageFace.c */,
|
||||
AA1EE45D176059AB0029C7A5 /* SDL_test_imagePrimitives.c */,
|
||||
AA1EE45E176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c */,
|
||||
AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */,
|
||||
AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */,
|
||||
AAF02FFF1F9009B100B9A9FB /* SDL_test_memory.c */,
|
||||
AA1EE461176059AB0029C7A5 /* SDL_test_random.c */,
|
||||
);
|
||||
name = "Library Source";
|
||||
path = ../../src/test;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
AA1EE4441760589B0029C7A5 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
AA1EE4451760589B0029C7A5 /* SDL2test */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = AA1EE44A1760589B0029C7A5 /* Build configuration list for PBXNativeTarget "SDL2test" */;
|
||||
buildPhases = (
|
||||
AA1EE4421760589B0029C7A5 /* Sources */,
|
||||
AA1EE4431760589B0029C7A5 /* Frameworks */,
|
||||
AA1EE4441760589B0029C7A5 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = SDL2test;
|
||||
productName = SDL2test;
|
||||
productReference = AA1EE4461760589B0029C7A5 /* libSDL2test.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
FA3D98F71BC4E5A2002C96C8 /* SDL2test-TV */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = FA3D99001BC4E5A3002C96C8 /* Build configuration list for PBXNativeTarget "SDL2test-TV" */;
|
||||
buildPhases = (
|
||||
FA3D98F41BC4E5A2002C96C8 /* Sources */,
|
||||
FA3D98F51BC4E5A2002C96C8 /* Frameworks */,
|
||||
FA3D98F61BC4E5A2002C96C8 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SDL2test-TV";
|
||||
productName = "SDL2test-TV";
|
||||
productReference = FA3D98F81BC4E5A2002C96C8 /* libSDL2test-TV.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
AA1EE43E1760589B0029C7A5 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0460;
|
||||
ORGANIZATIONNAME = "Sam Lantinga";
|
||||
TargetAttributes = {
|
||||
FA3D98F71BC4E5A2002C96C8 = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = AA1EE4411760589B0029C7A5 /* Build configuration list for PBXProject "SDL2test" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = AA1EE43D1760589B0029C7A5;
|
||||
productRefGroup = AA1EE4471760589B0029C7A5 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
AA1EE4451760589B0029C7A5 /* SDL2test */,
|
||||
FA3D98F71BC4E5A2002C96C8 /* SDL2test-TV */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
AA1EE4421760589B0029C7A5 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA1EE462176059AB0029C7A5 /* SDL_test_common.c in Sources */,
|
||||
AA1EE463176059AB0029C7A5 /* SDL_test_compare.c in Sources */,
|
||||
AA1EE464176059AB0029C7A5 /* SDL_test_crc32.c in Sources */,
|
||||
AA1EE465176059AB0029C7A5 /* SDL_test_font.c in Sources */,
|
||||
AA1EE466176059AB0029C7A5 /* SDL_test_fuzzer.c in Sources */,
|
||||
AAF030021F9009B100B9A9FB /* SDL_test_assert.c in Sources */,
|
||||
AA1EE467176059AB0029C7A5 /* SDL_test_harness.c in Sources */,
|
||||
AA1EE468176059AB0029C7A5 /* SDL_test_imageBlit.c in Sources */,
|
||||
AA1EE469176059AB0029C7A5 /* SDL_test_imageBlitBlend.c in Sources */,
|
||||
AA1EE46A176059AB0029C7A5 /* SDL_test_imageFace.c in Sources */,
|
||||
AA1EE46B176059AB0029C7A5 /* SDL_test_imagePrimitives.c in Sources */,
|
||||
AA1EE46C176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c in Sources */,
|
||||
AAF030011F9009B100B9A9FB /* SDL_test_memory.c in Sources */,
|
||||
AA1EE46D176059AB0029C7A5 /* SDL_test_log.c in Sources */,
|
||||
AA1EE46E176059AB0029C7A5 /* SDL_test_md5.c in Sources */,
|
||||
AA1EE46F176059AB0029C7A5 /* SDL_test_random.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FA3D98F41BC4E5A2002C96C8 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FA3D99011BC4E5BC002C96C8 /* SDL_test_common.c in Sources */,
|
||||
FA3D99021BC4E5BC002C96C8 /* SDL_test_compare.c in Sources */,
|
||||
FA3D99031BC4E5BC002C96C8 /* SDL_test_crc32.c in Sources */,
|
||||
FA3D99041BC4E5BC002C96C8 /* SDL_test_font.c in Sources */,
|
||||
FA3D99051BC4E5BC002C96C8 /* SDL_test_fuzzer.c in Sources */,
|
||||
FA3D99061BC4E5BC002C96C8 /* SDL_test_harness.c in Sources */,
|
||||
FA3D99071BC4E5BC002C96C8 /* SDL_test_imageBlit.c in Sources */,
|
||||
FA3D99081BC4E5BC002C96C8 /* SDL_test_imageBlitBlend.c in Sources */,
|
||||
FA3D99091BC4E5BC002C96C8 /* SDL_test_imageFace.c in Sources */,
|
||||
FA3D990A1BC4E5BC002C96C8 /* SDL_test_imagePrimitives.c in Sources */,
|
||||
FA3D990B1BC4E5BC002C96C8 /* SDL_test_imagePrimitivesBlend.c in Sources */,
|
||||
FA3D990C1BC4E5BC002C96C8 /* SDL_test_log.c in Sources */,
|
||||
FA3D990D1BC4E5BC002C96C8 /* SDL_test_md5.c in Sources */,
|
||||
FA3D990E1BC4E5BC002C96C8 /* SDL_test_random.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
AA1EE4481760589B0029C7A5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = ../../include;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AA1EE4491760589B0029C7A5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = ../../include;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
AA1EE44B1760589B0029C7A5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AA1EE44C1760589B0029C7A5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
FA3D98FE1BC4E5A3002C96C8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
FA3D98FF1BC4E5A3002C96C8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
AA1EE4411760589B0029C7A5 /* Build configuration list for PBXProject "SDL2test" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AA1EE4481760589B0029C7A5 /* Debug */,
|
||||
AA1EE4491760589B0029C7A5 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
AA1EE44A1760589B0029C7A5 /* Build configuration list for PBXNativeTarget "SDL2test" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AA1EE44B1760589B0029C7A5 /* Debug */,
|
||||
AA1EE44C1760589B0029C7A5 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
FA3D99001BC4E5A3002C96C8 /* Build configuration list for PBXNativeTarget "SDL2test-TV" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
FA3D98FE1BC4E5A3002C96C8 /* Debug */,
|
||||
FA3D98FF1BC4E5A3002C96C8 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = AA1EE43E1760589B0029C7A5 /* Project object */;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.${PRODUCT_NAME}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>NSBluetoothAlwaysUsageDescription</key>
|
||||
<string>Steam Link would like to use Bluetooth controllers for input.</string>
|
||||
<key>NSBluetoothPeripheralUsageDescription</key>
|
||||
<string>Steam Link would like to use Bluetooth controllers for input.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,11 +0,0 @@
|
||||
TestiPhoneOS.xcodeproj contains targets to compile many of the SDL test programs for iPhone OS. Most of these test programs work fine, with the following exceptions:
|
||||
|
||||
testthread:
|
||||
SIGTERM kills the process immediately without executing the 'kill' function. The posix standard says this shouldn't happen. Apple seems intent on having iPhone apps exit promptly when the user requests it, so maybe that's why(?)
|
||||
|
||||
testlock:
|
||||
Locks appear to work, but there doesn't appear to be a simple way to send the process SIGINT.
|
||||
|
||||
testsprite2:
|
||||
SDL_CreateTextureFromSurface requests an ARGB pixel format, but iPhone's SDL video driver only supports ABGR.
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>http://www.libsdl.org</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Simple DirectMedia Layer</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.22</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.0.22</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,15 +0,0 @@
|
||||
Title SDL 2.0.0
|
||||
Version 1
|
||||
Description SDL Library for Mac OS X (http://www.libsdl.org)
|
||||
DefaultLocation /Library/Frameworks
|
||||
Diskname (null)
|
||||
DeleteWarning
|
||||
NeedsAuthorization NO
|
||||
DisableStop NO
|
||||
UseUserMask NO
|
||||
Application NO
|
||||
Relocatable YES
|
||||
Required NO
|
||||
InstallOnly NO
|
||||
RequiresReboot NO
|
||||
InstallFat NO
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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.
|
||||
@@ -1,32 +0,0 @@
|
||||
The Simple DirectMedia Layer (SDL for short) is a cross-platform
|
||||
library designed to make it easy to write multi-media software,
|
||||
such as games and emulators.
|
||||
|
||||
The Simple DirectMedia Layer library source code is available from:
|
||||
http://www.libsdl.org/
|
||||
|
||||
This library is distributed under the terms of the zlib license:
|
||||
http://zlib.net/zlib_license.html
|
||||
|
||||
|
||||
This packages contains the SDL framework for OS X.
|
||||
Conforming with Apple guidelines, this framework
|
||||
contains both the SDL runtime component and development header files.
|
||||
|
||||
|
||||
To Install:
|
||||
Copy the SDL2.framework to /Library/Frameworks
|
||||
|
||||
You may alternatively install it in <Your home directory>/Library/Frameworks
|
||||
if your access privileges are not high enough.
|
||||
|
||||
|
||||
Additional References:
|
||||
|
||||
- Screencast tutorials for getting started with OpenSceneGraph/Mac OS X are
|
||||
available at:
|
||||
http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/MacOSXTips
|
||||
Though these are OpenSceneGraph centric, the same exact concepts apply to
|
||||
SDL, thus the videos are recommended for everybody getting started with
|
||||
developing on Mac OS X. (You can skim over the PlugIns stuff since SDL
|
||||
doesn't have any PlugIns to worry about.)
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Alternate</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.libsdl.test-dropfile</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
find . -type f -exec grep -Il "Copyright" {} \; \
|
||||
| grep -v \.git \
|
||||
| while read file; \
|
||||
do \
|
||||
LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
|
||||
done
|
||||
@@ -1,8 +0,0 @@
|
||||
@ECHO OFF
|
||||
REM
|
||||
REM winrtbuild.bat: a batch file to help launch the winrtbuild.ps1
|
||||
REM Powershell script, either from Windows Explorer, or through Buildbot.
|
||||
REM
|
||||
SET ThisScriptsDirectory=%~dp0
|
||||
SET PowerShellScriptPath=%ThisScriptsDirectory%winrtbuild.ps1
|
||||
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'";
|
||||
@@ -1,302 +0,0 @@
|
||||
#
|
||||
# winrtbuild.ps1 -- A Powershell script to build all SDL/WinRT variants,
|
||||
# across all WinRT platforms, in all of their supported, CPU architectures.
|
||||
#
|
||||
# Initial version written by David Ludwig <dludwig@pobox.com>
|
||||
#
|
||||
# This script can be launched from Windows Explorer by double-clicking
|
||||
# on winrtbuild.bat
|
||||
#
|
||||
# Output will be placed in the following subdirectories of the SDL source
|
||||
# tree:
|
||||
# * VisualC-WinRT\lib\ -- final .dll, .lib, and .pdb files
|
||||
# * VisualC-WinRT\obj\ -- intermediate build files
|
||||
#
|
||||
# Recommended Dependencies:
|
||||
# * Windows 8.1 or higher
|
||||
# * Powershell 4.0 or higher (included as part of Windows 8.1)
|
||||
# * Visual C++ 2012, for building Windows 8.0 and Windows Phone 8.0 binaries.
|
||||
# * Visual C++ 2013, for building Windows 8.1 and Windows Phone 8.1 binaries
|
||||
# * SDKs for Windows 8.0, Windows 8.1, Windows Phone 8.0, and
|
||||
# Windows Phone 8.1, as needed
|
||||
#
|
||||
# Commom parameters/variables may include, but aren't strictly limited to:
|
||||
# * PlatformToolset: the name of one of Visual Studio's build platforms.
|
||||
# Different PlatformToolsets output different binaries. One
|
||||
# PlatformToolset exists for each WinRT platform. Possible values
|
||||
# may include:
|
||||
# - "v110": Visual Studio 2012 build tools, plus the Windows 8.0 SDK
|
||||
# - "v110_wp80": Visual Studio 2012 build tools, plus the Windows Phone 8.0 SDK
|
||||
# - "v120": Visual Studio 2013 build tools, plus the Windows 8.1 SDK
|
||||
# - "v120_wp81": Visual Studio 2013 build tools, plus the Windows Phone 8.1 SDK
|
||||
# * VSProjectPath: the full path to a Visual Studio or Visual C++ project file
|
||||
# * VSProjectName: the internal name of a Visual Studio or Visual C++ project
|
||||
# file. Some of Visual Studio's own build tools use this name when
|
||||
# calculating paths for build-output.
|
||||
# * Platform: a Visual Studio platform name, which often maps to a CPU
|
||||
# CPU architecture. Possible values may include: "Win32" (for 32-bit x86),
|
||||
# "ARM", or "x64" (for 64-bit x86).
|
||||
#
|
||||
|
||||
# Base version of SDL, used for packaging purposes
|
||||
$SDLVersion = "2.0.22"
|
||||
|
||||
# Gets the .bat file that sets up an MSBuild environment, given one of
|
||||
# Visual Studio's, "PlatformToolset"s.
|
||||
function Get-MSBuild-Env-Launcher
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=1)][string]$PlatformToolset
|
||||
)
|
||||
|
||||
if ($PlatformToolset -eq "v110") { # Windows 8.0 (not Windows Phone), via VS 2012
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
|
||||
}
|
||||
if ($PlatformToolset -eq "v110_wp80") { # Windows Phone 8.0, via VS 2012
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WPSDK\WP80\vcvarsphoneall.bat"
|
||||
}
|
||||
if ($PlatformToolset -eq "v120") { # Windows 8.1 (not Windows Phone), via VS 2013
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
||||
}
|
||||
if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
||||
}
|
||||
if ($PlatformToolset -eq "v140") { # Windows 10, via VS 2015
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
# Gets a string that identifies the build-variant of SDL/WinRT that is specific
|
||||
# to a particular Visual Studio PlatformToolset.
|
||||
function Get-SDL-WinRT-Variant-Name
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=1)][string]$PlatformToolset,
|
||||
|
||||
# If true, append a string to this function's output, identifying the
|
||||
# build-variant's minimum-supported version of Visual Studio.
|
||||
[switch]$IncludeVSSuffix = $false
|
||||
)
|
||||
|
||||
if ($PlatformToolset -eq "v110") { # Windows 8.0 (not Windows Phone), via VS 2012 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "WinRT80_VS2012"
|
||||
} else {
|
||||
return "WinRT80"
|
||||
}
|
||||
}
|
||||
if ($PlatformToolset -eq "v110_wp80") { # Windows Phone 8.0, via VS 2012 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "WinPhone80_VS2012"
|
||||
} else {
|
||||
return "WinPhone80"
|
||||
}
|
||||
}
|
||||
if ($PlatformToolset -eq "v120") { # Windows 8.1 (not Windows Phone), via VS 2013 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "WinRT81_VS2013"
|
||||
} else {
|
||||
return "WinRT81"
|
||||
}
|
||||
}
|
||||
if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "WinPhone81_VS2013"
|
||||
} else {
|
||||
return "WinPhone81"
|
||||
}
|
||||
}
|
||||
if ($PlatformToolset -eq "v140") { # Windows 10, via VS 2015 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "UWP_VS2015"
|
||||
} else {
|
||||
return "UWP"
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
# Returns the internal name of a Visual Studio Project.
|
||||
#
|
||||
# The internal name of a VS Project is encoded inside the project file
|
||||
# itself, inside a set of <ProjectName></ProjectName> XML tags.
|
||||
function Get-VS-ProjectName
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=1)]$VSProjectPath
|
||||
)
|
||||
|
||||
# For now, just do a regex for the project name:
|
||||
$matches = (Get-Content $VSProjectPath | Select-String -Pattern ".*<ProjectName>([^<]+)<.*").Matches
|
||||
foreach ($match in $matches) {
|
||||
if ($match.Groups.Count -ge 1) {
|
||||
return $match.Groups[1].Value
|
||||
}
|
||||
}
|
||||
return $null
|
||||
}
|
||||
|
||||
# Build a specific variant of SDL/WinRT
|
||||
function Build-SDL-WinRT-Variant
|
||||
{
|
||||
#
|
||||
# Read in arguments:
|
||||
#
|
||||
param (
|
||||
# name of an SDL project file, minus extensions and
|
||||
# platform-identifying suffixes
|
||||
[Parameter(Mandatory=$true,Position=1)][string]$SDLProjectName,
|
||||
|
||||
[Parameter(Mandatory=$true,Position=2)][string]$PlatformToolset,
|
||||
|
||||
[Parameter(Mandatory=$true,Position=3)][string]$Platform
|
||||
)
|
||||
|
||||
#
|
||||
# Derive other properties from read-in arguments:
|
||||
#
|
||||
|
||||
# The .bat file to setup a platform-appropriate MSBuild environment:
|
||||
$BatchFileForMSBuildEnv = Get-MSBuild-Env-Launcher $PlatformToolset
|
||||
|
||||
# The full path to the VS Project that'll be built:
|
||||
$VSProjectPath = "$PSScriptRoot\..\VisualC-WinRT\$(Get-SDL-WinRT-Variant-Name $PlatformToolset -IncludeVSSuffix)\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset).vcxproj"
|
||||
|
||||
# The internal name of the VS Project, used in some post-build steps:
|
||||
$VSProjectName = Get-VS-ProjectName $VSProjectPath
|
||||
|
||||
# Where to place output binaries (.dll, .lib, and .pdb files):
|
||||
$OutDir = "$PSScriptRoot\..\VisualC-WinRT\lib\$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform"
|
||||
|
||||
# Where to place intermediate build files:
|
||||
$IntermediateDir = "$PSScriptRoot\..\VisualC-WinRT\obj\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform"
|
||||
|
||||
#
|
||||
# Build the VS Project:
|
||||
#
|
||||
cmd.exe /c " ""$BatchFileForMSBuildEnv"" x86 & msbuild ""$VSProjectPath"" /p:Configuration=Release /p:Platform=$Platform /p:OutDir=""$OutDir\\"" /p:IntDir=""$IntermediateDir\\""" | Out-Host
|
||||
$BuildResult = $?
|
||||
|
||||
#
|
||||
# Move .dll files into place. This fixes a problem whereby MSBuild may
|
||||
# put output files into a sub-directory of $OutDir, rather than $OutDir
|
||||
# itself.
|
||||
#
|
||||
if (Test-Path "$OutDir\$VSProjectName\") {
|
||||
Move-Item -Force "$OutDir\$VSProjectName\*" "$OutDir"
|
||||
}
|
||||
|
||||
#
|
||||
# Clean up unneeded files in $OutDir:
|
||||
#
|
||||
if (Test-Path "$OutDir\$VSProjectName\") {
|
||||
Remove-Item -Recurse "$OutDir\$VSProjectName"
|
||||
}
|
||||
Remove-Item "$OutDir\*.exp"
|
||||
Remove-Item "$OutDir\*.ilk"
|
||||
Remove-Item "$OutDir\*.pri"
|
||||
|
||||
#
|
||||
# All done. Indicate success, or failure, to the caller:
|
||||
#
|
||||
#echo "RESULT: $BuildResult" | Out-Host
|
||||
return $BuildResult
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Build each variant, with corresponding .dll, .lib, and .pdb files:
|
||||
#
|
||||
$DidAnyDLLBuildFail = $false
|
||||
$DidAnyNugetBuildFail = $false
|
||||
|
||||
# Ryan disabled WP8.0, because it doesn't appear to have mmdeviceapi.h that SDL_wasapi needs.
|
||||
# My assumption is that no one will miss this, but send patches otherwise! --ryan.
|
||||
# Build for Windows Phone 8.0, via VC++ 2012:
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows Phone 8.1, via VC++ 2013:
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012:
|
||||
#
|
||||
# Win 8.0 auto-building was disabled on 2017-Feb-25, by David Ludwig <dludwig@pobox.com>.
|
||||
# Steam's OS-usage surveys indicate that Windows 8.0 use is pretty much nil, plus
|
||||
# Microsoft hasn't supported Windows 8.0 development for a few years now.
|
||||
# The commented-out lines below may still work on some systems, though.
|
||||
#
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013:
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 10, via VC++ 2015
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build NuGet packages, if possible
|
||||
if ($DidAnyDLLBuildFail -eq $true) {
|
||||
Write-Warning -Message "Unable to build all variants. NuGet packages will not be built."
|
||||
$DidAnyNugetBuildFail = $true
|
||||
} else {
|
||||
$NugetPath = (Get-Command -CommandType Application nuget.exe | %{$_.Path}) 2> $null
|
||||
if ("$NugetPath" -eq "") {
|
||||
Write-Warning -Message "Unable to find nuget.exe. NuGet packages will not be built."
|
||||
$DidAnyNugetBuildFail = $true
|
||||
} else {
|
||||
Write-Host -ForegroundColor Cyan "Building SDL2 NuGet packages..."
|
||||
Write-Host -ForegroundColor Cyan "... via NuGet install: $NugetPath"
|
||||
$NugetOutputDir = "$PSScriptRoot\..\VisualC-WinRT\lib\nuget"
|
||||
Write-Host -ForegroundColor Cyan "... output directory: $NugetOutputDir"
|
||||
$SDLHGRevision = $($(hg log -l 1 --repository "$PSScriptRoot\.." | select-string "changeset") -Replace "changeset:\W*(\d+).*",'$1') 2>$null
|
||||
Write-Host -ForegroundColor Cyan "... HG Revision: $SDLHGRevision"
|
||||
|
||||
# Base options to nuget.exe
|
||||
$NugetOptions = @("pack", "PACKAGE_NAME_WILL_GO_HERE", "-Output", "$NugetOutputDir")
|
||||
|
||||
# Try attaching hg revision to NuGet package:
|
||||
$NugetOptions += "-Version"
|
||||
if ("$SDLHGRevision" -eq "") {
|
||||
Write-Warning -Message "Unable to find the Mercurial revision (maybe hg.exe can't be found?). NuGet packages will not have this attached to their name."
|
||||
$NugetOptions += "$SDLVersion-Unofficial"
|
||||
} else {
|
||||
$NugetOptions += "$SDLVersion.$SDLHGRevision-Unofficial"
|
||||
}
|
||||
|
||||
# Create NuGet output dir, if not yet created:
|
||||
if ($(Test-Path "$NugetOutputDir") -eq $false) {
|
||||
New-Item "$NugetOutputDir" -type directory
|
||||
}
|
||||
|
||||
# Package SDL2:
|
||||
$NugetOptions[1] = "$PSScriptRoot\..\VisualC-WinRT\SDL2-WinRT.nuspec"
|
||||
&"$NugetPath" $NugetOptions -Symbols
|
||||
if ( ! $? ) { $DidAnyNugetBuildFail = $true }
|
||||
|
||||
# Package SDL2main:
|
||||
$NugetOptions[1] = "$PSScriptRoot\..\VisualC-WinRT\SDL2main-WinRT-NonXAML.nuspec"
|
||||
&"$NugetPath" $NugetOptions
|
||||
if ( ! $? ) { $DidAnyNugetBuildFail = $true }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Let the script's caller know whether or not any errors occurred.
|
||||
# Exit codes compatible with Buildbot are used (1 for error, 0 for success).
|
||||
if ($DidAnyDLLBuildFail -eq $true) {
|
||||
Write-Error -Message "Unable to build all known variants of SDL2 for WinRT"
|
||||
exit 1
|
||||
} elseif ($DidAnyNugetBuildFail -eq $true) {
|
||||
Write-Warning -Message "Unable to build NuGet packages"
|
||||
exit 0 # Should NuGet package build failure lead to a non-failing result code instead?
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
CMake
|
||||
================================================================================
|
||||
(www.cmake.org)
|
||||
|
||||
SDL's build system was traditionally based on autotools. Over time, this
|
||||
approach has suffered from several issues across the different supported
|
||||
platforms.
|
||||
To solve these problems, a new build system based on CMake is under development.
|
||||
It works in parallel to the legacy system, so users can experiment with it
|
||||
without complication.
|
||||
While still experimental, the build system should be usable on the following
|
||||
platforms:
|
||||
|
||||
* FreeBSD
|
||||
* Linux
|
||||
* VS.NET 2010
|
||||
* MinGW and Msys
|
||||
* macOS, iOS, and tvOS, with support for XCode
|
||||
|
||||
|
||||
================================================================================
|
||||
Usage
|
||||
================================================================================
|
||||
|
||||
Assuming the source for SDL is located at ~/sdl
|
||||
|
||||
cd ~
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../sdl
|
||||
|
||||
This will build the static and dynamic versions of SDL in the ~/build directory.
|
||||
|
||||
|
||||
================================================================================
|
||||
Usage, iOS/tvOS
|
||||
================================================================================
|
||||
|
||||
CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built
|
||||
using Xcode or Make, possibly among other build-systems.
|
||||
|
||||
When using a recent version of CMake (3.14+), it should be possible to:
|
||||
|
||||
- build SDL for iOS, both static and dynamic
|
||||
- build SDL test apps (as iOS/tvOS .app bundles)
|
||||
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
|
||||
|
||||
To use, set the following CMake variables when running CMake's configuration stage:
|
||||
|
||||
- `CMAKE_SYSTEM_NAME=<OS>` (either `iOS` or `tvOS`)
|
||||
- `CMAKE_OSX_SYSROOT=<SDK>` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
|
||||
`appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
|
||||
- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
|
||||
|
||||
|
||||
### Examples (for iOS/tvOS):
|
||||
|
||||
- for iOS-Simulator, using the latest, installed SDK:
|
||||
|
||||
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
|
||||
|
||||
- for iOS-Device, using the latest, installed SDK, 64-bit only
|
||||
|
||||
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64`
|
||||
|
||||
- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
|
||||
|
||||
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"`
|
||||
|
||||
- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
|
||||
|
||||
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64`
|
||||
|
||||
- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
|
||||
|
||||
`cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
|
||||
|
||||
- for tvOS-Simulator, using the latest, installed SDK:
|
||||
|
||||
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
|
||||
|
||||
- for tvOS-Device, using the latest, installed SDK:
|
||||
|
||||
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`
|
||||
@@ -1,2 +0,0 @@
|
||||
#define SDL_REVISION "https://github.com/libsdl-org/SDL.git@53dea9830964eee8b5c2a7ee0a65d6e268dc78a1"
|
||||
#define SDL_REVISION_NUMBER 0
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_test_font.h
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
#ifndef SDL_test_font_h_
|
||||
#define SDL_test_font_h_
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
#define FONT_CHARACTER_SIZE 8
|
||||
|
||||
/**
|
||||
* \brief Draw a string in the currently set font.
|
||||
*
|
||||
* \param renderer The renderer to draw on.
|
||||
* \param x The X coordinate of the upper left corner of the character.
|
||||
* \param y The Y coordinate of the upper left corner of the character.
|
||||
* \param c The character to draw.
|
||||
*
|
||||
* \returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
|
||||
|
||||
/**
|
||||
* \brief Draw a string in the currently set font.
|
||||
*
|
||||
* \param renderer The renderer to draw on.
|
||||
* \param x The X coordinate of the upper left corner of the string.
|
||||
* \param y The Y coordinate of the upper left corner of the string.
|
||||
* \param s The string to draw.
|
||||
*
|
||||
* \returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Cleanup textures used by font drawing functions.
|
||||
*/
|
||||
void SDLTest_CleanupTextDrawing(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* SDL_test_font_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,81 +0,0 @@
|
||||
# sdl2 cmake project-config input for ./configure scripts
|
||||
|
||||
set(prefix "@prefix@")
|
||||
set(exec_prefix "@exec_prefix@")
|
||||
set(libdir "@libdir@")
|
||||
set(includedir "@includedir@")
|
||||
set(SDL2_PREFIX "${prefix}")
|
||||
set(SDL2_EXEC_PREFIX "${exec_prefix}")
|
||||
set(SDL2_LIBDIR "${libdir}")
|
||||
set(SDL2_INCLUDE_DIRS "${includedir}/SDL2")
|
||||
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")
|
||||
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
||||
|
||||
if(NOT TARGET SDL2::SDL2)
|
||||
# provide SDL2::SDL2, SDL2::SDL2main and SDL2::SDL2-static targets, like SDL2Config.cmake does, for compatibility
|
||||
|
||||
# Remove -lSDL2 as that is handled by CMake, note the space at the end so it does not replace e.g. -lSDL2main
|
||||
# This may require "libdir" beeing set (from above)
|
||||
string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS "@SDL_RLD_FLAGS@ @SDL_LIBS@ ")
|
||||
# also get rid of -lSDL2main, if you want to link against that use both SDL2::SDL2main and SDL2::SDL2 (in that order)
|
||||
# (SDL2Config.cmake has the same behavior)
|
||||
string(REPLACE "-lSDL2main" "" SDL2_EXTRA_LINK_FLAGS ${SDL2_EXTRA_LINK_FLAGS})
|
||||
string(STRIP "${SDL2_EXTRA_LINK_FLAGS}" SDL2_EXTRA_LINK_FLAGS)
|
||||
string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ")
|
||||
string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC)
|
||||
|
||||
if(WIN32 AND NOT MSVC)
|
||||
# MINGW needs very special handling, because the link order must be exactly -lmingw32 -lSDL2main -lSDL2
|
||||
# for it to work at all (and -mwindows somewhere); a normal SHARED IMPORTED or STATIC IMPORTED library always puts itself first
|
||||
# so handle this like a header-only lib and put everything in INTERFACE_LINK_LIBRARIES
|
||||
|
||||
add_library(SDL2::SDL2 INTERFACE IMPORTED)
|
||||
set_target_properties(SDL2::SDL2 PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2")
|
||||
|
||||
add_library(SDL2::SDL2main INTERFACE IMPORTED)
|
||||
set_target_properties(SDL2::SDL2main PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -mwindows")
|
||||
|
||||
else() # (not WIN32) or MSVC
|
||||
|
||||
add_library(SDL2::SDL2 SHARED IMPORTED)
|
||||
set_target_properties(SDL2::SDL2 PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
|
||||
if(MSVC)
|
||||
# This file is generated when building SDL2 with autotools and MinGW, and MinGW/dlltool
|
||||
# isn't able to generate .lib files that are usable by recent MSVC versions
|
||||
# (something about "module unsafe for SAFESEH"; SAFESEH is enabled by default in MSVC).
|
||||
# The .lib file for SDL2.dll *could* be generated with `gendef SDL2.dll` and then
|
||||
# `lib.exe /machine:x86 /def:SDL2.def /out:SDL2.lib` (or /machine:amd64)
|
||||
# but that requires lib.exe from a Visual Studio installation - and that still doesn't
|
||||
# give you a static SDL2main.lib with SAFESEH support that you'll need (unless you don't use SDL2main)
|
||||
# Note that when building SDL2 with CMake and MSVC, the result works with both MinGW and MSVC.
|
||||
|
||||
message(FATAL_ERROR, "This build of libSDL2 only supports MinGW, not MSVC (Visual C++), because it lacks .lib files!")
|
||||
# MSVC needs SDL2.lib set as IMPORTED_IMPLIB to link against (comment out message() call above if you added SDL2.lib yourself)
|
||||
set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB "${SDL2_LIBDIR}/SDL2.lib")
|
||||
else()
|
||||
# this mustn't be set for MSVC, so do it here in an extra call here
|
||||
set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}")
|
||||
endif()
|
||||
|
||||
add_library(SDL2::SDL2main STATIC IMPORTED)
|
||||
set_target_properties(SDL2::SDL2main PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
|
||||
endif() # (not WIN32) or MSVC
|
||||
|
||||
add_library(SDL2::SDL2-static STATIC IMPORTED)
|
||||
set_target_properties(SDL2::SDL2-static PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}")
|
||||
|
||||
endif() # NOT TARGET SDL2::SDL2
|
||||
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 _ANDROID_KeyInfo
|
||||
#define _ANDROID_KeyInfo
|
||||
|
||||
#include "SDL_scancode.h"
|
||||
#include "SDL_keycode.h"
|
||||
|
||||
/*
|
||||
This file is used by the keyboard code in SDL_uikitview.m to convert between characters
|
||||
passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods.
|
||||
For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower
|
||||
case a.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_Scancode code;
|
||||
uint16_t mod;
|
||||
} AndroidKeyInfo;
|
||||
|
||||
/* So far only ASCII characters here */
|
||||
static AndroidKeyInfo unicharToAndroidKeyInfoTable[] = {
|
||||
/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 13 */ { SDL_SCANCODE_RETURN, 0 },
|
||||
/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 32 */ { SDL_SCANCODE_SPACE, 0 },
|
||||
/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */
|
||||
/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */
|
||||
/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */
|
||||
/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */
|
||||
/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */
|
||||
/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */
|
||||
/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */
|
||||
/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */
|
||||
/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */
|
||||
/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */
|
||||
/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */
|
||||
/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */
|
||||
/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */
|
||||
/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */
|
||||
/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */
|
||||
/* 48 */ { SDL_SCANCODE_0, 0 },
|
||||
/* 49 */ { SDL_SCANCODE_1, 0 },
|
||||
/* 50 */ { SDL_SCANCODE_2, 0 },
|
||||
/* 51 */ { SDL_SCANCODE_3, 0 },
|
||||
/* 52 */ { SDL_SCANCODE_4, 0 },
|
||||
/* 53 */ { SDL_SCANCODE_5, 0 },
|
||||
/* 54 */ { SDL_SCANCODE_6, 0 },
|
||||
/* 55 */ { SDL_SCANCODE_7, 0 },
|
||||
/* 56 */ { SDL_SCANCODE_8, 0 },
|
||||
/* 57 */ { SDL_SCANCODE_9, 0 },
|
||||
/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */
|
||||
/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 },
|
||||
/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */
|
||||
/* 61 */ { SDL_SCANCODE_EQUALS, 0 },
|
||||
/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */
|
||||
/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */
|
||||
/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */
|
||||
/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */
|
||||
/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT },
|
||||
/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT },
|
||||
/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT },
|
||||
/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT },
|
||||
/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT },
|
||||
/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT },
|
||||
/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT },
|
||||
/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT },
|
||||
/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT },
|
||||
/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT },
|
||||
/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT },
|
||||
/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT },
|
||||
/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT },
|
||||
/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT },
|
||||
/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT },
|
||||
/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT },
|
||||
/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT },
|
||||
/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT },
|
||||
/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT },
|
||||
/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT },
|
||||
/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT },
|
||||
/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT },
|
||||
/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT },
|
||||
/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT },
|
||||
/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT },
|
||||
/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 },
|
||||
/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 },
|
||||
/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 },
|
||||
/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */
|
||||
/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */
|
||||
/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */
|
||||
/* 97 */ { SDL_SCANCODE_A, 0 },
|
||||
/* 98 */ { SDL_SCANCODE_B, 0 },
|
||||
/* 99 */ { SDL_SCANCODE_C, 0 },
|
||||
/* 100 */{ SDL_SCANCODE_D, 0 },
|
||||
/* 101 */{ SDL_SCANCODE_E, 0 },
|
||||
/* 102 */{ SDL_SCANCODE_F, 0 },
|
||||
/* 103 */{ SDL_SCANCODE_G, 0 },
|
||||
/* 104 */{ SDL_SCANCODE_H, 0 },
|
||||
/* 105 */{ SDL_SCANCODE_I, 0 },
|
||||
/* 106 */{ SDL_SCANCODE_J, 0 },
|
||||
/* 107 */{ SDL_SCANCODE_K, 0 },
|
||||
/* 108 */{ SDL_SCANCODE_L, 0 },
|
||||
/* 109 */{ SDL_SCANCODE_M, 0 },
|
||||
/* 110 */{ SDL_SCANCODE_N, 0 },
|
||||
/* 111 */{ SDL_SCANCODE_O, 0 },
|
||||
/* 112 */{ SDL_SCANCODE_P, 0 },
|
||||
/* 113 */{ SDL_SCANCODE_Q, 0 },
|
||||
/* 114 */{ SDL_SCANCODE_R, 0 },
|
||||
/* 115 */{ SDL_SCANCODE_S, 0 },
|
||||
/* 116 */{ SDL_SCANCODE_T, 0 },
|
||||
/* 117 */{ SDL_SCANCODE_U, 0 },
|
||||
/* 118 */{ SDL_SCANCODE_V, 0 },
|
||||
/* 119 */{ SDL_SCANCODE_W, 0 },
|
||||
/* 120 */{ SDL_SCANCODE_X, 0 },
|
||||
/* 121 */{ SDL_SCANCODE_Y, 0 },
|
||||
/* 122 */{ SDL_SCANCODE_Z, 0 },
|
||||
/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */
|
||||
/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */
|
||||
/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */
|
||||
/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */
|
||||
/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT }
|
||||
};
|
||||
|
||||
#endif /* _ANDROID_KeyInfo */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,457 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if defined(SDL_JOYSTICK_VIRTUAL)
|
||||
|
||||
/* This is the virtual implementation of the SDL joystick API */
|
||||
|
||||
#include "SDL_virtualjoystick_c.h"
|
||||
#include "../SDL_sysjoystick.h"
|
||||
#include "../SDL_joystick_c.h"
|
||||
|
||||
extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver;
|
||||
|
||||
static joystick_hwdata * g_VJoys = NULL;
|
||||
|
||||
|
||||
static joystick_hwdata *
|
||||
VIRTUAL_HWDataForIndex(int device_index)
|
||||
{
|
||||
joystick_hwdata *vjoy = g_VJoys;
|
||||
while (vjoy) {
|
||||
if (device_index == 0)
|
||||
break;
|
||||
--device_index;
|
||||
vjoy = vjoy->next;
|
||||
}
|
||||
return vjoy;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VIRTUAL_FreeHWData(joystick_hwdata *hwdata)
|
||||
{
|
||||
joystick_hwdata * cur = g_VJoys;
|
||||
joystick_hwdata * prev = NULL;
|
||||
|
||||
if (!hwdata) {
|
||||
return;
|
||||
}
|
||||
if (hwdata->axes) {
|
||||
SDL_free((void *)hwdata->axes);
|
||||
hwdata->axes = NULL;
|
||||
}
|
||||
if (hwdata->buttons) {
|
||||
SDL_free((void *)hwdata->buttons);
|
||||
hwdata->buttons = NULL;
|
||||
}
|
||||
if (hwdata->hats) {
|
||||
SDL_free(hwdata->hats);
|
||||
hwdata->hats = NULL;
|
||||
}
|
||||
|
||||
/* Remove hwdata from SDL-global list */
|
||||
while (cur) {
|
||||
if (hwdata == cur) {
|
||||
if (prev) {
|
||||
prev->next = cur->next;
|
||||
} else {
|
||||
g_VJoys = cur->next;
|
||||
}
|
||||
break;
|
||||
}
|
||||
prev = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
SDL_free(hwdata);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SDL_JoystickAttachVirtualInner(SDL_JoystickType type,
|
||||
int naxes,
|
||||
int nbuttons,
|
||||
int nhats)
|
||||
{
|
||||
joystick_hwdata *hwdata = NULL;
|
||||
int device_index = -1;
|
||||
|
||||
hwdata = SDL_calloc(1, sizeof(joystick_hwdata));
|
||||
if (!hwdata) {
|
||||
VIRTUAL_FreeHWData(hwdata);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
hwdata->naxes = naxes;
|
||||
hwdata->nbuttons = nbuttons;
|
||||
hwdata->nhats = nhats;
|
||||
hwdata->name = "Virtual Joystick";
|
||||
|
||||
/* Note that this is a Virtual device and what subtype it is */
|
||||
hwdata->guid.data[14] = 'v';
|
||||
hwdata->guid.data[15] = (Uint8)type;
|
||||
|
||||
/* Allocate fields for different control-types */
|
||||
if (naxes > 0) {
|
||||
hwdata->axes = SDL_calloc(naxes, sizeof(Sint16));
|
||||
if (!hwdata->axes) {
|
||||
VIRTUAL_FreeHWData(hwdata);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
}
|
||||
if (nbuttons > 0) {
|
||||
hwdata->buttons = SDL_calloc(nbuttons, sizeof(Uint8));
|
||||
if (!hwdata->buttons) {
|
||||
VIRTUAL_FreeHWData(hwdata);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
}
|
||||
if (nhats > 0) {
|
||||
hwdata->hats = SDL_calloc(nhats, sizeof(Uint8));
|
||||
if (!hwdata->hats) {
|
||||
VIRTUAL_FreeHWData(hwdata);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate an instance ID for this device */
|
||||
hwdata->instance_id = SDL_GetNextJoystickInstanceID();
|
||||
|
||||
/* Add virtual joystick to SDL-global lists */
|
||||
hwdata->next = g_VJoys;
|
||||
g_VJoys = hwdata;
|
||||
SDL_PrivateJoystickAdded(hwdata->instance_id);
|
||||
|
||||
/* Return the new virtual-device's index */
|
||||
device_index = SDL_JoystickGetDeviceIndexFromInstanceID(hwdata->instance_id);
|
||||
return device_index;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SDL_JoystickDetachVirtualInner(int device_index)
|
||||
{
|
||||
SDL_JoystickID instance_id;
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
return SDL_SetError("Virtual joystick data not found");
|
||||
}
|
||||
instance_id = hwdata->instance_id;
|
||||
VIRTUAL_FreeHWData(hwdata);
|
||||
SDL_PrivateJoystickRemoved(instance_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SDL_JoystickSetVirtualAxisInner(SDL_Joystick *joystick, int axis, Sint16 value)
|
||||
{
|
||||
joystick_hwdata *hwdata;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
if (!joystick || !joystick->hwdata) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid joystick");
|
||||
}
|
||||
|
||||
hwdata = (joystick_hwdata *)joystick->hwdata;
|
||||
if (axis < 0 || axis >= hwdata->naxes) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid axis index");
|
||||
}
|
||||
|
||||
hwdata->axes[axis] = value;
|
||||
|
||||
SDL_UnlockJoysticks();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SDL_JoystickSetVirtualButtonInner(SDL_Joystick *joystick, int button, Uint8 value)
|
||||
{
|
||||
joystick_hwdata *hwdata;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
if (!joystick || !joystick->hwdata) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid joystick");
|
||||
}
|
||||
|
||||
hwdata = (joystick_hwdata *)joystick->hwdata;
|
||||
if (button < 0 || button >= hwdata->nbuttons) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid button index");
|
||||
}
|
||||
|
||||
hwdata->buttons[button] = value;
|
||||
|
||||
SDL_UnlockJoysticks();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SDL_JoystickSetVirtualHatInner(SDL_Joystick *joystick, int hat, Uint8 value)
|
||||
{
|
||||
joystick_hwdata *hwdata;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
if (!joystick || !joystick->hwdata) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid joystick");
|
||||
}
|
||||
|
||||
hwdata = (joystick_hwdata *)joystick->hwdata;
|
||||
if (hat < 0 || hat >= hwdata->nhats) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid hat index");
|
||||
}
|
||||
|
||||
hwdata->hats[hat] = value;
|
||||
|
||||
SDL_UnlockJoysticks();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickInit(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickGetCount(void)
|
||||
{
|
||||
int count = 0;
|
||||
joystick_hwdata *cur = g_VJoys;
|
||||
while (cur) {
|
||||
++count;
|
||||
cur = cur->next;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VIRTUAL_JoystickDetect(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
VIRTUAL_JoystickGetDeviceName(int device_index)
|
||||
{
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
return NULL;
|
||||
}
|
||||
return hwdata->name ? hwdata->name : "";
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickGetDevicePlayerIndex(int device_index)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VIRTUAL_JoystickSetDevicePlayerIndex(int device_index, int player_index)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static SDL_JoystickGUID
|
||||
VIRTUAL_JoystickGetDeviceGUID(int device_index)
|
||||
{
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
SDL_JoystickGUID guid;
|
||||
SDL_zero(guid);
|
||||
return guid;
|
||||
}
|
||||
return hwdata->guid;
|
||||
}
|
||||
|
||||
|
||||
static SDL_JoystickID
|
||||
VIRTUAL_JoystickGetDeviceInstanceID(int device_index)
|
||||
{
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
return -1;
|
||||
}
|
||||
return hwdata->instance_id;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
{
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
return SDL_SetError("No such device");
|
||||
}
|
||||
if (hwdata->opened) {
|
||||
return SDL_SetError("Joystick already opened");
|
||||
}
|
||||
joystick->instance_id = hwdata->instance_id;
|
||||
joystick->hwdata = hwdata;
|
||||
joystick->naxes = hwdata->naxes;
|
||||
joystick->nbuttons = hwdata->nbuttons;
|
||||
joystick->nhats = hwdata->nhats;
|
||||
hwdata->opened = SDL_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
|
||||
static Uint32
|
||||
VIRTUAL_JoystickGetCapabilities(SDL_Joystick *joystick)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static int
|
||||
VIRTUAL_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
|
||||
{
|
||||
joystick_hwdata *hwdata;
|
||||
int i;
|
||||
|
||||
if (!joystick) {
|
||||
return;
|
||||
}
|
||||
if (!joystick->hwdata) {
|
||||
return;
|
||||
}
|
||||
|
||||
hwdata = (joystick_hwdata *)joystick->hwdata;
|
||||
|
||||
for (i = 0; i < hwdata->naxes; ++i) {
|
||||
SDL_PrivateJoystickAxis(joystick, i, hwdata->axes[i]);
|
||||
}
|
||||
for (i = 0; i < hwdata->nbuttons; ++i) {
|
||||
SDL_PrivateJoystickButton(joystick, i, hwdata->buttons[i]);
|
||||
}
|
||||
for (i = 0; i < hwdata->nhats; ++i) {
|
||||
SDL_PrivateJoystickHat(joystick, i, hwdata->hats[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VIRTUAL_JoystickClose(SDL_Joystick *joystick)
|
||||
{
|
||||
joystick_hwdata *hwdata;
|
||||
|
||||
if (!joystick) {
|
||||
return;
|
||||
}
|
||||
if (!joystick->hwdata) {
|
||||
return;
|
||||
}
|
||||
|
||||
hwdata = (joystick_hwdata *)joystick->hwdata;
|
||||
hwdata->opened = SDL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VIRTUAL_JoystickQuit(void)
|
||||
{
|
||||
while (g_VJoys) {
|
||||
VIRTUAL_FreeHWData(g_VJoys);
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver =
|
||||
{
|
||||
VIRTUAL_JoystickInit,
|
||||
VIRTUAL_JoystickGetCount,
|
||||
VIRTUAL_JoystickDetect,
|
||||
VIRTUAL_JoystickGetDeviceName,
|
||||
VIRTUAL_JoystickGetDevicePlayerIndex,
|
||||
VIRTUAL_JoystickSetDevicePlayerIndex,
|
||||
VIRTUAL_JoystickGetDeviceGUID,
|
||||
VIRTUAL_JoystickGetDeviceInstanceID,
|
||||
VIRTUAL_JoystickOpen,
|
||||
VIRTUAL_JoystickRumble,
|
||||
VIRTUAL_JoystickRumbleTriggers,
|
||||
VIRTUAL_JoystickGetCapabilities,
|
||||
VIRTUAL_JoystickSetLED,
|
||||
VIRTUAL_JoystickSendEffect,
|
||||
VIRTUAL_JoystickSetSensorsEnabled,
|
||||
VIRTUAL_JoystickUpdate,
|
||||
VIRTUAL_JoystickClose,
|
||||
VIRTUAL_JoystickQuit,
|
||||
VIRTUAL_JoystickGetGamepadMapping
|
||||
};
|
||||
|
||||
#endif /* SDL_JOYSTICK_VIRTUAL */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,174 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 _UIKIT_KeyInfo
|
||||
#define _UIKIT_KeyInfo
|
||||
|
||||
#include "SDL_scancode.h"
|
||||
|
||||
/*
|
||||
This file is used by the keyboard code in SDL_uikitview.m to convert between characters
|
||||
passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods.
|
||||
For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower
|
||||
case a.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_Scancode code;
|
||||
Uint16 mod;
|
||||
} UIKitKeyInfo;
|
||||
|
||||
/* So far only ASCII characters here */
|
||||
static UIKitKeyInfo unicharToUIKeyInfoTable[] = {
|
||||
/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 13 */ { SDL_SCANCODE_RETURN, 0 },
|
||||
/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 32 */ { SDL_SCANCODE_SPACE, 0 },
|
||||
/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */
|
||||
/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */
|
||||
/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */
|
||||
/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */
|
||||
/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */
|
||||
/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */
|
||||
/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */
|
||||
/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */
|
||||
/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */
|
||||
/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */
|
||||
/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */
|
||||
/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */
|
||||
/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */
|
||||
/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */
|
||||
/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */
|
||||
/* 48 */ { SDL_SCANCODE_0, 0 },
|
||||
/* 49 */ { SDL_SCANCODE_1, 0 },
|
||||
/* 50 */ { SDL_SCANCODE_2, 0 },
|
||||
/* 51 */ { SDL_SCANCODE_3, 0 },
|
||||
/* 52 */ { SDL_SCANCODE_4, 0 },
|
||||
/* 53 */ { SDL_SCANCODE_5, 0 },
|
||||
/* 54 */ { SDL_SCANCODE_6, 0 },
|
||||
/* 55 */ { SDL_SCANCODE_7, 0 },
|
||||
/* 56 */ { SDL_SCANCODE_8, 0 },
|
||||
/* 57 */ { SDL_SCANCODE_9, 0 },
|
||||
/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */
|
||||
/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 },
|
||||
/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */
|
||||
/* 61 */ { SDL_SCANCODE_EQUALS, 0 },
|
||||
/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */
|
||||
/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */
|
||||
/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */
|
||||
/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */
|
||||
/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT },
|
||||
/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT },
|
||||
/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT },
|
||||
/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT },
|
||||
/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT },
|
||||
/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT },
|
||||
/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT },
|
||||
/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT },
|
||||
/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT },
|
||||
/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT },
|
||||
/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT },
|
||||
/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT },
|
||||
/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT },
|
||||
/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT },
|
||||
/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT },
|
||||
/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT },
|
||||
/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT },
|
||||
/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT },
|
||||
/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT },
|
||||
/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT },
|
||||
/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT },
|
||||
/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT },
|
||||
/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT },
|
||||
/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT },
|
||||
/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT },
|
||||
/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 },
|
||||
/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 },
|
||||
/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 },
|
||||
/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */
|
||||
/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */
|
||||
/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */
|
||||
/* 97 */ { SDL_SCANCODE_A, 0 },
|
||||
/* 98 */ { SDL_SCANCODE_B, 0 },
|
||||
/* 99 */ { SDL_SCANCODE_C, 0 },
|
||||
/* 100 */{ SDL_SCANCODE_D, 0 },
|
||||
/* 101 */{ SDL_SCANCODE_E, 0 },
|
||||
/* 102 */{ SDL_SCANCODE_F, 0 },
|
||||
/* 103 */{ SDL_SCANCODE_G, 0 },
|
||||
/* 104 */{ SDL_SCANCODE_H, 0 },
|
||||
/* 105 */{ SDL_SCANCODE_I, 0 },
|
||||
/* 106 */{ SDL_SCANCODE_J, 0 },
|
||||
/* 107 */{ SDL_SCANCODE_K, 0 },
|
||||
/* 108 */{ SDL_SCANCODE_L, 0 },
|
||||
/* 109 */{ SDL_SCANCODE_M, 0 },
|
||||
/* 110 */{ SDL_SCANCODE_N, 0 },
|
||||
/* 111 */{ SDL_SCANCODE_O, 0 },
|
||||
/* 112 */{ SDL_SCANCODE_P, 0 },
|
||||
/* 113 */{ SDL_SCANCODE_Q, 0 },
|
||||
/* 114 */{ SDL_SCANCODE_R, 0 },
|
||||
/* 115 */{ SDL_SCANCODE_S, 0 },
|
||||
/* 116 */{ SDL_SCANCODE_T, 0 },
|
||||
/* 117 */{ SDL_SCANCODE_U, 0 },
|
||||
/* 118 */{ SDL_SCANCODE_V, 0 },
|
||||
/* 119 */{ SDL_SCANCODE_W, 0 },
|
||||
/* 120 */{ SDL_SCANCODE_X, 0 },
|
||||
/* 121 */{ SDL_SCANCODE_Y, 0 },
|
||||
/* 122 */{ SDL_SCANCODE_Z, 0 },
|
||||
/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */
|
||||
/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */
|
||||
/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */
|
||||
/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */
|
||||
/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT }
|
||||
};
|
||||
|
||||
#endif /* _UIKIT_KeyInfo */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,208 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_windowsvideo_h_
|
||||
#define SDL_windowsvideo_h_
|
||||
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
||||
#include <msctf.h>
|
||||
#else
|
||||
#include "SDL_msctf.h"
|
||||
#endif
|
||||
|
||||
#include <imm.h>
|
||||
|
||||
#define MAX_CANDLIST 10
|
||||
#define MAX_CANDLENGTH 256
|
||||
#define MAX_CANDSIZE (sizeof(WCHAR) * MAX_CANDLIST * MAX_CANDLENGTH)
|
||||
|
||||
#include "SDL_windowsclipboard.h"
|
||||
#include "SDL_windowsevents.h"
|
||||
#include "SDL_windowskeyboard.h"
|
||||
#include "SDL_windowsmodes.h"
|
||||
#include "SDL_windowsmouse.h"
|
||||
#include "SDL_windowsopengl.h"
|
||||
#include "SDL_windowsopengles.h"
|
||||
#include "SDL_windowswindow.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_loadso.h"
|
||||
|
||||
|
||||
#if WINVER < 0x0601
|
||||
/* Touch input definitions */
|
||||
#define TWF_FINETOUCH 1
|
||||
#define TWF_WANTPALM 2
|
||||
|
||||
#define TOUCHEVENTF_MOVE 0x0001
|
||||
#define TOUCHEVENTF_DOWN 0x0002
|
||||
#define TOUCHEVENTF_UP 0x0004
|
||||
|
||||
DECLARE_HANDLE(HTOUCHINPUT);
|
||||
|
||||
typedef struct _TOUCHINPUT {
|
||||
LONG x;
|
||||
LONG y;
|
||||
HANDLE hSource;
|
||||
DWORD dwID;
|
||||
DWORD dwFlags;
|
||||
DWORD dwMask;
|
||||
DWORD dwTime;
|
||||
ULONG_PTR dwExtraInfo;
|
||||
DWORD cxContact;
|
||||
DWORD cyContact;
|
||||
} TOUCHINPUT, *PTOUCHINPUT;
|
||||
|
||||
#endif /* WINVER < 0x0601 */
|
||||
|
||||
#if WINVER < 0x0603
|
||||
|
||||
typedef enum MONITOR_DPI_TYPE {
|
||||
MDT_EFFECTIVE_DPI = 0,
|
||||
MDT_ANGULAR_DPI = 1,
|
||||
MDT_RAW_DPI = 2,
|
||||
MDT_DEFAULT = MDT_EFFECTIVE_DPI
|
||||
} MONITOR_DPI_TYPE;
|
||||
|
||||
#else
|
||||
#include <shellscalingapi.h>
|
||||
#endif /* WINVER < 0x0603 */
|
||||
|
||||
typedef BOOL (*PFNSHFullScreen)(HWND, DWORD);
|
||||
typedef void (*PFCoordTransform)(SDL_Window*, POINT*);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void **lpVtbl;
|
||||
int refcount;
|
||||
void *data;
|
||||
} TSFSink;
|
||||
|
||||
/* Definition from Win98DDK version of IMM.H */
|
||||
typedef struct tagINPUTCONTEXT2 {
|
||||
HWND hWnd;
|
||||
BOOL fOpen;
|
||||
POINT ptStatusWndPos;
|
||||
POINT ptSoftKbdPos;
|
||||
DWORD fdwConversion;
|
||||
DWORD fdwSentence;
|
||||
union {
|
||||
LOGFONTA A;
|
||||
LOGFONTW W;
|
||||
} lfFont;
|
||||
COMPOSITIONFORM cfCompForm;
|
||||
CANDIDATEFORM cfCandForm[4];
|
||||
HIMCC hCompStr;
|
||||
HIMCC hCandInfo;
|
||||
HIMCC hGuideLine;
|
||||
HIMCC hPrivate;
|
||||
DWORD dwNumMsgBuf;
|
||||
HIMCC hMsgBuf;
|
||||
DWORD fdwInit;
|
||||
DWORD dwReserve[3];
|
||||
} INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
|
||||
|
||||
/* Private display data */
|
||||
|
||||
typedef struct SDL_VideoData
|
||||
{
|
||||
int render;
|
||||
|
||||
DWORD clipboard_count;
|
||||
|
||||
/* Touch input functions */
|
||||
void* userDLL;
|
||||
BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
|
||||
BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
|
||||
BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
|
||||
|
||||
void* shcoreDLL;
|
||||
HRESULT (WINAPI *GetDpiForMonitor)( HMONITOR hmonitor,
|
||||
MONITOR_DPI_TYPE dpiType,
|
||||
UINT *dpiX,
|
||||
UINT *dpiY );
|
||||
|
||||
SDL_bool ime_com_initialized;
|
||||
struct ITfThreadMgr *ime_threadmgr;
|
||||
SDL_bool ime_initialized;
|
||||
SDL_bool ime_enabled;
|
||||
SDL_bool ime_available;
|
||||
HWND ime_hwnd_main;
|
||||
HWND ime_hwnd_current;
|
||||
SDL_bool ime_suppress_endcomposition_event;
|
||||
HIMC ime_himc;
|
||||
|
||||
WCHAR* ime_composition;
|
||||
int ime_composition_length;
|
||||
WCHAR ime_readingstring[16];
|
||||
int ime_cursor;
|
||||
|
||||
SDL_bool ime_candlist;
|
||||
WCHAR* ime_candidates;
|
||||
DWORD ime_candcount;
|
||||
DWORD ime_candref;
|
||||
DWORD ime_candsel;
|
||||
UINT ime_candpgsize;
|
||||
int ime_candlistindexbase;
|
||||
SDL_bool ime_candvertical;
|
||||
|
||||
SDL_bool ime_dirty;
|
||||
SDL_Rect ime_rect;
|
||||
SDL_Rect ime_candlistrect;
|
||||
int ime_winwidth;
|
||||
int ime_winheight;
|
||||
|
||||
HKL ime_hkl;
|
||||
void* ime_himm32;
|
||||
UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
|
||||
BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
|
||||
LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
|
||||
BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
|
||||
LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
|
||||
BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
|
||||
|
||||
SDL_bool ime_uiless;
|
||||
struct ITfThreadMgrEx *ime_threadmgrex;
|
||||
DWORD ime_uielemsinkcookie;
|
||||
DWORD ime_alpnsinkcookie;
|
||||
DWORD ime_openmodesinkcookie;
|
||||
DWORD ime_convmodesinkcookie;
|
||||
TSFSink *ime_uielemsink;
|
||||
TSFSink *ime_ippasink;
|
||||
LONG ime_uicontext;
|
||||
|
||||
BYTE pre_hook_key_state[256];
|
||||
UINT _SDL_WAKEUP;
|
||||
} SDL_VideoData;
|
||||
|
||||
extern SDL_bool g_WindowsEnableMessageLoop;
|
||||
extern SDL_bool g_WindowFrameUsableWhileCursorHidden;
|
||||
|
||||
typedef struct IDirect3D9 IDirect3D9;
|
||||
extern SDL_bool D3D_LoadDLL( void **pD3DDLL, IDirect3D9 **pDirect3D9Interface );
|
||||
|
||||
#endif /* SDL_windowsvideo_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -50,7 +50,7 @@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@
|
||||
|
||||
INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@
|
||||
|
||||
SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols
|
||||
SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake.in src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols
|
||||
GEN_DIST = SDL2.spec
|
||||
|
||||
ifneq ($V,1)
|
||||
@@ -80,6 +80,7 @@ HDRS = \
|
||||
SDL_filesystem.h \
|
||||
SDL_gamecontroller.h \
|
||||
SDL_gesture.h \
|
||||
SDL_guid.h \
|
||||
SDL_haptic.h \
|
||||
SDL_hidapi.h \
|
||||
SDL_hints.h \
|
||||
@@ -11,7 +11,10 @@
|
||||
# wmake -f Makefile.os2 HIDAPI=1
|
||||
|
||||
LIBNAME = SDL2
|
||||
VERSION = 2.0.22
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 24
|
||||
MICRO_VERSION = 0
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
DESCRIPTION = Simple DirectMedia Layer 2
|
||||
|
||||
LIBICONV=0
|
||||
@@ -60,15 +63,19 @@ CFLAGS_DLL+= -DHAVE_LIBUSB_H=1
|
||||
# building SDL itself (for DECLSPEC):
|
||||
CFLAGS_DLL+= -DBUILD_SDL
|
||||
|
||||
SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c
|
||||
SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c
|
||||
CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION)
|
||||
CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION)
|
||||
CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION)
|
||||
|
||||
SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c
|
||||
SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c
|
||||
SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
|
||||
SRCS+= SDL_rwops.c SDL_power.c
|
||||
SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c
|
||||
SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c &
|
||||
SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c &
|
||||
SDL_sensor.c SDL_touch.c
|
||||
SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c
|
||||
SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c
|
||||
SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
|
||||
SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c &
|
||||
SDL_render_sw.c SDL_rotate.c SDL_triangle.c
|
||||
@@ -82,7 +89,7 @@ SRCS+= SDL_systimer.c
|
||||
SRCS+= SDL_sysloadso.c
|
||||
SRCS+= SDL_sysfilesystem.c
|
||||
SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c
|
||||
SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c
|
||||
SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c
|
||||
SRCS+= SDL_dummyaudio.c SDL_diskaudio.c
|
||||
SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c
|
||||
SRCS+= SDL_dummysensor.c
|
||||
273
examples/common/SDL2-2.24.0/Makefile.w32
Normal file
@@ -0,0 +1,273 @@
|
||||
# Open Watcom makefile to build SDL2.dll for Win32
|
||||
# wmake -f Makefile.w32
|
||||
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 24
|
||||
MICRO_VERSION = 0
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
DESCRIPTION = Simple DirectMedia Layer 2
|
||||
|
||||
LIBHOME = .
|
||||
DLLFILE = $(LIBHOME)/$(LIBNAME).dll
|
||||
LIBFILE = $(LIBHOME)/$(LIBNAME).lib
|
||||
EXPFILE = $(LIBHOME)/$(LIBNAME).exp
|
||||
LNKFILE = $(LIBNAME).lnk
|
||||
|
||||
INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h/nt/directx" -I"$(%WATCOM)/h"
|
||||
INCPATH+= -Iinclude
|
||||
INCPATH+= -I"src/video/khronos"
|
||||
|
||||
LIBM = SDL2libm.lib
|
||||
TLIB = SDL2test.lib
|
||||
LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.lib setupapi.lib version.lib uuid.lib dxguid.lib $(LIBM)
|
||||
|
||||
CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei
|
||||
# max warnings:
|
||||
CFLAGS+= -wx
|
||||
# newer OpenWatcom versions enable W303 by default
|
||||
CFLAGS+= -wcd=303
|
||||
# the include paths :
|
||||
CFLAGS+= $(INCPATH)
|
||||
CFLAGS_STATIC=$(CFLAGS)
|
||||
# building dll:
|
||||
CFLAGS_DLL =$(CFLAGS)
|
||||
CFLAGS_DLL+= -bd
|
||||
# we override the DECLSPEC define in begin_code.h, because we are using
|
||||
# an exports file to remove the _cdecl '_' prefix from the symbol names
|
||||
CFLAGS_DLL+= -DDECLSPEC=
|
||||
|
||||
CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION)
|
||||
CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION)
|
||||
CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION)
|
||||
|
||||
RCFLAGS = -q -r -bt=nt $(INCPATH)
|
||||
|
||||
SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c
|
||||
SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c
|
||||
SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
|
||||
SRCS+= SDL_rwops.c SDL_power.c
|
||||
SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c
|
||||
SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c &
|
||||
SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c &
|
||||
SDL_sensor.c SDL_touch.c
|
||||
SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c
|
||||
SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
|
||||
SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c &
|
||||
SDL_render_sw.c SDL_rotate.c SDL_triangle.c
|
||||
SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c &
|
||||
SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c &
|
||||
SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c &
|
||||
SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c
|
||||
|
||||
SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c
|
||||
SRCS+= SDL_systimer.c
|
||||
SRCS+= SDL_sysloadso.c
|
||||
SRCS+= SDL_sysfilesystem.c
|
||||
SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c
|
||||
SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c
|
||||
SRCS+= SDL_dummyaudio.c SDL_diskaudio.c
|
||||
SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c
|
||||
SRCS+= SDL_dummysensor.c
|
||||
SRCS+= SDL_locale.c SDL_syslocale.c
|
||||
SRCS+= SDL_url.c SDL_sysurl.c
|
||||
|
||||
SRCS+= SDL_winmm.c SDL_directsound.c SDL_wasapi.c SDL_wasapi_win32.c
|
||||
SRCS+= SDL_hid.c SDL_immdevice.c SDL_windows.c SDL_xinput.c
|
||||
SRCS+= SDL_dinputhaptic.c SDL_windowshaptic.c SDL_xinputhaptic.c
|
||||
SRCS+= SDL_dinputjoystick.c SDL_rawinputjoystick.c SDL_windowsjoystick.c SDL_windows_gaming_input.c SDL_xinputjoystick.c
|
||||
SRCS+= SDL_syspower.c
|
||||
SRCS+= SDL_d3dmath.c
|
||||
SRCS+= SDL_render_d3d.c SDL_shaders_d3d.c
|
||||
SRCS+= SDL_render_d3d11.c SDL_shaders_d3d11.c
|
||||
SRCS+= SDL_render_d3d12.c SDL_shaders_d3d12.c
|
||||
SRCS+= SDL_render_gl.c SDL_shaders_gl.c
|
||||
SRCS+= SDL_render_gles2.c SDL_shaders_gles2.c
|
||||
SRCS+= SDL_windowssensor.c
|
||||
SRCS+= SDL_syscond_cv.c
|
||||
SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c
|
||||
|
||||
SRCS+= SDL_dynapi.c
|
||||
|
||||
RCSRCS = version.rc
|
||||
|
||||
OBJS = $(SRCS:.c=.obj)
|
||||
RCOBJS= $(RCSRCS:.rc=.res)
|
||||
|
||||
.extensions:
|
||||
.extensions: .lib .dll .obj .res .c .rc .asm
|
||||
|
||||
.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk;
|
||||
.c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy;
|
||||
.c: ./src/core/windows;./src/audio/winmm;./src/audio/directsound;./src/audio/wasapi;./src/loadso/windows;./src/filesystem/windows;./src/haptic/windows;./src/joystick/windows;./src/sensor/windows;./src/thread/windows;./src/timer/windows;./src/video/windows;
|
||||
.c: ./src/locale/;./src/locale/windows;./src/misc;./src/misc/windows;./src/power/windows;./src/joystick/hidapi;./src/hidapi;./src/render/direct3d;./src/render/direct3d11;./src/render/direct3d12;./src/render/opengl;./src/render/opengles2
|
||||
.rc: ./src/main/windows
|
||||
|
||||
all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic
|
||||
|
||||
build_dll: .symbolic
|
||||
@echo * Compiling dll objects
|
||||
|
||||
$(DLLFILE): build_dll $(OBJS) $(LIBM) $(RCOBJS) $(LNKFILE)
|
||||
@echo * Linking: $@
|
||||
wlink @$(LNKFILE)
|
||||
|
||||
$(LIBFILE): $(DLLFILE)
|
||||
@echo * Creating LIB file: $@
|
||||
wlib -q -b -n -c -pa -s -t -zld -ii -io $* @$(EXPFILE)
|
||||
|
||||
.c.obj:
|
||||
wcc386 $(CFLAGS_DLL) -fo=$^@ $<
|
||||
|
||||
.rc.res:
|
||||
wrc $(RCFLAGS) -fo=$^@ $<
|
||||
|
||||
SDL_syscond.obj: "src/thread/generic/SDL_syscond.c"
|
||||
wcc386 $(CFLAGS_DLL) -fo=$^@ $<
|
||||
SDL_cpuinfo.obj: SDL_cpuinfo.c
|
||||
wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $<
|
||||
SDL_wave.obj: SDL_wave.c
|
||||
wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $<
|
||||
SDL_blendfillrect.obj: SDL_blendfillrect.c
|
||||
wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $<
|
||||
SDL_blendline.obj: SDL_blendline.c
|
||||
wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $<
|
||||
SDL_blendpoint.obj: SDL_blendpoint.c
|
||||
wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $<
|
||||
SDL_RLEaccel.obj: SDL_RLEaccel.c
|
||||
wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $<
|
||||
SDL_malloc.obj: SDL_malloc.c
|
||||
wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $<
|
||||
|
||||
# SDL2libm
|
||||
MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c &
|
||||
k_cos.c k_rem_pio2.c k_sin.c k_tan.c &
|
||||
s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c
|
||||
MOBJS= $(MSRCS:.c=.obj)
|
||||
|
||||
.c: ./src/libm;
|
||||
e_atan2.obj: e_atan2.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
e_exp.obj: e_exp.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
e_fmod.obj: e_fmod.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
e_log10.obj: e_log10.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
e_log.obj: e_log.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
e_pow.obj: e_pow.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
e_rem_pio2.obj: e_rem_pio2.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
e_sqrt.obj: e_sqrt.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
k_cos.obj: k_cos.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
k_rem_pio2.obj: k_rem_pio2.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
k_sin.obj: k_sin.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
k_tan.obj: k_tan.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
s_atan.obj: s_atan.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
s_copysign.obj: s_copysign.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
s_cos.obj: s_cos.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
s_fabs.obj: s_fabs.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
s_floor.obj: s_floor.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
s_scalbn.obj: s_scalbn.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
s_sin.obj: s_sin.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
s_tan.obj: s_tan.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
|
||||
build_libm: .symbolic
|
||||
@echo * Compiling libm objects
|
||||
$(LIBM): build_libm $(MOBJS)
|
||||
@echo * Creating: $@
|
||||
wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS)
|
||||
|
||||
# SDL2test
|
||||
TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c &
|
||||
SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c &
|
||||
SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c &
|
||||
SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c &
|
||||
SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c
|
||||
TOBJS= $(TSRCS:.c=.obj)
|
||||
|
||||
.c: ./src/test;
|
||||
SDL_test_assert.obj: SDL_test_assert.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_common.obj: SDL_test_common.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_compare.obj: SDL_test_compare.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_crc32.obj: SDL_test_crc32.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_font.obj: SDL_test_font.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_fuzzer.obj: SDL_test_fuzzer.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_harness.obj: SDL_test_harness.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_imageBlit.obj: SDL_test_imageBlit.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_imageFace.obj: SDL_test_imageFace.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_log.obj: SDL_test_log.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_md5.obj: SDL_test_md5.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_random.obj: SDL_test_random.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
SDL_test_memory.obj: SDL_test_memory.c
|
||||
wcc386 $(CFLAGS_STATIC) -fo=$^@ $<
|
||||
|
||||
build_tlib: .symbolic
|
||||
@echo * Compiling testlib objects
|
||||
$(TLIB): build_tlib $(TOBJS)
|
||||
@echo * Creating: $@
|
||||
wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS)
|
||||
|
||||
$(LNKFILE): Makefile.w32
|
||||
@echo * Creating linker file: $@
|
||||
@%create $@
|
||||
@%append $@ SYSTEM nt_dll INITINSTANCE TERMINSTANCE
|
||||
@%append $@ NAME $(DLLFILE)
|
||||
@for %i in ($(OBJS)) do @%append $@ FILE %i
|
||||
@for %i in ($(LIBS)) do @%append $@ LIB %i
|
||||
@%append $@ OPTION RESOURCE=$(RCOBJS)
|
||||
@%append $@ EXPORT=src/dynapi/SDL2.exports
|
||||
@%append $@ OPTION QUIET
|
||||
@%append $@ OPTION IMPF=$(EXPFILE)
|
||||
@%append $@ OPTION MAP=$(LIBHOME)/$^&.map
|
||||
@%append $@ OPTION DESCRIPTION '@$#libsdl org:$(VERSION)$#@$(DESCRIPTION)'
|
||||
@%append $@ OPTION ELIMINATE
|
||||
@%append $@ OPTION SHOWDEAD
|
||||
|
||||
clean: .SYMBOLIC
|
||||
@echo * Clean: $(LIBNAME)
|
||||
@if exist *.obj rm *.obj
|
||||
@if exist *.res rm *.res
|
||||
@if exist *.err rm *.err
|
||||
@if exist $(LNKFILE) rm $(LNKFILE)
|
||||
@if exist $(LIBM) rm $(LIBM)
|
||||
|
||||
distclean: .SYMBOLIC clean
|
||||
@if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp
|
||||
@if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map
|
||||
@if exist $(LIBFILE) rm $(LIBFILE)
|
||||
@if exist $(DLLFILE) rm $(DLLFILE)
|
||||
@if exist $(TLIB) rm $(TLIB)
|
||||
@@ -1,6 +1,6 @@
|
||||
Summary: Simple DirectMedia Layer
|
||||
Name: SDL2
|
||||
Version: 2.0.22
|
||||
Version: 2.24.0
|
||||
Release: 2
|
||||
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
|
||||
URL: http://www.libsdl.org/
|
||||
65
examples/common/SDL2-2.24.0/SDL2Config.cmake.in
Normal file
@@ -0,0 +1,65 @@
|
||||
# sdl2 cmake project-config input for CMakeLists.txt script
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL2 PROPERTIES
|
||||
URL "https://www.libsdl.org/"
|
||||
DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware"
|
||||
)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set(SDL2_FOUND TRUE)
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake")
|
||||
set(SDL2_SDL2_FOUND TRUE)
|
||||
endif()
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake")
|
||||
if(ANDROID)
|
||||
enable_language(CXX)
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake")
|
||||
set(SDL2_SDL2-static_FOUND TRUE)
|
||||
endif()
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake")
|
||||
set(SDL2_SDL2main_FOUND TRUE)
|
||||
endif()
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake")
|
||||
set(SDL2_SDL2test_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
check_required_components(SDL2)
|
||||
|
||||
# Create SDL2::SDL2 alias for static-only builds
|
||||
if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.18")
|
||||
# FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
||||
add_library(SDL2::SDL2 INTERFACE IMPORTED)
|
||||
set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static")
|
||||
else()
|
||||
add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables.
|
||||
|
||||
set(SDL2_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
|
||||
set(SDL2_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
|
||||
set(SDL2_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2")
|
||||
set(SDL2_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2")
|
||||
set(SDL2_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@")
|
||||
set(SDL2_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@")
|
||||
set(SDL2_LIBRARIES SDL2::SDL2)
|
||||
set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static)
|
||||
set(SDL2_STATIC_PRIVATE_LIBS)
|
||||
|
||||
set(SDL2MAIN_LIBRARY)
|
||||
if(TARGET SDL2::SDL2main)
|
||||
set(SDL2MAIN_LIBRARY SDL2::SDL2main)
|
||||
list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main)
|
||||
list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main)
|
||||
endif()
|
||||
|
||||
set(SDL2TEST_LIBRARY SDL2::SDL2test)
|
||||
@@ -45,6 +45,7 @@
|
||||
<ClInclude Include="..\include\SDL_error.h" />
|
||||
<ClInclude Include="..\include\SDL_events.h" />
|
||||
<ClInclude Include="..\include\SDL_filesystem.h" />
|
||||
<ClInclude Include="..\include\SDL_guid.h" />
|
||||
<ClInclude Include="..\include\SDL_haptic.h" />
|
||||
<ClInclude Include="..\include\SDL_hints.h" />
|
||||
<ClInclude Include="..\include\SDL_hidapi.h" />
|
||||
@@ -106,7 +107,6 @@
|
||||
<ClInclude Include="..\src\events\SDL_events_c.h" />
|
||||
<ClInclude Include="..\src\events\SDL_keyboard_c.h" />
|
||||
<ClInclude Include="..\src\events\SDL_mouse_c.h" />
|
||||
<ClInclude Include="..\src\events\SDL_sysevents.h" />
|
||||
<ClInclude Include="..\src\events\SDL_touch_c.h" />
|
||||
<ClInclude Include="..\src\events\SDL_windowevents_c.h" />
|
||||
<ClInclude Include="..\src\haptic\SDL_haptic_c.h" />
|
||||
@@ -114,6 +114,7 @@
|
||||
<ClInclude Include="..\src\haptic\windows\SDL_dinputhaptic_c.h" />
|
||||
<ClInclude Include="..\src\haptic\windows\SDL_windowshaptic_c.h" />
|
||||
<ClInclude Include="..\src\haptic\windows\SDL_xinputhaptic_c.h" />
|
||||
<ClInclude Include="..\src\joystick\controller_type.h" />
|
||||
<ClInclude Include="..\src\joystick\SDL_gamecontrollerdb.h" />
|
||||
<ClInclude Include="..\src\joystick\SDL_joystick_c.h" />
|
||||
<ClInclude Include="..\src\joystick\SDL_sysjoystick.h" />
|
||||
@@ -145,6 +146,7 @@
|
||||
<ClInclude Include="..\src\SDL_hints_c.h" />
|
||||
<ClInclude Include="..\src\SDL_internal.h" />
|
||||
<ClInclude Include="..\src\SDL_list.h" />
|
||||
<ClInclude Include="..\src\SDL_log_c.h" />
|
||||
<ClInclude Include="..\src\sensor\dummy\SDL_dummysensor.h" />
|
||||
<ClInclude Include="..\src\sensor\SDL_sensor_c.h" />
|
||||
<ClInclude Include="..\src\sensor\SDL_syssensor.h" />
|
||||
@@ -249,6 +251,7 @@
|
||||
<ClCompile Include="..\src\haptic\windows\SDL_xinputhaptic.c" />
|
||||
<ClCompile Include="..\src\hidapi\SDL_hidapi.c" />
|
||||
<ClCompile Include="..\src\joystick\dummy\SDL_sysjoystick.c" />
|
||||
<ClCompile Include="..\src\joystick\controller_type.c" />
|
||||
<ClCompile Include="..\src\joystick\SDL_gamecontroller.c" />
|
||||
<ClCompile Include="..\src\joystick\SDL_joystick.c" />
|
||||
<ClCompile Include="..\src\joystick\virtual\SDL_virtualjoystick.c" />
|
||||
@@ -298,14 +301,18 @@
|
||||
<ClCompile Include="..\src\SDL_dataqueue.c" />
|
||||
<ClCompile Include="..\src\SDL_list.c" />
|
||||
<ClCompile Include="..\src\SDL_error.c" />
|
||||
<ClCompile Include="..\src\SDL_guid.c" />
|
||||
<ClCompile Include="..\src\SDL_hints.c" />
|
||||
<ClCompile Include="..\src\SDL_log.c" />
|
||||
<ClCompile Include="..\src\SDL_utils.c" />
|
||||
<ClCompile Include="..\src\sensor\dummy\SDL_dummysensor.c" />
|
||||
<ClCompile Include="..\src\sensor\SDL_sensor.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_crc16.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_crc32.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_getenv.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_iconv.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_malloc.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_mslibc.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_qsort.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_stdlib.c" />
|
||||
<ClCompile Include="..\src\stdlib\SDL_string.c" />
|
||||
@@ -418,8 +425,7 @@
|
||||
<ApplicationTypeRevision>8.2</ApplicationTypeRevision>
|
||||
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.16299.0</WindowsTargetPlatformMinVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@@ -63,6 +63,9 @@
|
||||
<ClInclude Include="..\include\SDL_filesystem.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\SDL_guid.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\SDL_haptic.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -237,9 +240,6 @@
|
||||
<ClInclude Include="..\src\events\SDL_mouse_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\events\SDL_sysevents.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\events\SDL_touch_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -330,6 +330,9 @@
|
||||
<ClInclude Include="..\src\SDL_internal.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\SDL_log_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\locale\SDL_syslocale.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -630,6 +633,9 @@
|
||||
<ClCompile Include="..\src\SDL_error.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\SDL_guid.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\SDL_hints.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -642,6 +648,9 @@
|
||||
<ClCompile Include="..\src\locale\winrt\SDL_syslocale.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\stdlib\SDL_crc16.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\stdlib\SDL_crc32.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -786,6 +795,9 @@
|
||||
<ClCompile Include="..\src\SDL_list.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\SDL_utils.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\haptic\windows\SDL_dinputhaptic.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -819,10 +831,16 @@
|
||||
<ClCompile Include="..\src\misc\SDL_url.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\src\joystick\controller_type.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\joystick\windows\SDL_windows_gaming_input.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\joystick\controller_type.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -234,6 +234,7 @@
|
||||
<ClInclude Include="..\..\include\SDL_filesystem.h" />
|
||||
<ClInclude Include="..\..\include\SDL_gamecontroller.h" />
|
||||
<ClInclude Include="..\..\include\SDL_gesture.h" />
|
||||
<ClInclude Include="..\..\include\SDL_guid.h" />
|
||||
<ClInclude Include="..\..\include\SDL_haptic.h" />
|
||||
<ClInclude Include="..\..\include\SDL_hints.h" />
|
||||
<ClInclude Include="..\..\include\SDL_hidapi.h" />
|
||||
@@ -304,6 +305,7 @@
|
||||
<ClInclude Include="..\..\src\audio\winmm\SDL_winmm.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_directx.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_hid.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_immdevice.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_xinput.h" />
|
||||
<ClInclude Include="..\..\src\dynapi\SDL_dynapi.h" />
|
||||
@@ -319,7 +321,6 @@
|
||||
<ClInclude Include="..\..\src\events\SDL_gesture_c.h" />
|
||||
<ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
|
||||
<ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
|
||||
<ClInclude Include="..\..\src\events\SDL_sysevents.h" />
|
||||
<ClInclude Include="..\..\src\events\SDL_touch_c.h" />
|
||||
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
|
||||
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
|
||||
@@ -347,6 +348,7 @@
|
||||
<ClInclude Include="..\..\src\misc\SDL_sysurl.h" />
|
||||
<ClInclude Include="..\..\src\power\SDL_syspower.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
|
||||
@@ -367,9 +369,11 @@
|
||||
<ClInclude Include="..\..\src\SDL_assert_c.h" />
|
||||
<ClInclude Include="..\..\src\SDL_dataqueue.h" />
|
||||
<ClInclude Include="..\..\src\SDL_error_c.h" />
|
||||
<ClCompile Include="..\..\src\SDL_guid.c" />
|
||||
<ClInclude Include="..\..\src\SDL_hints_c.h" />
|
||||
<ClInclude Include="..\..\src\SDL_internal.h" />
|
||||
<ClInclude Include="..\..\src\SDL_list.h" />
|
||||
<ClInclude Include="..\..\src\SDL_log_c.h" />
|
||||
<ClInclude Include="..\..\src\sensor\dummy\SDL_dummysensor.h" />
|
||||
<ClInclude Include="..\..\src\sensor\SDL_sensor_c.h" />
|
||||
<ClInclude Include="..\..\src\sensor\SDL_syssensor.h" />
|
||||
@@ -453,6 +457,7 @@
|
||||
<ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
|
||||
<ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi_win32.c" />
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_hid.c" />
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_immdevice.c" />
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_xinput.c" />
|
||||
<ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
|
||||
@@ -475,13 +480,16 @@
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
|
||||
<ClCompile Include="..\..\src\hidapi\SDL_hidapi.c" />
|
||||
<ClCompile Include="..\..\src\joystick\controller_type.c" />
|
||||
<ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_combined.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_gamecube.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_luna.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps4.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps5.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_stadia.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
|
||||
@@ -523,6 +531,8 @@
|
||||
<ClCompile Include="..\..\src\power\SDL_power.c" />
|
||||
<ClCompile Include="..\..\src\power\windows\SDL_syspower.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d12\SDL_render_d3d12.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d\SDL_shaders_d3d.c" />
|
||||
@@ -548,13 +558,16 @@
|
||||
<ClCompile Include="..\..\src\SDL_error.c" />
|
||||
<ClCompile Include="..\..\src\SDL_hints.c" />
|
||||
<ClCompile Include="..\..\src\SDL_log.c" />
|
||||
<ClCompile Include="..\..\src\SDL_utils.c" />
|
||||
<ClCompile Include="..\..\src\sensor\dummy\SDL_dummysensor.c" />
|
||||
<ClCompile Include="..\..\src\sensor\SDL_sensor.c" />
|
||||
<ClCompile Include="..\..\src\sensor\windows\SDL_windowssensor.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_crc16.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_crc32.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_mslibc.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_string.c" />
|
||||
@@ -169,6 +169,9 @@
|
||||
<Filter Include="video\khronos\vulkan">
|
||||
<UniqueIdentifier>{4755f3a6-49ac-46d6-86be-21f5c21f2197}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="render\direct3d12">
|
||||
<UniqueIdentifier>{f48c2b17-1bee-4fec-a7c8-24cf619abe08}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\begin_code.h">
|
||||
@@ -231,6 +234,9 @@
|
||||
<ClInclude Include="..\..\include\SDL_gesture.h">
|
||||
<Filter>API Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\SDL_guid.h">
|
||||
<Filter>API Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\SDL_haptic.h">
|
||||
<Filter>API Headers</Filter>
|
||||
</ClInclude>
|
||||
@@ -426,6 +432,9 @@
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_hid.h">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_immdevice.h">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_windows.h">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClInclude>
|
||||
@@ -465,9 +474,6 @@
|
||||
<ClInclude Include="..\..\src\events\SDL_mouse_c.h">
|
||||
<Filter>events</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\events\SDL_sysevents.h">
|
||||
<Filter>events</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\events\SDL_touch_c.h">
|
||||
<Filter>events</Filter>
|
||||
</ClInclude>
|
||||
@@ -825,6 +831,10 @@
|
||||
<ClInclude Include="..\..\src\SDL_assert_c.h" />
|
||||
<ClInclude Include="..\..\src\SDL_hints_c.h" />
|
||||
<ClInclude Include="..\..\src\SDL_internal.h" />
|
||||
<ClInclude Include="..\..\src\SDL_log_c.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.h">
|
||||
<Filter>render\direct3d12</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
|
||||
@@ -832,8 +842,10 @@
|
||||
<ClCompile Include="..\..\src\SDL_assert.c" />
|
||||
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
|
||||
<ClCompile Include="..\..\src\SDL_error.c" />
|
||||
<ClCompile Include="..\..\src\SDL_guid.c" />
|
||||
<ClCompile Include="..\..\src\SDL_hints.c" />
|
||||
<ClCompile Include="..\..\src\SDL_list.c" />
|
||||
<ClCompile Include="..\..\src\SDL_utils.c" />
|
||||
<ClCompile Include="..\..\src\audio\SDL_audio.c">
|
||||
<Filter>audio</Filter>
|
||||
</ClCompile>
|
||||
@@ -861,6 +873,9 @@
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_hid.c">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_immdevice.c">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_windows.c">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClCompile>
|
||||
@@ -915,6 +930,9 @@
|
||||
<ClCompile Include="..\..\src\hidapi\SDL_hidapi.c">
|
||||
<Filter>hidapi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\controller_type.c">
|
||||
<Filter>joystick</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
|
||||
<Filter>joystick</Filter>
|
||||
</ClCompile>
|
||||
@@ -1029,7 +1047,7 @@
|
||||
<ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c">
|
||||
<Filter>joystick\dummy</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c">
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_combined.c">
|
||||
<Filter>joystick\hidapi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_gamecube.c">
|
||||
@@ -1047,6 +1065,9 @@
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c">
|
||||
<Filter>joystick\hidapi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c">
|
||||
<Filter>joystick\hidapi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_stadia.c">
|
||||
<Filter>joystick\hidapi</Filter>
|
||||
</ClCompile>
|
||||
@@ -1059,6 +1080,9 @@
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360w.c">
|
||||
<Filter>joystick\hidapi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c">
|
||||
<Filter>joystick\hidapi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c">
|
||||
<Filter>joystick\hidapi</Filter>
|
||||
</ClCompile>
|
||||
@@ -1203,7 +1227,7 @@
|
||||
<ClCompile Include="..\..\src\thread\SDL_thread.c">
|
||||
<Filter>thread</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\thread\windows\SDL_syscond_cv.c" >
|
||||
<ClCompile Include="..\..\src\thread\windows\SDL_syscond_cv.c">
|
||||
<Filter>thread\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c">
|
||||
@@ -1221,6 +1245,9 @@
|
||||
<ClCompile Include="..\..\src\thread\generic\SDL_syscond.c">
|
||||
<Filter>thread\generic</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_crc16.c">
|
||||
<Filter>stdlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stdlib\SDL_crc32.c">
|
||||
<Filter>stdlib</Filter>
|
||||
</ClCompile>
|
||||
@@ -1318,6 +1345,12 @@
|
||||
<ClCompile Include="..\..\src\power\windows\SDL_syspower.c">
|
||||
<Filter>power\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d12\SDL_render_d3d12.c">
|
||||
<Filter>render\direct3d12</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.c">
|
||||
<Filter>render\direct3d12</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\main\windows\version.rc" />
|
||||
@@ -0,0 +1,54 @@
|
||||
# based on the files generated by CMake's write_basic_package_version_file
|
||||
|
||||
# SDL2 CMake version configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC
|
||||
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_version.h")
|
||||
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the root of SDL2-devel-2.x.y-VC")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_version.h" _sdl_version_h)
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
|
||||
set(_sdl_major "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
|
||||
set(_sdl_minor "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)" _sdl_patch_re "${_sdl_version_h}")
|
||||
set(_sdl_patch "${CMAKE_MATCH_1}")
|
||||
if(_sdl_major_re AND _sdl_minor_re AND _sdl_patch_re)
|
||||
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_patch}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# Package version must be in the requested version range
|
||||
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if the using project doesn't have CMAKE_SIZEOF_VOID_P set, fail.
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT (CMAKE_SIZEOF_VOID_P STREQUAL "8" OR CMAKE_SIZEOF_VOID_P STREQUAL "4"))
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (32+64bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
@@ -0,0 +1,111 @@
|
||||
# SDL2 CMake configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL2 PROPERTIES
|
||||
URL "https://www.libsdl.org/"
|
||||
DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware"
|
||||
)
|
||||
|
||||
# Copied from `configure_package_config_file`
|
||||
macro(set_and_check _var _file)
|
||||
set(${_var} "${_file}")
|
||||
if(NOT EXISTS "${_file}")
|
||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Copied from `configure_package_config_file`
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
set(SDL2_FOUND TRUE)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P STREQUAL "4")
|
||||
set(_sdl_arch_subdir "x86")
|
||||
elseif(CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
set(_sdl_arch_subdir "x64")
|
||||
else()
|
||||
set(SDL2_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables.
|
||||
|
||||
set_and_check(SDL2_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
set_and_check(SDL2_EXEC_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
set_and_check(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include")
|
||||
set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}")
|
||||
set_and_check(SDL2_BINDIR "${SDL2_PREFIX}/lib/${_sdl_arch_subdir}")
|
||||
set_and_check(SDL2_LIBDIR "${SDL2_PREFIX}/lib/${_sdl_arch_subdir}")
|
||||
|
||||
set(SDL2_LIBRARIES SDL2::SDL2main SDL2::SDL2)
|
||||
set(SDL2MAIN_LIBRARY SDL2::SDL2main)
|
||||
set(SDL2TEST_LIBRARY SDL2::SDL2test)
|
||||
|
||||
|
||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||
# This is done for compatibility with CMake generated SDL2-target.cmake files.
|
||||
|
||||
set(_sdl2_library "${SDL2_LIBDIR}/SDL2.lib")
|
||||
set(_sdl2_dll_library "${SDL2_BINDIR}/SDL2.dll")
|
||||
if(EXISTS "${_sdl2_library}" AND EXISTS "${_sdl2_dll_library}")
|
||||
if(NOT TARGET SDL2::SDL2)
|
||||
add_library(SDL2::SDL2 SHARED IMPORTED)
|
||||
set_target_properties(SDL2::SDL2
|
||||
PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
|
||||
IMPORTED_IMPLIB "${_sdl2_library}"
|
||||
IMPORTED_LOCATION "${_sdl2_dll_library}"
|
||||
COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
|
||||
INTERFACE_SDL2_SHARED "ON"
|
||||
)
|
||||
endif()
|
||||
set(SDL2_SDL2_FOUND TRUE)
|
||||
else()
|
||||
set(SDL2_SDL2_FOUND FALSE)
|
||||
endif()
|
||||
unset(_sdl2_library)
|
||||
unset(_sdl2_dll_library)
|
||||
|
||||
set(_sdl2main_library "${SDL2_LIBDIR}/SDL2main.lib")
|
||||
if(EXISTS "${_sdl2main_library}")
|
||||
if(NOT TARGET SDL2::SDL2main)
|
||||
add_library(SDL2::SDL2main STATIC IMPORTED)
|
||||
set_target_properties(SDL2::SDL2main
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${_sdl2main_library}"
|
||||
)
|
||||
endif()
|
||||
set(SDL2_SDL2main_FOUND TRUE)
|
||||
else()
|
||||
set(SDL2_SDL2_FOUND FALSE)
|
||||
endif()
|
||||
unset(_sdl2main_library)
|
||||
|
||||
set(_sdl2test_library "${SDL2_LIBDIR}/SDL2test.lib")
|
||||
if(EXISTS "${_sdl2test_library}")
|
||||
if(NOT TARGET SDL2::SDL2test)
|
||||
add_library(SDL2::SDL2test STATIC IMPORTED)
|
||||
set_target_properties(SDL2::SDL2test
|
||||
PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${_sdl2test_library}"
|
||||
)
|
||||
endif()
|
||||
set(SDL2_SDL2test_FOUND TRUE)
|
||||
else()
|
||||
set(SDL2_SDL2_FOUND FALSE)
|
||||
endif()
|
||||
unset(_sdl2test_library)
|
||||
|
||||
check_required_components(SDL2)
|
||||
@@ -200,6 +200,12 @@
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
|
||||
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||
<Private>false</Private>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\checkkeys.c">
|
||||
@@ -216,4 +222,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -271,6 +271,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\controllermap.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
@@ -203,6 +203,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\Test\loopwave.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\..\test\sample.wav">
|
||||
@@ -227,4 +228,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -206,9 +206,12 @@
|
||||
<ClCompile Include="..\..\..\test\testautomation_audio.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_clipboard.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_events.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_guid.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_hints.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_joystick.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_keyboard.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_main.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_math.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_mouse.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_pixels.c" />
|
||||
<ClCompile Include="..\..\..\test\testautomation_platform.c" />
|
||||
@@ -228,4 +231,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -271,6 +271,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testgamecontroller.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
@@ -217,6 +217,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testoverlay2.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
<ClCompile Include="..\..\..\test\testyuv_cvt.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
@@ -241,8 +241,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testrendertarget.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -241,8 +241,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testscale.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||