rollmorad hinzugefügt
This commit is contained in:
commit
948a6775ab
100
build/linux/Makefile
Normal file
100
build/linux/Makefile
Normal file
@ -0,0 +1,100 @@
|
||||
#COMPILER
|
||||
CC = g++
|
||||
|
||||
#Compilerflags
|
||||
CFLAGS = -O2 -c
|
||||
|
||||
#pfad zu os-spezifischen dateien
|
||||
OS = linux
|
||||
|
||||
#Objekt-Dateien (abhängigkeiten von main)
|
||||
OBJ = $(TEMP_PATH)*.o
|
||||
|
||||
#Quelltexte
|
||||
SRC := $(SRC_PATH)$(wildcard *.cpp)
|
||||
|
||||
#schreibbarbeit sparen
|
||||
IC = include/
|
||||
LB = lib/
|
||||
|
||||
#PFADE
|
||||
LIBS_PATH = libs/
|
||||
SRC_PATH = ../../src/
|
||||
INCLUDE_PATH = $(SRC_PATH)
|
||||
#INCLUDE = ../../$(IC)
|
||||
TOOLS = ../../tools/
|
||||
|
||||
#Tools
|
||||
ADDNEWLINE = $(TOOLS)addnewline/addnewline
|
||||
|
||||
#muss noch überarbeitet werden
|
||||
BIN_PATH = bin/
|
||||
TEMP_PATH = temp/
|
||||
|
||||
#Versionen der Bibliotheken -> pfade, unter denen libraries etc zu finden sind
|
||||
VER_BOX2D = box2d-svn
|
||||
VER_OGG = ogg-1.1.3
|
||||
VER_OPENAL = openal-1.1.0
|
||||
VER_SDL = sdl-1.2.13
|
||||
VER_SDL_IMAGE = sdl_image-1.2.6
|
||||
VER_TINYXML = tinyxml-2.5.3
|
||||
VER_VORBIS = vorbis-1.2.0
|
||||
|
||||
#Namen der statisch zu linkenden Bibliotheken.
|
||||
#------------
|
||||
#UGJBPIGB
|
||||
#(JA, HIER MUSS NOCH WAS HIN...)
|
||||
|
||||
#Librarys (pfade) (obsolet durch statisches linken(s.o.)?)
|
||||
LIP_BOX2D = $(LIBS_PATH)$(VER_BOX2D)/$(LB)
|
||||
LIP_OGG = $(LIBS_PATH)$(VER_OGG)/$(LB)
|
||||
LIP_OPENAL = $(LIBS_PATH)$(VER_OPENAL)/$(LB)
|
||||
LIP_SDL = $(LIBS_PATH)$(VER_SDL)/$(LB)
|
||||
LIP_SDL_IMAGE = $(LIBS_PATH)$(VER_SDL_IMAGE)/$(LB)
|
||||
LIP_TINYXML = $(LIBS_PATH)$(VER_TINYXML)/$(LB)
|
||||
LIP_VORBIS = $(LIBS_PATH)$(VER_VORBIS)/$(LB)
|
||||
|
||||
LIP_ALL = -L$(LIP_BOX2D) -L$(LIP_OGG) -L$(LIP_OPENAL) -L$(LIP_SDL) -L$(LIP_SDL_IMAGE) -L$(LIP_TINYXML) -L$(LIP_VORBIS)
|
||||
|
||||
#zu linkende Libraries (obsolet durch statisches linken(s.o.)?)
|
||||
LINK_BOX2D = -lbox2d
|
||||
LINK_OGG = -logg
|
||||
LINK_OPENAL = -lopenal
|
||||
LINK_SDL = -lSDL -lSDLmain
|
||||
LINK_SDL_IMAGE = -lSDL_image
|
||||
LINK_SDL_IMAGE_FORMATS = -lpng -ltiff -ljpeg -lz
|
||||
LINK_TINYXML = -ltinyxml
|
||||
LINK_VORBIS = -lvorbisfile -lvorbis
|
||||
LINK_OPENGL = -lGL -lglut
|
||||
|
||||
LINK_ALL = $(LINK_SDL) $(LINK_SDL_IMAGE) $(LINK_SDL_IMAGE_FORMATS) $(LINK_VORBIS) $(LINK_OGG) $(LINK_BOX2D) $(LINK_TINYXML) $(LINK_OPENGL) $(LINK_OPENAL)
|
||||
|
||||
#Bibliotheken-Header (pfade)
|
||||
INC_BOX2D = $(LIBS_PATH)$(VER_BOX2D)/$(IC)Include/
|
||||
INC_OGG = $(LIBS_PATH)$(VER_OGG)/$(IC)ogg/
|
||||
INC_OPENAL = $(LIBS_PATH)$(VER_OPENAL)/$(IC)
|
||||
INC_SDL = $(LIBS_PATH)$(VER_SDL)/$(IC)
|
||||
INC_SDL_IMAGE = $(LIBS_PATH)$(VER_SDL_IMAGE)/$(IC)
|
||||
INC_TINYXML = $(LIBS_PATH)$(VER_TINYXML)/$(IC)
|
||||
INC_VORBIS = $(LIBS_PATH)$(VER_VORBIS)/$(IC)
|
||||
|
||||
INC_ALL = -I$(INC_SDL) -I$(INC_SDL_IMAGE) -I$(INC_BOX2D) -I$(INC_TINYXML) -I$(INC_OGG) -I$(INC_VORBIS) -I$(INC_OPENAL) -I$(INCLUDE_PATH)
|
||||
|
||||
default: all
|
||||
|
||||
all: $(OBJ)
|
||||
$(CC) $(TEMP_PATH)*.o $(LIP_ALL) $(LINK_ALL) -o $(BIN_PATH)rollmorad
|
||||
|
||||
%.o: $(SRC_PATH)%.cpp
|
||||
mkdir -p $(TEMP_PATH)
|
||||
$(ADDNEWLINE) $(SRC_PATH)*.cpp $(INCLUDE_PATH)*.h
|
||||
$(CC) $(CFLAGS) $(SRC_PATH)$*.cpp -o $(TEMP_PATH)$@ $(INC_ALL)
|
||||
|
||||
clean:
|
||||
rm -rf $(TEMP_PATH)
|
||||
|
||||
real_clean: clean
|
||||
rm -f $(BIN_PATH)*
|
||||
|
||||
test:
|
||||
echo $(SRC)
|
63
build/linux/build.sh
Normal file
63
build/linux/build.sh
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm ../../src/pch.h.gch
|
||||
rm bin/*
|
||||
|
||||
CC="g++ -c -O3"
|
||||
INCLUDE_PATHS="-I libs/sdl-1.2.13/include -I libs/sdl_image-1.2.6/include -I libs/box2d-svn/include/Include -I libs/tinyxml-2.5.3/include -I libs/ogg-1.1.3/include -I libs/vorbis-1.2.0/include"
|
||||
|
||||
echo "Erzeuge vorkompilierten Header ..."
|
||||
|
||||
$CC ../../src/pch.h -o ../../src/pch.h.gch $INCLUDE_PATHS
|
||||
|
||||
echo "Kompiliere ..."
|
||||
|
||||
$CC ../../src/application.cpp -o bin/application.o $INCLUDE_PATHS
|
||||
$CC ../../src/blendtransition.cpp -o bin/blendtransition.o $INCLUDE_PATHS
|
||||
$CC ../../src/checkpointobject.cpp -o bin/checkpointobject.o $INCLUDE_PATHS
|
||||
$CC ../../src/cubetransition.cpp -o bin/cubetransition.o $INCLUDE_PATHS
|
||||
$CC ../../src/creditsstate.cpp -o bin/creditsstate.o $INCLUDE_PATHS
|
||||
$CC ../../src/dummyobject.cpp -o bin/dummyobject.o $INCLUDE_PATHS
|
||||
$CC ../../src/filelocator.cpp -o bin/filelocator.o $INCLUDE_PATHS
|
||||
$CC ../../src/font.cpp -o bin/font.o $INCLUDE_PATHS
|
||||
$CC ../../src/gamestate.cpp -o bin/gamestate.o $INCLUDE_PATHS
|
||||
$CC ../../src/guhaselnutobject.cpp -o bin/guhaselnutobject.o $INCLUDE_PATHS
|
||||
$CC ../../src/highscoremanager.cpp -o bin/highscoremanager.o $INCLUDE_PATHS
|
||||
$CC ../../src/highscorestate.cpp -o bin/highscorestate.o $INCLUDE_PATHS
|
||||
$CC ../../src/homebaseobject.cpp -o bin/homebaseobject.o $INCLUDE_PATHS
|
||||
$CC ../../src/imagelayer.cpp -o bin/imagelayer.o $INCLUDE_PATHS
|
||||
$CC ../../src/kingareaobject.cpp -o bin/kingareaobject.o $INCLUDE_PATHS
|
||||
$CC ../../src/layer.cpp -o bin/layer.o $INCLUDE_PATHS
|
||||
$CC ../../src/level.cpp -o bin/level.o $INCLUDE_PATHS
|
||||
$CC ../../src/main.cpp -o bin/main.o $INCLUDE_PATHS
|
||||
$CC ../../src/mainmenustate.cpp -o bin/mainmenustate.o $INCLUDE_PATHS
|
||||
$CC ../../src/mtrand.cpp -o bin/mtrand.o $INCLUDE_PATHS
|
||||
$CC ../../src/object.cpp -o bin/object.o $INCLUDE_PATHS
|
||||
$CC ../../src/parametermap.cpp -o bin/parametermap.o $INCLUDE_PATHS
|
||||
$CC ../../src/physicsstate.cpp -o bin/physicsstate.o $INCLUDE_PATHS
|
||||
$CC ../../src/playerobject.cpp -o bin/playerobject.o $INCLUDE_PATHS
|
||||
$CC ../../src/referencecounted.cpp -o bin/referencecounted.o $INCLUDE_PATHS
|
||||
$CC ../../src/resource.cpp -o bin/resource.o $INCLUDE_PATHS
|
||||
$CC ../../src/resourcemanager.cpp -o bin/resourcemanager.o $INCLUDE_PATHS
|
||||
$CC ../../src/rgba.cpp -o bin/rgba.o $INCLUDE_PATHS
|
||||
$CC ../../src/simpleobject.cpp -o bin/simpleobject.o $INCLUDE_PATHS
|
||||
$CC ../../src/sound.cpp -o bin/sound.o $INCLUDE_PATHS
|
||||
$CC ../../src/soundinstance.cpp -o bin/soundinstance.o $INCLUDE_PATHS
|
||||
$CC ../../src/state.cpp -o bin/state.o $INCLUDE_PATHS
|
||||
$CC ../../src/textobject.cpp -o bin/textobject.o $INCLUDE_PATHS
|
||||
$CC ../../src/texture.cpp -o bin/texture.o $INCLUDE_PATHS
|
||||
$CC ../../src/tile.cpp -o bin/tile.o $INCLUDE_PATHS
|
||||
$CC ../../src/tilemaplayer.cpp -o bin/tilemaplayer.o $INCLUDE_PATHS
|
||||
$CC ../../src/tileset.cpp -o bin/tileset.o $INCLUDE_PATHS
|
||||
$CC ../../src/transition.cpp -o bin/transition.o $INCLUDE_PATHS
|
||||
$CC ../../src/utils.cpp -o bin/utils.o $INCLUDE_PATHS
|
||||
|
||||
echo "Linke ..."
|
||||
|
||||
LINK_LIBRARIES="libs/sdl_image-1.2.6/lib/libSDL_image.a libs/sdl-1.2.13/lib/libSDL.a libs/sdl-1.2.13/lib/libSDLmain.a libs/sdl_image-1.2.6/lib/libpng.a libs/sdl_image-1.2.6/lib/libtiff.a libs/sdl_image-1.2.6/lib/libjpeg.a libs/sdl_image-1.2.6/lib/libz.a libs/vorbis-1.2.0/lib/libvorbisfile.a libs/vorbis-1.2.0/lib/libvorbis.a libs/ogg-1.1.3/lib/libogg.a libs/box2d-svn/lib/libbox2d.a libs/tinyxml-2.5.3/lib/libtinyxml.a -lGL -lGLU -lopenal"
|
||||
|
||||
g++ -o bin/rollmorad bin/*.o $LINK_LIBRARIES
|
||||
|
||||
echo "Strippe ..."
|
||||
|
||||
strip --strip-all bin/rollmorad
|
52
build/linux/libs/box2d-svn/include/Include/Box2D.h
Normal file
52
build/linux/libs/box2d-svn/include/Include/Box2D.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef BOX2D_H
|
||||
#define BOX2D_H
|
||||
|
||||
/**
|
||||
\mainpage Box2D API Documentation
|
||||
|
||||
\section intro_sec Getting Started
|
||||
|
||||
For tutorials please see http://www.box2d.org/manual.html
|
||||
|
||||
For discussion please visit http://www.box2d.org/forum
|
||||
*/
|
||||
|
||||
// These include files constitute the main Box2D API
|
||||
|
||||
#include "../Source/Common/b2Settings.h"
|
||||
|
||||
#include "../Source/Collision/Shapes/b2CircleShape.h"
|
||||
#include "../Source/Collision/Shapes/b2PolygonShape.h"
|
||||
#include "../Source/Collision/b2BroadPhase.h"
|
||||
#include "../Source/Dynamics/b2WorldCallbacks.h"
|
||||
#include "../Source/Dynamics/b2World.h"
|
||||
#include "../Source/Dynamics/b2Body.h"
|
||||
|
||||
#include "../Source/Dynamics/Contacts/b2Contact.h"
|
||||
|
||||
#include "../Source/Dynamics/Joints/b2DistanceJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2MouseJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2PrismaticJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2RevoluteJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2PulleyJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2GearJoint.h"
|
||||
|
||||
#endif
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_CIRCLE_SHAPE_H
|
||||
#define B2_CIRCLE_SHAPE_H
|
||||
|
||||
#include "b2Shape.h"
|
||||
|
||||
/// This structure is used to build circle shapes.
|
||||
struct b2CircleDef : public b2ShapeDef
|
||||
{
|
||||
b2CircleDef()
|
||||
{
|
||||
type = e_circleShape;
|
||||
localPosition.SetZero();
|
||||
radius = 1.0f;
|
||||
}
|
||||
|
||||
b2Vec2 localPosition;
|
||||
float32 radius;
|
||||
};
|
||||
|
||||
/// A circle shape.
|
||||
class b2CircleShape : public b2Shape
|
||||
{
|
||||
public:
|
||||
/// @see b2Shape::TestPoint
|
||||
bool TestPoint(const b2XForm& transform, const b2Vec2& p) const;
|
||||
|
||||
/// @see b2Shape::TestSegment
|
||||
bool TestSegment( const b2XForm& transform,
|
||||
float32* lambda,
|
||||
b2Vec2* normal,
|
||||
const b2Segment& segment,
|
||||
float32 maxLambda) const;
|
||||
|
||||
/// @see b2Shape::ComputeAABB
|
||||
void ComputeAABB(b2AABB* aabb, const b2XForm& transform) const;
|
||||
|
||||
/// @see b2Shape::ComputeSweptAABB
|
||||
void ComputeSweptAABB( b2AABB* aabb,
|
||||
const b2XForm& transform1,
|
||||
const b2XForm& transform2) const;
|
||||
|
||||
/// @see b2Shape::ComputeMass
|
||||
void ComputeMass(b2MassData* massData) const;
|
||||
|
||||
/// Get the local position of this circle in its parent body.
|
||||
const b2Vec2& GetLocalPosition() const;
|
||||
|
||||
/// Get the radius of this circle.
|
||||
float32 GetRadius() const;
|
||||
|
||||
private:
|
||||
|
||||
friend class b2Shape;
|
||||
|
||||
b2CircleShape(const b2ShapeDef* def);
|
||||
|
||||
void UpdateSweepRadius(const b2Vec2& center);
|
||||
|
||||
// Local position in parent body
|
||||
b2Vec2 m_localPosition;
|
||||
float32 m_radius;
|
||||
};
|
||||
|
||||
inline const b2Vec2& b2CircleShape::GetLocalPosition() const
|
||||
{
|
||||
return m_localPosition;
|
||||
}
|
||||
|
||||
inline float32 b2CircleShape::GetRadius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_POLYGON_SHAPE_H
|
||||
#define B2_POLYGON_SHAPE_H
|
||||
|
||||
#include "b2Shape.h"
|
||||
|
||||
/// Convex polygon. The vertices must be in CCW order for a right-handed
|
||||
/// coordinate system with the z-axis coming out of the screen.
|
||||
struct b2PolygonDef : public b2ShapeDef
|
||||
{
|
||||
b2PolygonDef()
|
||||
{
|
||||
type = e_polygonShape;
|
||||
vertexCount = 0;
|
||||
}
|
||||
|
||||
/// Build vertices to represent an axis-aligned box.
|
||||
/// @param hx the half-width.
|
||||
/// @param hy the half-height.
|
||||
void SetAsBox(float32 hx, float32 hy);
|
||||
|
||||
/// Build vertices to represent an oriented box.
|
||||
/// @param hx the half-width.
|
||||
/// @param hy the half-height.
|
||||
/// @param center the center of the box in local coordinates.
|
||||
/// @param angle the rotation of the box in local coordinates.
|
||||
void SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle);
|
||||
|
||||
/// The polygon vertices in local coordinates.
|
||||
b2Vec2 vertices[b2_maxPolygonVertices];
|
||||
|
||||
/// The number of polygon vertices.
|
||||
int32 vertexCount;
|
||||
};
|
||||
|
||||
|
||||
/// A convex polygon.
|
||||
class b2PolygonShape : public b2Shape
|
||||
{
|
||||
public:
|
||||
/// @see b2Shape::TestPoint
|
||||
bool TestPoint(const b2XForm& transform, const b2Vec2& p) const;
|
||||
|
||||
/// @see b2Shape::TestSegment
|
||||
bool TestSegment( const b2XForm& transform,
|
||||
float32* lambda,
|
||||
b2Vec2* normal,
|
||||
const b2Segment& segment,
|
||||
float32 maxLambda) const;
|
||||
|
||||
/// @see b2Shape::ComputeAABB
|
||||
void ComputeAABB(b2AABB* aabb, const b2XForm& transform) const;
|
||||
|
||||
/// @see b2Shape::ComputeSweptAABB
|
||||
void ComputeSweptAABB( b2AABB* aabb,
|
||||
const b2XForm& transform1,
|
||||
const b2XForm& transform2) const;
|
||||
|
||||
/// @see b2Shape::ComputeMass
|
||||
void ComputeMass(b2MassData* massData) const;
|
||||
|
||||
/// Get the oriented bounding box relative to the parent body.
|
||||
const b2OBB& GetOBB() const;
|
||||
|
||||
/// Get local centroid relative to the parent body.
|
||||
const b2Vec2& GetCentroid() const;
|
||||
|
||||
/// Get the vertex count.
|
||||
int32 GetVertexCount() const;
|
||||
|
||||
/// Get the vertices in local coordinates.
|
||||
const b2Vec2* GetVertices() const;
|
||||
|
||||
/// Get the core vertices in local coordinates. These vertices
|
||||
/// represent a smaller polygon that is used for time of impact
|
||||
/// computations.
|
||||
const b2Vec2* GetCoreVertices() const;
|
||||
|
||||
/// Get the edge normal vectors. There is one for each vertex.
|
||||
const b2Vec2* GetNormals() const;
|
||||
|
||||
/// Get the first vertex and apply the supplied transform.
|
||||
b2Vec2 GetFirstVertex(const b2XForm& xf) const;
|
||||
|
||||
/// Get the centroid and apply the supplied transform.
|
||||
b2Vec2 Centroid(const b2XForm& xf) const;
|
||||
|
||||
/// Get the support point in the given world direction.
|
||||
/// Use the supplied transform.
|
||||
b2Vec2 Support(const b2XForm& xf, const b2Vec2& d) const;
|
||||
|
||||
private:
|
||||
|
||||
friend class b2Shape;
|
||||
|
||||
b2PolygonShape(const b2ShapeDef* def);
|
||||
|
||||
void UpdateSweepRadius(const b2Vec2& center);
|
||||
|
||||
// Local position of the polygon centroid.
|
||||
b2Vec2 m_centroid;
|
||||
|
||||
b2OBB m_obb;
|
||||
|
||||
b2Vec2 m_vertices[b2_maxPolygonVertices];
|
||||
b2Vec2 m_normals[b2_maxPolygonVertices];
|
||||
b2Vec2 m_coreVertices[b2_maxPolygonVertices];
|
||||
int32 m_vertexCount;
|
||||
};
|
||||
|
||||
inline b2Vec2 b2PolygonShape::GetFirstVertex(const b2XForm& xf) const
|
||||
{
|
||||
return b2Mul(xf, m_coreVertices[0]);
|
||||
}
|
||||
|
||||
inline const b2OBB& b2PolygonShape::GetOBB() const
|
||||
{
|
||||
return m_obb;
|
||||
}
|
||||
|
||||
inline const b2Vec2& b2PolygonShape::GetCentroid() const
|
||||
{
|
||||
return m_centroid;
|
||||
}
|
||||
|
||||
inline int32 b2PolygonShape::GetVertexCount() const
|
||||
{
|
||||
return m_vertexCount;
|
||||
}
|
||||
|
||||
inline const b2Vec2* b2PolygonShape::GetVertices() const
|
||||
{
|
||||
return m_vertices;
|
||||
}
|
||||
|
||||
inline const b2Vec2* b2PolygonShape::GetCoreVertices() const
|
||||
{
|
||||
return m_coreVertices;
|
||||
}
|
||||
|
||||
inline const b2Vec2* b2PolygonShape::GetNormals() const
|
||||
{
|
||||
return m_normals;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_SHAPE_H
|
||||
#define B2_SHAPE_H
|
||||
|
||||
#include "../../Common/b2Math.h"
|
||||
#include "../b2Collision.h"
|
||||
|
||||
class b2BlockAllocator;
|
||||
class b2Body;
|
||||
class b2BroadPhase;
|
||||
|
||||
/// This holds the mass data computed for a shape.
|
||||
struct b2MassData
|
||||
{
|
||||
/// The mass of the shape, usually in kilograms.
|
||||
float32 mass;
|
||||
|
||||
/// The position of the shape's centroid relative to the shape's origin.
|
||||
b2Vec2 center;
|
||||
|
||||
/// The rotational inertia of the shape.
|
||||
float32 I;
|
||||
};
|
||||
|
||||
/// This holds contact filtering data.
|
||||
struct b2FilterData
|
||||
{
|
||||
/// The collision category bits. Normally you would just set one bit.
|
||||
uint16 categoryBits;
|
||||
|
||||
/// The collision mask bits. This states the categories that this
|
||||
/// shape would accept for collision.
|
||||
uint16 maskBits;
|
||||
|
||||
/// Collision groups allow a certain group of objects to never collide (negative)
|
||||
/// or always collide (positive). Zero means no collision group. Non-zero group
|
||||
/// filtering always wins against the mask bits.
|
||||
int16 groupIndex;
|
||||
};
|
||||
|
||||
/// The various collision shape types supported by Box2D.
|
||||
enum b2ShapeType
|
||||
{
|
||||
e_unknownShape = -1,
|
||||
e_circleShape,
|
||||
e_polygonShape,
|
||||
e_shapeTypeCount,
|
||||
};
|
||||
|
||||
/// A shape definition is used to construct a shape. This class defines an
|
||||
/// abstract shape definition. You can reuse shape definitions safely.
|
||||
struct b2ShapeDef
|
||||
{
|
||||
/// The constructor sets the default shape definition values.
|
||||
b2ShapeDef()
|
||||
{
|
||||
type = e_unknownShape;
|
||||
userData = NULL;
|
||||
friction = 0.2f;
|
||||
restitution = 0.0f;
|
||||
density = 0.0f;
|
||||
filter.categoryBits = 0x0001;
|
||||
filter.maskBits = 0xFFFF;
|
||||
filter.groupIndex = 0;
|
||||
isSensor = false;
|
||||
}
|
||||
|
||||
virtual ~b2ShapeDef() {}
|
||||
|
||||
/// Holds the shape type for down-casting.
|
||||
b2ShapeType type;
|
||||
|
||||
/// Use this to store application specify shape data.
|
||||
void* userData;
|
||||
|
||||
/// The shape's friction coefficient, usually in the range [0,1].
|
||||
float32 friction;
|
||||
|
||||
/// The shape's restitution (elasticity) usually in the range [0,1].
|
||||
float32 restitution;
|
||||
|
||||
/// The shape's density, usually in kg/m^2.
|
||||
float32 density;
|
||||
|
||||
/// A sensor shape collects contact information but never generates a collision
|
||||
/// response.
|
||||
bool isSensor;
|
||||
|
||||
/// Contact filtering data.
|
||||
b2FilterData filter;
|
||||
};
|
||||
|
||||
/// A shape is used for collision detection. Shapes are created in b2World.
|
||||
/// You can use shape for collision detection before they are attached to the world.
|
||||
/// @warning you cannot reuse shapes.
|
||||
class b2Shape
|
||||
{
|
||||
public:
|
||||
/// Get the type of this shape. You can use this to down cast to the concrete shape.
|
||||
/// @return the shape type.
|
||||
b2ShapeType GetType() const;
|
||||
|
||||
/// Is this shape a sensor (non-solid)?
|
||||
/// @return the true if the shape is a sensor.
|
||||
bool IsSensor() const;
|
||||
|
||||
/// Set the contact filtering data. You must call b2World::Refilter to correct
|
||||
/// existing contacts/non-contacts.
|
||||
void SetFilterData(const b2FilterData& filter);
|
||||
|
||||
/// Get the contact filtering data.
|
||||
const b2FilterData& GetFilterData() const;
|
||||
|
||||
/// Get the parent body of this shape. This is NULL if the shape is not attached.
|
||||
/// @return the parent body.
|
||||
b2Body* GetBody();
|
||||
|
||||
/// Get the next shape in the parent body's shape list.
|
||||
/// @return the next shape.
|
||||
b2Shape* GetNext();
|
||||
|
||||
/// Get the user data that was assigned in the shape definition. Use this to
|
||||
/// store your application specific data.
|
||||
void* GetUserData();
|
||||
|
||||
/// Set the user data. Use this to store your application specific data.
|
||||
void SetUserData(void* data);
|
||||
|
||||
/// Test a point for containment in this shape. This only works for convex shapes.
|
||||
/// @param xf the shape world transform.
|
||||
/// @param p a point in world coordinates.
|
||||
virtual bool TestPoint(const b2XForm& xf, const b2Vec2& p) const = 0;
|
||||
|
||||
/// Perform a ray cast against this shape.
|
||||
/// @param xf the shape world transform.
|
||||
/// @param lambda returns the hit fraction. You can use this to compute the contact point
|
||||
/// p = (1 - lambda) * segment.p1 + lambda * segment.p2.
|
||||
/// @param normal returns the normal at the contact point. If there is no intersection, the normal
|
||||
/// is not set.
|
||||
/// @param segment defines the begin and end point of the ray cast.
|
||||
/// @param maxLambda a number typically in the range [0,1].
|
||||
/// @return true if there was an intersection.
|
||||
virtual bool TestSegment( const b2XForm& xf,
|
||||
float32* lambda,
|
||||
b2Vec2* normal,
|
||||
const b2Segment& segment,
|
||||
float32 maxLambda) const = 0;
|
||||
|
||||
/// Given a transform, compute the associated axis aligned bounding box for this shape.
|
||||
/// @param aabb returns the axis aligned box.
|
||||
/// @param xf the world transform of the shape.
|
||||
virtual void ComputeAABB(b2AABB* aabb, const b2XForm& xf) const = 0;
|
||||
|
||||
/// Given two transforms, compute the associated swept axis aligned bounding box for this shape.
|
||||
/// @param aabb returns the axis aligned box.
|
||||
/// @param xf1 the starting shape world transform.
|
||||
/// @param xf2 the ending shape world transform.
|
||||
virtual void ComputeSweptAABB( b2AABB* aabb,
|
||||
const b2XForm& xf1,
|
||||
const b2XForm& xf2) const = 0;
|
||||
|
||||
/// Compute the mass properties of this shape using its dimensions and density.
|
||||
/// The inertia tensor is computed about the local origin, not the centroid.
|
||||
/// @param massData returns the mass data for this shape.
|
||||
virtual void ComputeMass(b2MassData* massData) const = 0;
|
||||
|
||||
/// Get the maximum radius about the parent body's center of mass.
|
||||
float32 GetSweepRadius() const;
|
||||
|
||||
/// Get the coefficient of friction.
|
||||
float32 GetFriction() const;
|
||||
|
||||
/// Get the coefficient of restitution.
|
||||
float32 GetRestitution() const;
|
||||
|
||||
protected:
|
||||
|
||||
friend class b2Body;
|
||||
friend class b2World;
|
||||
|
||||
static b2Shape* Create(const b2ShapeDef* def, b2BlockAllocator* allocator);
|
||||
static void Destroy(b2Shape* shape, b2BlockAllocator* allocator);
|
||||
|
||||
b2Shape(const b2ShapeDef* def);
|
||||
virtual ~b2Shape();
|
||||
|
||||
void CreateProxy(b2BroadPhase* broadPhase, const b2XForm& xf);
|
||||
void DestroyProxy(b2BroadPhase* broadPhase);
|
||||
bool Synchronize(b2BroadPhase* broadPhase, const b2XForm& xf1, const b2XForm& xf2);
|
||||
void RefilterProxy(b2BroadPhase* broadPhase, const b2XForm& xf);
|
||||
|
||||
virtual void UpdateSweepRadius(const b2Vec2& center) = 0;
|
||||
|
||||
b2ShapeType m_type;
|
||||
b2Shape* m_next;
|
||||
b2Body* m_body;
|
||||
|
||||
// Sweep radius relative to the parent body's center of mass.
|
||||
float32 m_sweepRadius;
|
||||
|
||||
float32 m_density;
|
||||
float32 m_friction;
|
||||
float32 m_restitution;
|
||||
|
||||
uint16 m_proxyId;
|
||||
b2FilterData m_filter;
|
||||
|
||||
bool m_isSensor;
|
||||
|
||||
void* m_userData;
|
||||
};
|
||||
|
||||
inline b2ShapeType b2Shape::GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
inline bool b2Shape::IsSensor() const
|
||||
{
|
||||
return m_isSensor;
|
||||
}
|
||||
|
||||
inline void b2Shape::SetFilterData(const b2FilterData& filter)
|
||||
{
|
||||
m_filter = filter;
|
||||
}
|
||||
|
||||
inline const b2FilterData& b2Shape::GetFilterData() const
|
||||
{
|
||||
return m_filter;
|
||||
}
|
||||
|
||||
inline void* b2Shape::GetUserData()
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
|
||||
inline void b2Shape::SetUserData(void* data)
|
||||
{
|
||||
m_userData = data;
|
||||
}
|
||||
|
||||
inline b2Body* b2Shape::GetBody()
|
||||
{
|
||||
return m_body;
|
||||
}
|
||||
|
||||
inline b2Shape* b2Shape::GetNext()
|
||||
{
|
||||
return m_next;
|
||||
}
|
||||
|
||||
inline float32 b2Shape::GetSweepRadius() const
|
||||
{
|
||||
return m_sweepRadius;
|
||||
}
|
||||
|
||||
inline float32 b2Shape::GetFriction() const
|
||||
{
|
||||
return m_friction;
|
||||
}
|
||||
|
||||
inline float32 b2Shape::GetRestitution() const
|
||||
{
|
||||
return m_restitution;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_BROAD_PHASE_H
|
||||
#define B2_BROAD_PHASE_H
|
||||
|
||||
/*
|
||||
This broad phase uses the Sweep and Prune algorithm as described in:
|
||||
Collision Detection in Interactive 3D Environments by Gino van den Bergen
|
||||
Also, some ideas, such as using integral values for fast compares comes from
|
||||
Bullet (http:/www.bulletphysics.com).
|
||||
*/
|
||||
|
||||
#include "../Common/b2Settings.h"
|
||||
#include "b2Collision.h"
|
||||
#include "b2PairManager.h"
|
||||
#include <climits>
|
||||
|
||||
#ifdef TARGET_FLOAT32_IS_FIXED
|
||||
#define B2BROADPHASE_MAX (USHRT_MAX/2)
|
||||
#else
|
||||
#define B2BROADPHASE_MAX USHRT_MAX
|
||||
|
||||
#endif
|
||||
|
||||
const uint16 b2_invalid = B2BROADPHASE_MAX;
|
||||
const uint16 b2_nullEdge = B2BROADPHASE_MAX;
|
||||
struct b2BoundValues;
|
||||
|
||||
struct b2Bound
|
||||
{
|
||||
bool IsLower() const { return (value & 1) == 0; }
|
||||
bool IsUpper() const { return (value & 1) == 1; }
|
||||
|
||||
uint16 value;
|
||||
uint16 proxyId;
|
||||
uint16 stabbingCount;
|
||||
};
|
||||
|
||||
struct b2Proxy
|
||||
{
|
||||
uint16 GetNext() const { return lowerBounds[0]; }
|
||||
void SetNext(uint16 next) { lowerBounds[0] = next; }
|
||||
bool IsValid() const { return overlapCount != b2_invalid; }
|
||||
|
||||
uint16 lowerBounds[2], upperBounds[2];
|
||||
uint16 overlapCount;
|
||||
uint16 timeStamp;
|
||||
void* userData;
|
||||
};
|
||||
|
||||
class b2BroadPhase
|
||||
{
|
||||
public:
|
||||
b2BroadPhase(const b2AABB& worldAABB, b2PairCallback* callback);
|
||||
~b2BroadPhase();
|
||||
|
||||
// Use this to see if your proxy is in range. If it is not in range,
|
||||
// it should be destroyed. Otherwise you may get O(m^2) pairs, where m
|
||||
// is the number of proxies that are out of range.
|
||||
bool InRange(const b2AABB& aabb) const;
|
||||
|
||||
// Create and destroy proxies. These call Flush first.
|
||||
uint16 CreateProxy(const b2AABB& aabb, void* userData);
|
||||
void DestroyProxy(int32 proxyId);
|
||||
|
||||
// Call MoveProxy as many times as you like, then when you are done
|
||||
// call Commit to finalized the proxy pairs (for your time step).
|
||||
void MoveProxy(int32 proxyId, const b2AABB& aabb);
|
||||
void Commit();
|
||||
|
||||
// Get a single proxy. Returns NULL if the id is invalid.
|
||||
b2Proxy* GetProxy(int32 proxyId);
|
||||
|
||||
// Query an AABB for overlapping proxies, returns the user data and
|
||||
// the count, up to the supplied maximum count.
|
||||
int32 Query(const b2AABB& aabb, void** userData, int32 maxCount);
|
||||
|
||||
void Validate();
|
||||
void ValidatePairs();
|
||||
|
||||
private:
|
||||
void ComputeBounds(uint16* lowerValues, uint16* upperValues, const b2AABB& aabb);
|
||||
|
||||
bool TestOverlap(b2Proxy* p1, b2Proxy* p2);
|
||||
bool TestOverlap(const b2BoundValues& b, b2Proxy* p);
|
||||
|
||||
void Query(int32* lowerIndex, int32* upperIndex, uint16 lowerValue, uint16 upperValue,
|
||||
b2Bound* bounds, int32 boundCount, int32 axis);
|
||||
void IncrementOverlapCount(int32 proxyId);
|
||||
void IncrementTimeStamp();
|
||||
|
||||
public:
|
||||
friend class b2PairManager;
|
||||
|
||||
b2PairManager m_pairManager;
|
||||
|
||||
b2Proxy m_proxyPool[b2_maxProxies];
|
||||
uint16 m_freeProxy;
|
||||
|
||||
b2Bound m_bounds[2][2*b2_maxProxies];
|
||||
|
||||
uint16 m_queryResults[b2_maxProxies];
|
||||
int32 m_queryResultCount;
|
||||
|
||||
b2AABB m_worldAABB;
|
||||
b2Vec2 m_quantizationFactor;
|
||||
int32 m_proxyCount;
|
||||
uint16 m_timeStamp;
|
||||
|
||||
static bool s_validate;
|
||||
};
|
||||
|
||||
|
||||
inline bool b2BroadPhase::InRange(const b2AABB& aabb) const
|
||||
{
|
||||
b2Vec2 d = b2Max(aabb.lowerBound - m_worldAABB.upperBound, m_worldAABB.lowerBound - aabb.upperBound);
|
||||
return b2Max(d.x, d.y) < 0.0f;
|
||||
}
|
||||
|
||||
inline b2Proxy* b2BroadPhase::GetProxy(int32 proxyId)
|
||||
{
|
||||
if (proxyId == b2_nullProxy || m_proxyPool[proxyId].IsValid() == false)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return m_proxyPool + proxyId;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_COLLISION_H
|
||||
#define B2_COLLISION_H
|
||||
|
||||
#include "../Common/b2Math.h"
|
||||
#include <climits>
|
||||
|
||||
/// @file
|
||||
/// Structures and functions used for computing contact points, distance
|
||||
/// queries, and TOI queries.
|
||||
|
||||
class b2Shape;
|
||||
class b2CircleShape;
|
||||
class b2PolygonShape;
|
||||
|
||||
const uint8 b2_nullFeature = UCHAR_MAX;
|
||||
|
||||
/// Contact ids to facilitate warm starting.
|
||||
union b2ContactID
|
||||
{
|
||||
/// The features that intersect to form the contact point
|
||||
struct Features
|
||||
{
|
||||
uint8 referenceEdge; ///< The edge that defines the outward contact normal.
|
||||
uint8 incidentEdge; ///< The edge most anti-parallel to the reference edge.
|
||||
uint8 incidentVertex; ///< The vertex (0 or 1) on the incident edge that was clipped.
|
||||
uint8 flip; ///< A value of 1 indicates that the reference edge is on shape2.
|
||||
} features;
|
||||
uint32 key; ///< Used to quickly compare contact ids.
|
||||
};
|
||||
|
||||
/// A manifold point is a contact point belonging to a contact
|
||||
/// manifold. It holds details related to the geometry and dynamics
|
||||
/// of the contact points.
|
||||
/// The point is stored in local coordinates because CCD
|
||||
/// requires sub-stepping in which the separation is stale.
|
||||
struct b2ManifoldPoint
|
||||
{
|
||||
b2Vec2 localPoint1; ///< local position of the contact point in body1
|
||||
b2Vec2 localPoint2; ///< local position of the contact point in body2
|
||||
float32 separation; ///< the separation of the shapes along the normal vector
|
||||
float32 normalImpulse; ///< the non-penetration impulse
|
||||
float32 tangentImpulse; ///< the friction impulse
|
||||
b2ContactID id; ///< uniquely identifies a contact point between two shapes
|
||||
};
|
||||
|
||||
/// A manifold for two touching convex shapes.
|
||||
struct b2Manifold
|
||||
{
|
||||
b2ManifoldPoint points[b2_maxManifoldPoints]; ///< the points of contact
|
||||
b2Vec2 normal; ///< the shared unit normal vector
|
||||
int32 pointCount; ///< the number of manifold points
|
||||
};
|
||||
|
||||
/// A line segment.
|
||||
struct b2Segment
|
||||
{
|
||||
/// Ray cast against this segment with another segment.
|
||||
bool TestSegment(float32* lambda, b2Vec2* normal, const b2Segment& segment, float32 maxLambda) const;
|
||||
|
||||
b2Vec2 p1; ///< the starting point
|
||||
b2Vec2 p2; ///< the ending point
|
||||
};
|
||||
|
||||
/// An axis aligned bounding box.
|
||||
struct b2AABB
|
||||
{
|
||||
/// Verify that the bounds are sorted.
|
||||
bool IsValid() const;
|
||||
|
||||
b2Vec2 lowerBound; ///< the lower vertex
|
||||
b2Vec2 upperBound; ///< the upper vertex
|
||||
};
|
||||
|
||||
/// An oriented bounding box.
|
||||
struct b2OBB
|
||||
{
|
||||
b2Mat22 R; ///< the rotation matrix
|
||||
b2Vec2 center; ///< the local centroid
|
||||
b2Vec2 extents; ///< the half-widths
|
||||
};
|
||||
|
||||
/// Compute the collision manifold between two circles.
|
||||
void b2CollideCircles(b2Manifold* manifold,
|
||||
const b2CircleShape* circle1, const b2XForm& xf1,
|
||||
const b2CircleShape* circle2, const b2XForm& xf2);
|
||||
|
||||
/// Compute the collision manifold between a polygon and a circle.
|
||||
void b2CollidePolygonAndCircle(b2Manifold* manifold,
|
||||
const b2PolygonShape* polygon, const b2XForm& xf1,
|
||||
const b2CircleShape* circle, const b2XForm& xf2);
|
||||
|
||||
/// Compute the collision manifold between two circles.
|
||||
void b2CollidePolygons(b2Manifold* manifold,
|
||||
const b2PolygonShape* polygon1, const b2XForm& xf1,
|
||||
const b2PolygonShape* polygon2, const b2XForm& xf2);
|
||||
|
||||
/// Compute the distance between two shapes and the closest points.
|
||||
/// @return the distance between the shapes or zero if they are overlapped/touching.
|
||||
float32 b2Distance(b2Vec2* x1, b2Vec2* x2,
|
||||
const b2Shape* shape1, const b2XForm& xf1,
|
||||
const b2Shape* shape2, const b2XForm& xf2);
|
||||
|
||||
/// Compute the time when two shapes begin to touch or touch at a closer distance.
|
||||
/// @warning the sweeps must have the same time interval.
|
||||
/// @return the fraction between [0,1] in which the shapes first touch.
|
||||
/// fraction=0 means the shapes begin touching/overlapped, and fraction=1 means the shapes don't touch.
|
||||
float32 b2TimeOfImpact(const b2Shape* shape1, const b2Sweep& sweep1,
|
||||
const b2Shape* shape2, const b2Sweep& sweep2);
|
||||
|
||||
|
||||
// ---------------- Inline Functions ------------------------------------------
|
||||
|
||||
inline bool b2AABB::IsValid() const
|
||||
{
|
||||
b2Vec2 d = upperBound - lowerBound;
|
||||
bool valid = d.x >= 0.0f && d.y >= 0.0f;
|
||||
valid = valid && lowerBound.IsValid() && upperBound.IsValid();
|
||||
return valid;
|
||||
}
|
||||
|
||||
inline bool b2TestOverlap(const b2AABB& a, const b2AABB& b)
|
||||
{
|
||||
b2Vec2 d1, d2;
|
||||
d1 = b.lowerBound - a.upperBound;
|
||||
d2 = a.lowerBound - b.upperBound;
|
||||
|
||||
if (d1.x > 0.0f || d1.y > 0.0f)
|
||||
return false;
|
||||
|
||||
if (d2.x > 0.0f || d2.y > 0.0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
// The pair manager is used by the broad-phase to quickly add/remove/find pairs
|
||||
// of overlapping proxies. It is based closely on code provided by Pierre Terdiman.
|
||||
// http://www.codercorner.com/IncrementalSAP.txt
|
||||
|
||||
#ifndef B2_PAIR_MANAGER_H
|
||||
#define B2_PAIR_MANAGER_H
|
||||
|
||||
#include "../Common/b2Settings.h"
|
||||
#include "../Common/b2Math.h"
|
||||
|
||||
#include <climits>
|
||||
|
||||
class b2BroadPhase;
|
||||
struct b2Proxy;
|
||||
|
||||
const uint16 b2_nullPair = USHRT_MAX;
|
||||
const uint16 b2_nullProxy = USHRT_MAX;
|
||||
const int32 b2_tableCapacity = b2_maxPairs; // must be a power of two
|
||||
const int32 b2_tableMask = b2_tableCapacity - 1;
|
||||
|
||||
struct b2Pair
|
||||
{
|
||||
enum
|
||||
{
|
||||
e_pairBuffered = 0x0001,
|
||||
e_pairRemoved = 0x0002,
|
||||
e_pairFinal = 0x0004,
|
||||
};
|
||||
|
||||
void SetBuffered() { status |= e_pairBuffered; }
|
||||
void ClearBuffered() { status &= ~e_pairBuffered; }
|
||||
bool IsBuffered() { return (status & e_pairBuffered) == e_pairBuffered; }
|
||||
|
||||
void SetRemoved() { status |= e_pairRemoved; }
|
||||
void ClearRemoved() { status &= ~e_pairRemoved; }
|
||||
bool IsRemoved() { return (status & e_pairRemoved) == e_pairRemoved; }
|
||||
|
||||
void SetFinal() { status |= e_pairFinal; }
|
||||
bool IsFinal() { return (status & e_pairFinal) == e_pairFinal; }
|
||||
|
||||
void* userData;
|
||||
uint16 proxyId1;
|
||||
uint16 proxyId2;
|
||||
uint16 next;
|
||||
uint16 status;
|
||||
};
|
||||
|
||||
struct b2BufferedPair
|
||||
{
|
||||
uint16 proxyId1;
|
||||
uint16 proxyId2;
|
||||
};
|
||||
|
||||
class b2PairCallback
|
||||
{
|
||||
public:
|
||||
virtual ~b2PairCallback() {}
|
||||
|
||||
// This should return the new pair user data. It is ok if the
|
||||
// user data is null.
|
||||
virtual void* PairAdded(void* proxyUserData1, void* proxyUserData2) = 0;
|
||||
|
||||
// This should free the pair's user data. In extreme circumstances, it is possible
|
||||
// this will be called with null pairUserData because the pair never existed.
|
||||
virtual void PairRemoved(void* proxyUserData1, void* proxyUserData2, void* pairUserData) = 0;
|
||||
};
|
||||
|
||||
class b2PairManager
|
||||
{
|
||||
public:
|
||||
b2PairManager();
|
||||
|
||||
void Initialize(b2BroadPhase* broadPhase, b2PairCallback* callback);
|
||||
|
||||
void AddBufferedPair(int32 proxyId1, int32 proxyId2);
|
||||
void RemoveBufferedPair(int32 proxyId1, int32 proxyId2);
|
||||
|
||||
void Commit();
|
||||
|
||||
private:
|
||||
b2Pair* Find(int32 proxyId1, int32 proxyId2);
|
||||
b2Pair* Find(int32 proxyId1, int32 proxyId2, uint32 hashValue);
|
||||
|
||||
b2Pair* AddPair(int32 proxyId1, int32 proxyId2);
|
||||
void* RemovePair(int32 proxyId1, int32 proxyId2);
|
||||
|
||||
void ValidateBuffer();
|
||||
void ValidateTable();
|
||||
|
||||
public:
|
||||
b2BroadPhase *m_broadPhase;
|
||||
b2PairCallback *m_callback;
|
||||
b2Pair m_pairs[b2_maxPairs];
|
||||
uint16 m_freePair;
|
||||
int32 m_pairCount;
|
||||
|
||||
b2BufferedPair m_pairBuffer[b2_maxPairs];
|
||||
int32 m_pairBufferCount;
|
||||
|
||||
uint16 m_hashTable[b2_tableCapacity];
|
||||
};
|
||||
|
||||
#endif
|
477
build/linux/libs/box2d-svn/include/Source/Common/Fixed.h
Normal file
477
build/linux/libs/box2d-svn/include/Source/Common/Fixed.h
Normal file
@ -0,0 +1,477 @@
|
||||
/*
|
||||
Copyright (c) 2006 Henry Strickland & Ryan Seto
|
||||
2007-2008 Tobias Weyand (modifications and extensions)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
(* http://www.opensource.org/licenses/mit-license.php *)
|
||||
*/
|
||||
|
||||
#ifndef _FIXED_H_
|
||||
#define _FIXED_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef TARGET_IS_NDS
|
||||
|
||||
#include "nds.h"
|
||||
|
||||
#endif
|
||||
|
||||
#define FIXED_BP 16
|
||||
#define FIXED_MAX ((1<<(32-FIXED_BP-1))-1)
|
||||
#define FIXED_MIN (-(1<<(32-FIXED_BP-1)))
|
||||
#define FIXED_EPSILON (Fixed(0.00007f))
|
||||
|
||||
#define G_1_DIV_PI 20861
|
||||
|
||||
class Fixed {
|
||||
|
||||
private:
|
||||
|
||||
int g; // the guts
|
||||
|
||||
const static int BP= FIXED_BP; // how many low bits are right of Binary Point
|
||||
const static int BP2= BP*2; // how many low bits are right of Binary Point
|
||||
const static int BPhalf= BP/2; // how many low bits are right of Binary Point
|
||||
|
||||
double STEP(); // smallest step we can represent
|
||||
|
||||
// for private construction via guts
|
||||
enum FixedRaw { RAW };
|
||||
Fixed(FixedRaw, int guts);
|
||||
|
||||
public:
|
||||
|
||||
Fixed();
|
||||
Fixed(const Fixed &a);
|
||||
Fixed(float a);
|
||||
Fixed(double a);
|
||||
Fixed(int a);
|
||||
Fixed(long a);
|
||||
|
||||
Fixed& operator =(const Fixed a);
|
||||
Fixed& operator =(float a);
|
||||
Fixed& operator =(double a);
|
||||
Fixed& operator =(int a);
|
||||
Fixed& operator =(long a);
|
||||
|
||||
operator float();
|
||||
operator double();
|
||||
operator int();
|
||||
operator long();
|
||||
operator unsigned short();
|
||||
|
||||
operator float() const;
|
||||
|
||||
Fixed operator +() const;
|
||||
Fixed operator -() const;
|
||||
|
||||
Fixed operator +(const Fixed a) const;
|
||||
Fixed operator -(const Fixed a) const;
|
||||
#if 1
|
||||
// more acurate, using long long
|
||||
Fixed operator *(const Fixed a) const;
|
||||
#else
|
||||
// faster, but with only half as many bits right of binary point
|
||||
Fixed operator *(const Fixed a) const;
|
||||
#endif
|
||||
Fixed operator /(const Fixed a) const;
|
||||
|
||||
Fixed operator *(unsigned short a) const;
|
||||
Fixed operator *(int a) const;
|
||||
|
||||
Fixed operator +(float a) const;
|
||||
Fixed operator -(float a) const;
|
||||
Fixed operator *(float a) const;
|
||||
Fixed operator /(float a) const;
|
||||
|
||||
Fixed operator +(double a) const;
|
||||
Fixed operator -(double a) const;
|
||||
Fixed operator *(double a) const;
|
||||
Fixed operator /(double a) const;
|
||||
|
||||
Fixed operator >>(int a) const;
|
||||
Fixed operator <<(int a) const;
|
||||
|
||||
Fixed& operator +=(Fixed a);
|
||||
Fixed& operator -=(Fixed a);
|
||||
Fixed& operator *=(Fixed a);
|
||||
Fixed& operator /=(Fixed a);
|
||||
|
||||
Fixed& operator +=(int a);
|
||||
Fixed& operator -=(int a);
|
||||
Fixed& operator *=(int a);
|
||||
Fixed& operator /=(int a);
|
||||
|
||||
Fixed& operator +=(long a);
|
||||
Fixed& operator -=(long a);
|
||||
Fixed& operator *=(long a);
|
||||
Fixed& operator /=(long a);
|
||||
|
||||
Fixed& operator +=(float a);
|
||||
Fixed& operator -=(float a);
|
||||
Fixed& operator *=(float a);
|
||||
Fixed& operator /=(float a);
|
||||
|
||||
Fixed& operator +=(double a);
|
||||
Fixed& operator -=(double a);
|
||||
Fixed& operator *=(double a);
|
||||
Fixed& operator /=(double a);
|
||||
|
||||
bool operator ==(const Fixed a) const;
|
||||
bool operator !=(const Fixed a) const;
|
||||
bool operator <=(const Fixed a) const;
|
||||
bool operator >=(const Fixed a) const;
|
||||
bool operator <(const Fixed a) const;
|
||||
bool operator >(const Fixed a) const;
|
||||
|
||||
bool operator ==(float a) const;
|
||||
bool operator !=(float a) const;
|
||||
bool operator <=(float a) const;
|
||||
bool operator >=(float a) const;
|
||||
bool operator <(float a) const;
|
||||
bool operator >(float a) const;
|
||||
|
||||
bool operator ==(double a) const;
|
||||
bool operator !=(double a) const;
|
||||
bool operator <=(double a) const;
|
||||
bool operator >=(double a) const;
|
||||
bool operator <(double a) const;
|
||||
bool operator >(double a) const;
|
||||
|
||||
bool operator >(int a) const;
|
||||
bool operator <(int a) const;
|
||||
bool operator >=(int a) const;
|
||||
bool operator <=(int a) const;
|
||||
|
||||
Fixed abs();
|
||||
Fixed sqrt();
|
||||
#ifdef TARGET_IS_NDS
|
||||
Fixed cosf();
|
||||
Fixed sinf();
|
||||
Fixed tanf();
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// Implementation
|
||||
//
|
||||
|
||||
inline double Fixed::STEP() { return 1.0 / (1<<BP); } // smallest step we can represent
|
||||
|
||||
// for private construction via guts
|
||||
inline Fixed::Fixed(FixedRaw, int guts) : g(guts) {}
|
||||
|
||||
inline Fixed::Fixed() : g(0) {}
|
||||
inline Fixed::Fixed(const Fixed &a) : g( a.g ) {}
|
||||
inline Fixed::Fixed(float a) : g( int(a * (float)(1<<BP)) ) {}
|
||||
inline Fixed::Fixed(double a) : g( int(a * (double)(1<<BP) ) ) {}
|
||||
inline Fixed::Fixed(int a) : g( a << BP ) {}
|
||||
inline Fixed::Fixed(long a) : g( a << BP ) {}
|
||||
|
||||
inline Fixed& Fixed::operator =(const Fixed a) { g= a.g; return *this; }
|
||||
inline Fixed& Fixed::operator =(float a) { g= Fixed(a).g; return *this; }
|
||||
inline Fixed& Fixed::operator =(double a) { g= Fixed(a).g; return *this; }
|
||||
inline Fixed& Fixed::operator =(int a) { g= Fixed(a).g; return *this; }
|
||||
inline Fixed& Fixed::operator =(long a) { g= Fixed(a).g; return *this; }
|
||||
|
||||
inline Fixed::operator float() { return g * (float)STEP(); }
|
||||
inline Fixed::operator double() { return g * (double)STEP(); }
|
||||
inline Fixed::operator int() { return g>>BP; }
|
||||
inline Fixed::operator long() { return g>>BP; }
|
||||
//#pragma warning(disable: 4244) //HARDWIRE added pragma to prevent VS2005 compilation error
|
||||
inline Fixed::operator unsigned short() { return g>>BP; }
|
||||
inline Fixed::operator float() const { return g / (float)(1<<BP); }
|
||||
|
||||
inline Fixed Fixed::operator +() const { return Fixed(RAW,g); }
|
||||
inline Fixed Fixed::operator -() const { return Fixed(RAW,-g); }
|
||||
|
||||
inline Fixed Fixed::operator +(const Fixed a) const { return Fixed(RAW, g + a.g); }
|
||||
inline Fixed Fixed::operator -(const Fixed a) const { return Fixed(RAW, g - a.g); }
|
||||
|
||||
#if 1
|
||||
// more acurate, using long long
|
||||
inline Fixed Fixed::operator *(const Fixed a) const { return Fixed(RAW, (int)( ((long long)g * (long long)a.g ) >> BP)); }
|
||||
|
||||
#elif 0
|
||||
|
||||
// check for overflow and figure out where. Must specify -rdynamic in linker
|
||||
#include <execinfo.h>
|
||||
#include <signal.h>
|
||||
#include <exception>
|
||||
|
||||
inline Fixed Fixed::operator *(const Fixed a) const {
|
||||
long long x = ((long long)g * (long long)a.g );
|
||||
if(x > 0x7fffffffffffLL || x < -0x7fffffffffffLL) {
|
||||
printf("overflow");
|
||||
void *array[2];
|
||||
int nSize = backtrace(array, 2);
|
||||
char **symbols = backtrace_symbols(array, nSize);
|
||||
for(int i=0; i<nSize; i++) {
|
||||
printf(" %s", symbols[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return Fixed(RAW, (int)(x>>BP));
|
||||
}
|
||||
|
||||
#else
|
||||
// faster, but with only half as many bits right of binary point
|
||||
inline Fixed Fixed::operator *(const Fixed a) const { return Fixed(RAW, (g>>BPhalf) * (a.g>>BPhalf) ); }
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TARGET_IS_NDS
|
||||
// Division using the DS's maths coprocessor
|
||||
inline Fixed Fixed::operator /(const Fixed a) const
|
||||
{
|
||||
//printf("%d %d\n", (long long)g << BP, a.g);
|
||||
return Fixed(RAW, int( div64((long long)g << BP, a.g) ) );
|
||||
}
|
||||
#else
|
||||
inline Fixed Fixed::operator /(const Fixed a) const
|
||||
{
|
||||
return Fixed(RAW, int( (((long long)g << BP2) / (long long)(a.g)) >> BP) );
|
||||
//return Fixed(RAW, int( (((long long)g << BP) / (long long)(a.g)) ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
inline Fixed Fixed::operator *(unsigned short a) const { return operator*(Fixed(a)); }
|
||||
inline Fixed Fixed::operator *(int a) const { return operator*(Fixed(a)); }
|
||||
|
||||
inline Fixed Fixed::operator +(float a) const { return Fixed(RAW, g + Fixed(a).g); }
|
||||
inline Fixed Fixed::operator -(float a) const { return Fixed(RAW, g - Fixed(a).g); }
|
||||
inline Fixed Fixed::operator *(float a) const { return Fixed(RAW, (g>>BPhalf) * (Fixed(a).g>>BPhalf) ); }
|
||||
//inline Fixed Fixed::operator /(float a) const { return Fixed(RAW, int( (((long long)g << BP2) / (long long)(Fixed(a).g)) >> BP) ); }
|
||||
inline Fixed Fixed::operator /(float a) const { return operator/(Fixed(a)); }
|
||||
|
||||
inline Fixed Fixed::operator +(double a) const { return Fixed(RAW, g + Fixed(a).g); }
|
||||
inline Fixed Fixed::operator -(double a) const { return Fixed(RAW, g - Fixed(a).g); }
|
||||
inline Fixed Fixed::operator *(double a) const { return Fixed(RAW, (g>>BPhalf) * (Fixed(a).g>>BPhalf) ); }
|
||||
//inline Fixed Fixed::operator /(double a) const { return Fixed(RAW, int( (((long long)g << BP2) / (long long)(Fixed(a).g)) >> BP) ); }
|
||||
inline Fixed Fixed::operator /(double a) const { return operator/(Fixed(a)); }
|
||||
|
||||
inline Fixed Fixed::operator >>(int a) const { return Fixed(RAW, g >> a); }
|
||||
inline Fixed Fixed::operator <<(int a) const { return Fixed(RAW, g << a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(Fixed a) { return *this = *this + a; }
|
||||
inline Fixed& Fixed::operator -=(Fixed a) { return *this = *this - a; }
|
||||
inline Fixed& Fixed::operator *=(Fixed a) { return *this = *this * a; }
|
||||
//inline Fixed& Fixed::operator /=(Fixed a) { return *this = *this / a; }
|
||||
inline Fixed& Fixed::operator /=(Fixed a) { return *this = operator/(a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(int a) { return *this = *this + (Fixed)a; }
|
||||
inline Fixed& Fixed::operator -=(int a) { return *this = *this - (Fixed)a; }
|
||||
inline Fixed& Fixed::operator *=(int a) { return *this = *this * (Fixed)a; }
|
||||
//inline Fixed& Fixed::operator /=(int a) { return *this = *this / (Fixed)a; }
|
||||
inline Fixed& Fixed::operator /=(int a) { return *this = operator/((Fixed)a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(long a) { return *this = *this + (Fixed)a; }
|
||||
inline Fixed& Fixed::operator -=(long a) { return *this = *this - (Fixed)a; }
|
||||
inline Fixed& Fixed::operator *=(long a) { return *this = *this * (Fixed)a; }
|
||||
//inline Fixed& Fixed::operator /=(long a) { return *this = *this / (Fixed)a; }
|
||||
inline Fixed& Fixed::operator /=(long a) { return *this = operator/((Fixed)a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(float a) { return *this = *this + a; }
|
||||
inline Fixed& Fixed::operator -=(float a) { return *this = *this - a; }
|
||||
inline Fixed& Fixed::operator *=(float a) { return *this = *this * a; }
|
||||
//inline Fixed& Fixed::operator /=(float a) { return *this = *this / a; }
|
||||
inline Fixed& Fixed::operator /=(float a) { return *this = operator/(a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(double a) { return *this = *this + a; }
|
||||
inline Fixed& Fixed::operator -=(double a) { return *this = *this - a; }
|
||||
inline Fixed& Fixed::operator *=(double a) { return *this = *this * a; }
|
||||
//inline Fixed& Fixed::operator /=(double a) { return *this = *this / a; }
|
||||
inline Fixed& Fixed::operator /=(double a) { return *this = operator/(a); }
|
||||
|
||||
inline Fixed operator +(int a, const Fixed b) { return Fixed(a)+b; }
|
||||
inline Fixed operator -(int a, const Fixed b) { return Fixed(a)-b; }
|
||||
inline Fixed operator *(int a, const Fixed b) { return Fixed(a)*b; }
|
||||
inline Fixed operator /(int a, const Fixed b) { return Fixed(a)/b; };
|
||||
|
||||
inline Fixed operator +(float a, const Fixed b) { return Fixed(a)+b; }
|
||||
inline Fixed operator -(float a, const Fixed b) { return Fixed(a)-b; }
|
||||
inline Fixed operator *(float a, const Fixed b) { return Fixed(a)*b; }
|
||||
inline Fixed operator /(float a, const Fixed b) { return Fixed(a)/b; }
|
||||
|
||||
inline bool Fixed::operator ==(const Fixed a) const { return g == a.g; }
|
||||
inline bool Fixed::operator !=(const Fixed a) const { return g != a.g; }
|
||||
inline bool Fixed::operator <=(const Fixed a) const { return g <= a.g; }
|
||||
inline bool Fixed::operator >=(const Fixed a) const { return g >= a.g; }
|
||||
inline bool Fixed::operator <(const Fixed a) const { return g < a.g; }
|
||||
inline bool Fixed::operator >(const Fixed a) const { return g > a.g; }
|
||||
|
||||
inline bool Fixed::operator ==(float a) const { return g == Fixed(a).g; }
|
||||
inline bool Fixed::operator !=(float a) const { return g != Fixed(a).g; }
|
||||
inline bool Fixed::operator <=(float a) const { return g <= Fixed(a).g; }
|
||||
inline bool Fixed::operator >=(float a) const { return g >= Fixed(a).g; }
|
||||
inline bool Fixed::operator <(float a) const { return g < Fixed(a).g; }
|
||||
inline bool Fixed::operator >(float a) const { return g > Fixed(a).g; }
|
||||
|
||||
inline bool Fixed::operator ==(double a) const { return g == Fixed(a).g; }
|
||||
inline bool Fixed::operator !=(double a) const { return g != Fixed(a).g; }
|
||||
inline bool Fixed::operator <=(double a) const { return g <= Fixed(a).g; }
|
||||
inline bool Fixed::operator >=(double a) const { return g >= Fixed(a).g; }
|
||||
inline bool Fixed::operator <(double a) const { return g < Fixed(a).g; }
|
||||
inline bool Fixed::operator >(double a) const { return g > Fixed(a).g; }
|
||||
|
||||
inline bool Fixed::operator >(int a) const { return g > Fixed(a).g; }
|
||||
inline bool Fixed::operator <(int a) const { return g < Fixed(a).g; }
|
||||
inline bool Fixed::operator >=(int a) const{ return g >= Fixed(a).g; };
|
||||
inline bool Fixed::operator <=(int a) const{ return g <= Fixed(a).g; };
|
||||
|
||||
inline bool operator ==(float a, const Fixed b) { return Fixed(a) == b; }
|
||||
inline bool operator !=(float a, const Fixed b) { return Fixed(a) != b; }
|
||||
inline bool operator <=(float a, const Fixed b) { return Fixed(a) <= b; }
|
||||
inline bool operator >=(float a, const Fixed b) { return Fixed(a) >= b; }
|
||||
inline bool operator <(float a, const Fixed b) { return Fixed(a) < b; }
|
||||
inline bool operator >(float a, const Fixed b) { return Fixed(a) > b; }
|
||||
|
||||
inline Fixed operator +(double a, const Fixed b) { return Fixed(a)+b; }
|
||||
inline Fixed operator -(double a, const Fixed b) { return Fixed(a)-b; }
|
||||
inline Fixed operator *(double a, const Fixed b) { return Fixed(a)*b; }
|
||||
inline Fixed operator /(double a, const Fixed b) { return Fixed(a)/b; }
|
||||
|
||||
inline bool operator ==(double a, const Fixed b) { return Fixed(a) == b; }
|
||||
inline bool operator !=(double a, const Fixed b) { return Fixed(a) != b; }
|
||||
inline bool operator <=(double a, const Fixed b) { return Fixed(a) <= b; }
|
||||
inline bool operator >=(double a, const Fixed b) { return Fixed(a) >= b; }
|
||||
inline bool operator <(double a, const Fixed b) { return Fixed(a) < b; }
|
||||
inline bool operator >(double a, const Fixed b) { return Fixed(a) > b; }
|
||||
|
||||
inline bool operator ==(int a, const Fixed b) { return Fixed(a) == b; }
|
||||
inline bool operator !=(int a, const Fixed b) { return Fixed(a) != b; }
|
||||
inline bool operator <=(int a, const Fixed b) { return Fixed(a) <= b; }
|
||||
inline bool operator >=(int a, const Fixed b) { return Fixed(a) >= b; }
|
||||
inline bool operator <(int a, const Fixed b) { return Fixed(a) < b; }
|
||||
inline bool operator >(int a, const Fixed b) { return Fixed(a) > b; }
|
||||
|
||||
inline int& operator +=(int& a, const Fixed b) { a = (Fixed)a + b; return a; }
|
||||
inline int& operator -=(int& a, const Fixed b) { a = (Fixed)a - b; return a; }
|
||||
inline int& operator *=(int& a, const Fixed b) { a = (Fixed)a * b; return a; }
|
||||
inline int& operator /=(int& a, const Fixed b) { a = (Fixed)a / b; return a; }
|
||||
|
||||
inline long& operator +=(long& a, const Fixed b) { a = (Fixed)a + b; return a; }
|
||||
inline long& operator -=(long& a, const Fixed b) { a = (Fixed)a - b; return a; }
|
||||
inline long& operator *=(long& a, const Fixed b) { a = (Fixed)a * b; return a; }
|
||||
inline long& operator /=(long& a, const Fixed b) { a = (Fixed)a / b; return a; }
|
||||
|
||||
inline float& operator +=(float& a, const Fixed b) { a = a + b; return a; }
|
||||
inline float& operator -=(float& a, const Fixed b) { a = a - b; return a; }
|
||||
inline float& operator *=(float& a, const Fixed b) { a = a * b; return a; }
|
||||
inline float& operator /=(float& a, const Fixed b) { a = a / b; return a; }
|
||||
|
||||
inline double& operator +=(double& a, const Fixed b) { a = a + b; return a; }
|
||||
inline double& operator -=(double& a, const Fixed b) { a = a - b; return a; }
|
||||
inline double& operator *=(double& a, const Fixed b) { a = a * b; return a; }
|
||||
inline double& operator /=(double& a, const Fixed b) { a = a / b; return a; }
|
||||
|
||||
inline Fixed Fixed::abs() { return (g>0) ? Fixed(RAW, g) : Fixed(RAW, -g); }
|
||||
inline Fixed abs(Fixed f) { return f.abs(); }
|
||||
|
||||
//inline Fixed atan2(Fixed a, Fixed b) { return atan2f((float) a, (float) b); }
|
||||
inline Fixed atan2(Fixed y, Fixed x)
|
||||
{
|
||||
Fixed abs_y = y.abs() + FIXED_EPSILON; // avoid 0/0
|
||||
Fixed r, angle;
|
||||
|
||||
if(x >= 0.0f) {
|
||||
r = (x - abs_y) / (x + abs_y);
|
||||
angle = 3.1415926/4.0;
|
||||
} else {
|
||||
r = (x + abs_y) / (abs_y - x);
|
||||
angle = 3.0*3.1415926/4.0;
|
||||
}
|
||||
angle += Fixed(0.1963) * (r * r * r) - Fixed(0.9817) * r;
|
||||
return (y < 0) ? -angle : angle;
|
||||
}
|
||||
|
||||
#if TARGET_IS_NDS
|
||||
|
||||
static inline long nds_sqrt64(long long a)
|
||||
{
|
||||
SQRT_CR = SQRT_64;
|
||||
while(SQRT_CR & SQRT_BUSY);
|
||||
SQRT_PARAM64 = a;
|
||||
while(SQRT_CR & SQRT_BUSY);
|
||||
|
||||
return SQRT_RESULT32;
|
||||
}
|
||||
|
||||
static inline int32 div6464(int64 num, int64 den)
|
||||
{
|
||||
DIV_CR = DIV_64_64;
|
||||
while(DIV_CR & DIV_BUSY);
|
||||
DIV_NUMERATOR64 = num;
|
||||
DIV_DENOMINATOR64 = den;
|
||||
while(DIV_CR & DIV_BUSY);
|
||||
|
||||
return (DIV_RESULT32);
|
||||
}
|
||||
|
||||
inline Fixed Fixed::sqrt()
|
||||
{
|
||||
return Fixed(RAW, nds_sqrt64(((long long)(g))<<BP));
|
||||
}
|
||||
#else
|
||||
inline Fixed Fixed::sqrt()
|
||||
{
|
||||
long long m, root = 0, left = (long long)g<<FIXED_BP;
|
||||
for ( m = (long long)1<<( (sizeof(long long)<<3) - 2); m; m >>= 2 )
|
||||
{
|
||||
if ( ( left & -m ) > root )
|
||||
left -= ( root += m ), root += m;
|
||||
root >>= 1;
|
||||
}
|
||||
return Fixed(RAW, root);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline Fixed sqrt(Fixed a) { return a.sqrt(); }
|
||||
inline Fixed sqrtf(Fixed a) { return a.sqrt(); }
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_IS_NDS
|
||||
// Use the libnds lookup tables for trigonometry functions
|
||||
inline Fixed Fixed::cosf() {
|
||||
int idx = (((long long)g*(long long)G_1_DIV_PI)>>24)%512;
|
||||
if(idx < 0)
|
||||
idx += 512;
|
||||
return Fixed(RAW, COS_bin[idx] << 4);
|
||||
}
|
||||
inline Fixed cosf(Fixed x) { return x.cosf(); }
|
||||
inline Fixed Fixed::sinf() {
|
||||
int idx = (((long long)g*(long long)G_1_DIV_PI)>>24)%512;
|
||||
if(idx < 0)
|
||||
idx += 512;
|
||||
return Fixed(RAW, SIN_bin[idx] << 4);
|
||||
}
|
||||
inline Fixed sinf(Fixed x) { return x.sinf(); }
|
||||
inline Fixed Fixed::tanf() {
|
||||
int idx = (((long long)g*(long long)G_1_DIV_PI)>>24)%512;
|
||||
if(idx < 0)
|
||||
idx += 512;
|
||||
return Fixed(RAW, TAN_bin[idx] << 4);
|
||||
}
|
||||
inline Fixed tanf(Fixed x) { return x.tanf(); }
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_BLOCK_ALLOCATOR_H
|
||||
#define B2_BLOCK_ALLOCATOR_H
|
||||
|
||||
#include "b2Settings.h"
|
||||
|
||||
const int32 b2_chunkSize = 4096;
|
||||
const int32 b2_maxBlockSize = 640;
|
||||
const int32 b2_blockSizes = 14;
|
||||
const int32 b2_chunkArrayIncrement = 128;
|
||||
|
||||
struct b2Block;
|
||||
struct b2Chunk;
|
||||
|
||||
// This is a small object allocator used for allocating small
|
||||
// objects that persist for more than one time step.
|
||||
// See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp
|
||||
class b2BlockAllocator
|
||||
{
|
||||
public:
|
||||
b2BlockAllocator();
|
||||
~b2BlockAllocator();
|
||||
|
||||
void* Allocate(int32 size);
|
||||
void Free(void* p, int32 size);
|
||||
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
|
||||
b2Chunk* m_chunks;
|
||||
int32 m_chunkCount;
|
||||
int32 m_chunkSpace;
|
||||
|
||||
b2Block* m_freeLists[b2_blockSizes];
|
||||
|
||||
static int32 s_blockSizes[b2_blockSizes];
|
||||
static uint8 s_blockSizeLookup[b2_maxBlockSize + 1];
|
||||
static bool s_blockSizeLookupInitialized;
|
||||
};
|
||||
|
||||
#endif
|
636
build/linux/libs/box2d-svn/include/Source/Common/b2Math.h
Normal file
636
build/linux/libs/box2d-svn/include/Source/Common/b2Math.h
Normal file
@ -0,0 +1,636 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_MATH_H
|
||||
#define B2_MATH_H
|
||||
|
||||
#include "b2Settings.h"
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef TARGET_FLOAT32_IS_FIXED
|
||||
|
||||
inline Fixed b2Min(const Fixed& a, const Fixed& b)
|
||||
{
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
inline Fixed b2Max(const Fixed& a, const Fixed& b)
|
||||
{
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
inline Fixed b2Clamp(Fixed a, Fixed low, Fixed high)
|
||||
{
|
||||
return b2Max(low, b2Min(a, high));
|
||||
}
|
||||
|
||||
inline bool b2IsValid(Fixed x)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#define b2Sqrt(x) sqrt(x)
|
||||
#define b2Atan2(y, x) atan2(y, x)
|
||||
|
||||
#else
|
||||
|
||||
/// This function is used to ensure that a floating point number is
|
||||
/// not a NaN or infinity.
|
||||
inline bool b2IsValid(float32 x)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return _finite(x) != 0;
|
||||
#else
|
||||
return finite(x) != 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// This is a approximate yet fast inverse square-root.
|
||||
inline float32 b2InvSqrt(float32 x)
|
||||
{
|
||||
union
|
||||
{
|
||||
float32 x;
|
||||
int32 i;
|
||||
} convert;
|
||||
|
||||
convert.x = x;
|
||||
float32 xhalf = 0.5f * x;
|
||||
convert.i = 0x5f3759df - (convert.i >> 1);
|
||||
x = convert.x;
|
||||
x = x * (1.5f - xhalf * x * x);
|
||||
return x;
|
||||
}
|
||||
|
||||
#define b2Sqrt(x) sqrtf(x)
|
||||
#define b2Atan2(y, x) atan2f(y, x)
|
||||
|
||||
#endif
|
||||
|
||||
inline float32 b2Abs(float32 a)
|
||||
{
|
||||
return a > 0.0f ? a : -a;
|
||||
}
|
||||
|
||||
/// A 2D column vector.
|
||||
|
||||
struct b2Vec2
|
||||
{
|
||||
/// Default constructor does nothing (for performance).
|
||||
b2Vec2() {}
|
||||
|
||||
/// Construct using coordinates.
|
||||
b2Vec2(float32 x, float32 y) : x(x), y(y) {}
|
||||
|
||||
/// Set this vector to all zeros.
|
||||
void SetZero() { x = 0.0f; y = 0.0f; }
|
||||
|
||||
/// Set this vector to some specified coordinates.
|
||||
void Set(float32 x_, float32 y_) { x = x_; y = y_; }
|
||||
|
||||
/// Negate this vector.
|
||||
b2Vec2 operator -() const { b2Vec2 v; v.Set(-x, -y); return v; }
|
||||
|
||||
/// Add a vector to this vector.
|
||||
void operator += (const b2Vec2& v)
|
||||
{
|
||||
x += v.x; y += v.y;
|
||||
}
|
||||
|
||||
/// Subtract a vector from this vector.
|
||||
void operator -= (const b2Vec2& v)
|
||||
{
|
||||
x -= v.x; y -= v.y;
|
||||
}
|
||||
|
||||
/// Multiply this vector by a scalar.
|
||||
void operator *= (float32 a)
|
||||
{
|
||||
x *= a; y *= a;
|
||||
}
|
||||
|
||||
/// Get the length of this vector (the norm).
|
||||
float32 Length() const
|
||||
{
|
||||
#ifdef TARGET_FLOAT32_IS_FIXED
|
||||
float est = b2Abs(x) + b2Abs(y);
|
||||
if(est == 0.0f) {
|
||||
return 0.0;
|
||||
} else if(est < 0.1) {
|
||||
return (1.0/256.0) * b2Vec2(x<<8, y<<8).Length();
|
||||
} else if(est < 180.0f) {
|
||||
return b2Sqrt(x * x + y * y);
|
||||
} else {
|
||||
return 256.0 * (b2Vec2(x>>8, y>>8).Length());
|
||||
}
|
||||
#else
|
||||
return b2Sqrt(x * x + y * y);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Get the length squared. For performance, use this instead of
|
||||
/// b2Vec2::Length (if possible).
|
||||
float32 LengthSquared() const
|
||||
{
|
||||
return x * x + y * y;
|
||||
}
|
||||
|
||||
/// Convert this vector into a unit vector. Returns the length.
|
||||
#ifdef TARGET_FLOAT32_IS_FIXED
|
||||
float32 Normalize()
|
||||
{
|
||||
float32 length = Length();
|
||||
if (length < B2_FLT_EPSILON)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
#ifdef NORMALIZE_BY_INVERT_MULTIPLY
|
||||
if (length < (1.0/16.0)) {
|
||||
x = x << 4;
|
||||
y = y << 4;
|
||||
return (1.0/16.0)*Normalize();
|
||||
} else if(length > 16.0) {
|
||||
x = x >> 4;
|
||||
y = y >> 4;
|
||||
return 16.0*Normalize();
|
||||
}
|
||||
float32 invLength = 1.0f / length;
|
||||
x *= invLength;
|
||||
y *= invLength;
|
||||
#else
|
||||
x /= length;
|
||||
y /= length;
|
||||
#endif
|
||||
return length;
|
||||
}
|
||||
#else
|
||||
float32 Normalize()
|
||||
{
|
||||
float32 length = Length();
|
||||
if (length < B2_FLT_EPSILON)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
float32 invLength = 1.0f / length;
|
||||
x *= invLength;
|
||||
y *= invLength;
|
||||
|
||||
return length;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Does this vector contain finite coordinates?
|
||||
bool IsValid() const
|
||||
{
|
||||
return b2IsValid(x) && b2IsValid(y);
|
||||
}
|
||||
|
||||
float32 x, y;
|
||||
};
|
||||
|
||||
/// A 2-by-2 matrix. Stored in column-major order.
|
||||
struct b2Mat22
|
||||
{
|
||||
/// The default constructor does nothing (for performance).
|
||||
b2Mat22() {}
|
||||
|
||||
/// Construct this matrix using columns.
|
||||
b2Mat22(const b2Vec2& c1, const b2Vec2& c2)
|
||||
{
|
||||
col1 = c1;
|
||||
col2 = c2;
|
||||
}
|
||||
|
||||
/// Construct this matrix using scalars.
|
||||
b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22)
|
||||
{
|
||||
col1.x = a11; col1.y = a21;
|
||||
col2.x = a12; col2.y = a22;
|
||||
}
|
||||
|
||||
/// Construct this matrix using an angle. This matrix becomes
|
||||
/// an orthonormal rotation matrix.
|
||||
explicit b2Mat22(float32 angle)
|
||||
{
|
||||
float32 c = cosf(angle), s = sinf(angle);
|
||||
col1.x = c; col2.x = -s;
|
||||
col1.y = s; col2.y = c;
|
||||
}
|
||||
|
||||
/// Initialize this matrix using columns.
|
||||
void Set(const b2Vec2& c1, const b2Vec2& c2)
|
||||
{
|
||||
col1 = c1;
|
||||
col2 = c2;
|
||||
}
|
||||
|
||||
/// Initialize this matrix using an angle. This matrix becomes
|
||||
/// an orthonormal rotation matrix.
|
||||
void Set(float32 angle)
|
||||
{
|
||||
float32 c = cosf(angle), s = sinf(angle);
|
||||
col1.x = c; col2.x = -s;
|
||||
col1.y = s; col2.y = c;
|
||||
}
|
||||
|
||||
/// Set this to the identity matrix.
|
||||
void SetIdentity()
|
||||
{
|
||||
col1.x = 1.0f; col2.x = 0.0f;
|
||||
col1.y = 0.0f; col2.y = 1.0f;
|
||||
}
|
||||
|
||||
/// Set this matrix to all zeros.
|
||||
void SetZero()
|
||||
{
|
||||
col1.x = 0.0f; col2.x = 0.0f;
|
||||
col1.y = 0.0f; col2.y = 0.0f;
|
||||
}
|
||||
|
||||
/// Extract the angle from this matrix (assumed to be
|
||||
/// a rotation matrix).
|
||||
float32 GetAngle() const
|
||||
{
|
||||
return b2Atan2(col1.y, col1.x);
|
||||
}
|
||||
|
||||
#ifdef TARGET_FLOAT32_IS_FIXED
|
||||
|
||||
/// Compute the inverse of this matrix, such that inv(A) * A = identity.
|
||||
b2Mat22 Invert() const
|
||||
{
|
||||
float32 a = col1.x, b = col2.x, c = col1.y, d = col2.y;
|
||||
float32 det = a * d - b * c;
|
||||
b2Mat22 B;
|
||||
int n = 0;
|
||||
|
||||
if(b2Abs(det) <= (B2_FLT_EPSILON<<8))
|
||||
{
|
||||
n = 3;
|
||||
a = a<<n; b = b<<n;
|
||||
c = c<<n; d = d<<n;
|
||||
det = a * d - b * c;
|
||||
b2Assert(det != 0.0f);
|
||||
det = float32(1) / det;
|
||||
B.col1.x = ( det * d) << n; B.col2.x = (-det * b) << n;
|
||||
B.col1.y = (-det * c) << n; B.col2.y = ( det * a) << n;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = (b2Abs(det) >= 16.0)? 4 : 0;
|
||||
b2Assert(det != 0.0f);
|
||||
det = float32(1<<n) / det;
|
||||
B.col1.x = ( det * d) >> n; B.col2.x = (-det * b) >> n;
|
||||
B.col1.y = (-det * c) >> n; B.col2.y = ( det * a) >> n;
|
||||
}
|
||||
|
||||
return B;
|
||||
}
|
||||
|
||||
// Solve A * x = b
|
||||
b2Vec2 Solve(const b2Vec2& b) const
|
||||
{
|
||||
float32 a11 = col1.x, a12 = col2.x, a21 = col1.y, a22 = col2.y;
|
||||
float32 det = a11 * a22 - a12 * a21;
|
||||
int n = 0;
|
||||
b2Vec2 x;
|
||||
|
||||
|
||||
if(b2Abs(det) <= (B2_FLT_EPSILON<<8))
|
||||
{
|
||||
n = 3;
|
||||
a11 = col1.x<<n; a12 = col2.x<<n;
|
||||
a21 = col1.y<<n; a22 = col2.y<<n;
|
||||
det = a11 * a22 - a12 * a21;
|
||||
b2Assert(det != 0.0f);
|
||||
det = float32(1) / det;
|
||||
x.x = (det * (a22 * b.x - a12 * b.y)) << n;
|
||||
x.y = (det * (a11 * b.y - a21 * b.x)) << n;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = (b2Abs(det) >= 16.0) ? 4 : 0;
|
||||
b2Assert(det != 0.0f);
|
||||
det = float32(1<<n) / det;
|
||||
x.x = (det * (a22 * b.x - a12 * b.y)) >> n;
|
||||
x.y = (det * (a11 * b.y - a21 * b.x)) >> n;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
b2Mat22 Invert() const
|
||||
{
|
||||
float32 a = col1.x, b = col2.x, c = col1.y, d = col2.y;
|
||||
b2Mat22 B;
|
||||
float32 det = a * d - b * c;
|
||||
b2Assert(det != 0.0f);
|
||||
det = float32(1.0f) / det;
|
||||
B.col1.x = det * d; B.col2.x = -det * b;
|
||||
B.col1.y = -det * c; B.col2.y = det * a;
|
||||
return B;
|
||||
}
|
||||
|
||||
/// Solve A * x = b, where b is a column vector. This is more efficient
|
||||
/// than computing the inverse in one-shot cases.
|
||||
b2Vec2 Solve(const b2Vec2& b) const
|
||||
{
|
||||
float32 a11 = col1.x, a12 = col2.x, a21 = col1.y, a22 = col2.y;
|
||||
float32 det = a11 * a22 - a12 * a21;
|
||||
b2Assert(det != 0.0f);
|
||||
det = 1.0f / det;
|
||||
b2Vec2 x;
|
||||
x.x = det * (a22 * b.x - a12 * b.y);
|
||||
x.y = det * (a11 * b.y - a21 * b.x);
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
||||
b2Vec2 col1, col2;
|
||||
};
|
||||
|
||||
/// A transform contains translation and rotation. It is used to represent
|
||||
/// the position and orientation of rigid frames.
|
||||
struct b2XForm
|
||||
{
|
||||
/// The default constructor does nothing (for performance).
|
||||
b2XForm() {}
|
||||
|
||||
/// Initialize using a position vector and a rotation matrix.
|
||||
b2XForm(const b2Vec2& position, const b2Mat22& R) : position(position), R(R) {}
|
||||
|
||||
/// Set this to the identity transform.
|
||||
void SetIdentity()
|
||||
{
|
||||
position.SetZero();
|
||||
R.SetIdentity();
|
||||
}
|
||||
|
||||
b2Vec2 position;
|
||||
b2Mat22 R;
|
||||
};
|
||||
|
||||
/// This describes the motion of a body/shape for TOI computation.
|
||||
/// Shapes are defined with respect to the body origin, which may
|
||||
/// no coincide with the center of mass. However, to support dynamics
|
||||
/// we must interpolate the center of mass position.
|
||||
struct b2Sweep
|
||||
{
|
||||
/// Get the interpolated transform at a specific time.
|
||||
/// @param t the normalized time in [0,1].
|
||||
void GetXForm(b2XForm* xf, float32 t) const;
|
||||
|
||||
/// Advance the sweep forward, yielding a new initial state.
|
||||
/// @param t the new initial time.
|
||||
void Advance(float32 t);
|
||||
|
||||
b2Vec2 localCenter; ///< local center of mass position
|
||||
b2Vec2 c0, c; ///< center world positions
|
||||
float32 a0, a; ///< world angles
|
||||
float32 t0; ///< time interval = [t0,1], where t0 is in [0,1]
|
||||
};
|
||||
|
||||
|
||||
extern const b2Vec2 b2Vec2_zero;
|
||||
extern const b2Mat22 b2Mat22_identity;
|
||||
extern const b2XForm b2XForm_identity;
|
||||
|
||||
/// Peform the dot product on two vectors.
|
||||
inline float32 b2Dot(const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
return a.x * b.x + a.y * b.y;
|
||||
}
|
||||
|
||||
/// Perform the cross product on two vectors. In 2D this produces a scalar.
|
||||
inline float32 b2Cross(const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
return a.x * b.y - a.y * b.x;
|
||||
}
|
||||
|
||||
/// Perform the cross product on a vector and a scalar. In 2D this produces
|
||||
/// a vector.
|
||||
inline b2Vec2 b2Cross(const b2Vec2& a, float32 s)
|
||||
{
|
||||
b2Vec2 v; v.Set(s * a.y, -s * a.x);
|
||||
return v;
|
||||
}
|
||||
|
||||
/// Perform the cross product on a scalar and a vector. In 2D this produces
|
||||
/// a vector.
|
||||
inline b2Vec2 b2Cross(float32 s, const b2Vec2& a)
|
||||
{
|
||||
b2Vec2 v; v.Set(-s * a.y, s * a.x);
|
||||
return v;
|
||||
}
|
||||
|
||||
/// Multiply a matrix times a vector. If a rotation matrix is provided,
|
||||
/// then this transforms the vector from one frame to another.
|
||||
inline b2Vec2 b2Mul(const b2Mat22& A, const b2Vec2& v)
|
||||
{
|
||||
b2Vec2 u;
|
||||
u.Set(A.col1.x * v.x + A.col2.x * v.y, A.col1.y * v.x + A.col2.y * v.y);
|
||||
return u;
|
||||
}
|
||||
|
||||
/// Multiply a matrix transpose times a vector. If a rotation matrix is provided,
|
||||
/// then this transforms the vector from one frame to another (inverse transform).
|
||||
inline b2Vec2 b2MulT(const b2Mat22& A, const b2Vec2& v)
|
||||
{
|
||||
b2Vec2 u;
|
||||
u.Set(b2Dot(v, A.col1), b2Dot(v, A.col2));
|
||||
return u;
|
||||
}
|
||||
|
||||
/// Add two vectors component-wise.
|
||||
inline b2Vec2 operator + (const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
b2Vec2 v; v.Set(a.x + b.x, a.y + b.y);
|
||||
return v;
|
||||
}
|
||||
|
||||
/// Subtract two vectors component-wise.
|
||||
inline b2Vec2 operator - (const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
b2Vec2 v; v.Set(a.x - b.x, a.y - b.y);
|
||||
return v;
|
||||
}
|
||||
|
||||
inline b2Vec2 operator * (float32 s, const b2Vec2& a)
|
||||
{
|
||||
b2Vec2 v; v.Set(s * a.x, s * a.y);
|
||||
return v;
|
||||
}
|
||||
|
||||
inline bool operator == (const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
return a.x == b.x && a.y == b.y;
|
||||
}
|
||||
|
||||
inline float32 b2Distance(const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
b2Vec2 c = a - b;
|
||||
return c.Length();
|
||||
}
|
||||
|
||||
inline float32 b2DistanceSquared(const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
b2Vec2 c = a - b;
|
||||
return b2Dot(c, c);
|
||||
}
|
||||
|
||||
inline b2Mat22 operator + (const b2Mat22& A, const b2Mat22& B)
|
||||
{
|
||||
b2Mat22 C;
|
||||
C.Set(A.col1 + B.col1, A.col2 + B.col2);
|
||||
return C;
|
||||
}
|
||||
|
||||
// A * B
|
||||
inline b2Mat22 b2Mul(const b2Mat22& A, const b2Mat22& B)
|
||||
{
|
||||
b2Mat22 C;
|
||||
C.Set(b2Mul(A, B.col1), b2Mul(A, B.col2));
|
||||
return C;
|
||||
}
|
||||
|
||||
// A^T * B
|
||||
inline b2Mat22 b2MulT(const b2Mat22& A, const b2Mat22& B)
|
||||
{
|
||||
b2Vec2 c1; c1.Set(b2Dot(A.col1, B.col1), b2Dot(A.col2, B.col1));
|
||||
b2Vec2 c2; c2.Set(b2Dot(A.col1, B.col2), b2Dot(A.col2, B.col2));
|
||||
b2Mat22 C;
|
||||
C.Set(c1, c2);
|
||||
return C;
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Mul(const b2XForm& T, const b2Vec2& v)
|
||||
{
|
||||
return T.position + b2Mul(T.R, v);
|
||||
}
|
||||
|
||||
inline b2Vec2 b2MulT(const b2XForm& T, const b2Vec2& v)
|
||||
{
|
||||
return b2MulT(T.R, v - T.position);
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Abs(const b2Vec2& a)
|
||||
{
|
||||
b2Vec2 b; b.Set(b2Abs(a.x), b2Abs(a.y));
|
||||
return b;
|
||||
}
|
||||
|
||||
inline b2Mat22 b2Abs(const b2Mat22& A)
|
||||
{
|
||||
b2Mat22 B;
|
||||
B.Set(b2Abs(A.col1), b2Abs(A.col2));
|
||||
return B;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T b2Min(T a, T b)
|
||||
{
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Min(const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
b2Vec2 c;
|
||||
c.x = b2Min(a.x, b.x);
|
||||
c.y = b2Min(a.y, b.y);
|
||||
return c;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T b2Max(T a, T b)
|
||||
{
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Max(const b2Vec2& a, const b2Vec2& b)
|
||||
{
|
||||
b2Vec2 c;
|
||||
c.x = b2Max(a.x, b.x);
|
||||
c.y = b2Max(a.y, b.y);
|
||||
return c;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T b2Clamp(T a, T low, T high)
|
||||
{
|
||||
return b2Max(low, b2Min(a, high));
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Clamp(const b2Vec2& a, const b2Vec2& low, const b2Vec2& high)
|
||||
{
|
||||
return b2Max(low, b2Min(a, high));
|
||||
}
|
||||
|
||||
template<typename T> inline void b2Swap(T& a, T& b)
|
||||
{
|
||||
T tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
#define RAND_LIMIT 32767
|
||||
|
||||
// Random number in range [-1,1]
|
||||
inline float32 b2Random()
|
||||
{
|
||||
float32 r = (float32)(rand() & (RAND_LIMIT));
|
||||
r /= RAND_LIMIT;
|
||||
r = 2.0f * r - 1.0f;
|
||||
return r;
|
||||
}
|
||||
|
||||
/// Random floating point number in range [lo, hi]
|
||||
inline float32 b2Random(float32 lo, float32 hi)
|
||||
{
|
||||
float32 r = (float32)(rand() & (RAND_LIMIT));
|
||||
r /= RAND_LIMIT;
|
||||
r = (hi - lo) * r + lo;
|
||||
return r;
|
||||
}
|
||||
|
||||
/// "Next Largest Power of 2
|
||||
/// Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm
|
||||
/// that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with
|
||||
/// the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next
|
||||
/// largest power of 2. For a 32-bit value:"
|
||||
inline uint32 b2NextPowerOfTwo(uint32 x)
|
||||
{
|
||||
x |= (x >> 1);
|
||||
x |= (x >> 2);
|
||||
x |= (x >> 4);
|
||||
x |= (x >> 8);
|
||||
x |= (x >> 16);
|
||||
return x + 1;
|
||||
}
|
||||
|
||||
inline bool b2IsPowerOfTwo(uint32 x)
|
||||
{
|
||||
bool result = x > 0 && (x & (x - 1)) == 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
176
build/linux/libs/box2d-svn/include/Source/Common/b2Settings.h
Normal file
176
build/linux/libs/box2d-svn/include/Source/Common/b2Settings.h
Normal file
@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_SETTINGS_H
|
||||
#define B2_SETTINGS_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
#define B2_NOT_USED(x) x
|
||||
#define b2Assert(A) assert(A)
|
||||
|
||||
|
||||
// need to include NDS jtypes.h instead of
|
||||
// usual typedefs because NDS jtypes defines
|
||||
// them slightly differently, oh well.
|
||||
#ifdef TARGET_IS_NDS
|
||||
|
||||
#include "jtypes.h"
|
||||
|
||||
#else
|
||||
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed int int32;
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_FLOAT32_IS_FIXED
|
||||
|
||||
#include "Fixed.h"
|
||||
|
||||
typedef Fixed float32;
|
||||
#define B2_FLT_MAX FIXED_MAX
|
||||
#define B2_FLT_EPSILON FIXED_EPSILON
|
||||
#define B2FORCE_SCALE(x) ((x)<<7)
|
||||
#define B2FORCE_INV_SCALE(x) ((x)>>7)
|
||||
|
||||
#else
|
||||
|
||||
typedef float float32;
|
||||
#define B2_FLT_MAX FLT_MAX
|
||||
#define B2_FLT_EPSILON FLT_EPSILON
|
||||
#define B2FORCE_SCALE(x) (x)
|
||||
#define B2FORCE_INV_SCALE(x) (x)
|
||||
|
||||
#endif
|
||||
|
||||
const float32 b2_pi = 3.14159265359f;
|
||||
|
||||
/// @file
|
||||
/// Global tuning constants based on meters-kilograms-seconds (MKS) units.
|
||||
///
|
||||
|
||||
// Collision
|
||||
const int32 b2_maxManifoldPoints = 2;
|
||||
const int32 b2_maxPolygonVertices = 8;
|
||||
const int32 b2_maxProxies = 16384; // this must be a power of two
|
||||
const int32 b2_maxPairs = 8 * b2_maxProxies; // this must be a power of two
|
||||
|
||||
// Dynamics
|
||||
|
||||
/// A small length used as a collision and constraint tolerance. Usually it is
|
||||
/// chosen to be numerically significant, but visually insignificant.
|
||||
const float32 b2_linearSlop = 0.005f; // 0.5 cm
|
||||
|
||||
/// A small angle used as a collision and constraint tolerance. Usually it is
|
||||
/// chosen to be numerically significant, but visually insignificant.
|
||||
const float32 b2_angularSlop = 2.0f / 180.0f * b2_pi; // 2 degrees
|
||||
|
||||
/// Continuous collision detection (CCD) works with core, shrunken shapes. This is the
|
||||
/// amount by which shapes are automatically shrunk to work with CCD. This must be
|
||||
/// larger than b2_linearSlop.
|
||||
const float32 b2_toiSlop = 8.0f * b2_linearSlop;
|
||||
|
||||
/// Maximum number of contacts to be handled to solve a TOI island.
|
||||
const int32 b2_maxTOIContactsPerIsland = 32;
|
||||
|
||||
/// A velocity threshold for elastic collisions. Any collision with a relative linear
|
||||
/// velocity below this threshold will be treated as inelastic.
|
||||
const float32 b2_velocityThreshold = 1.0f; // 1 m/s
|
||||
|
||||
/// The maximum linear position correction used when solving constraints. This helps to
|
||||
/// prevent overshoot.
|
||||
const float32 b2_maxLinearCorrection = 0.2f; // 20 cm
|
||||
|
||||
/// The maximum angular position correction used when solving constraints. This helps to
|
||||
/// prevent overshoot.
|
||||
const float32 b2_maxAngularCorrection = 8.0f / 180.0f * b2_pi; // 8 degrees
|
||||
|
||||
/// The maximum linear velocity of a body. This limit is very large and is used
|
||||
/// to prevent numerical problems. You shouldn't need to adjust this.
|
||||
#ifdef TARGET_FLOAT32_IS_FIXED
|
||||
const float32 b2_maxLinearVelocity = 100.0f;
|
||||
#else
|
||||
const float32 b2_maxLinearVelocity = 200.0f;
|
||||
const float32 b2_maxLinearVelocitySquared = b2_maxLinearVelocity * b2_maxLinearVelocity;
|
||||
#endif
|
||||
|
||||
/// The maximum angular velocity of a body. This limit is very large and is used
|
||||
/// to prevent numerical problems. You shouldn't need to adjust this.
|
||||
const float32 b2_maxAngularVelocity = 250.0f;
|
||||
#ifndef TARGET_FLOAT32_IS_FIXED
|
||||
const float32 b2_maxAngularVelocitySquared = b2_maxAngularVelocity * b2_maxAngularVelocity;
|
||||
#endif
|
||||
|
||||
/// This scale factor controls how fast overlap is resolved. Ideally this would be 1 so
|
||||
/// that overlap is removed in one time step. However using values close to 1 often lead
|
||||
/// to overshoot.
|
||||
const float32 b2_contactBaumgarte = 0.2f;
|
||||
|
||||
// Sleep
|
||||
|
||||
/// The time that a body must be still before it will go to sleep.
|
||||
const float32 b2_timeToSleep = 0.5f; // half a second
|
||||
|
||||
/// A body cannot sleep if its linear velocity is above this tolerance.
|
||||
const float32 b2_linearSleepTolerance = 0.01f; // 1 cm/s
|
||||
|
||||
/// A body cannot sleep if its angular velocity is above this tolerance.
|
||||
const float32 b2_angularSleepTolerance = 2.0f / 180.0f; // 2 degrees/s
|
||||
|
||||
// Memory Allocation
|
||||
|
||||
/// The current number of bytes allocated through b2Alloc.
|
||||
extern int32 b2_byteCount;
|
||||
|
||||
/// Implement this function to use your own memory allocator.
|
||||
void* b2Alloc(int32 size);
|
||||
|
||||
/// If you implement b2Alloc, you should also implement this function.
|
||||
void b2Free(void* mem);
|
||||
|
||||
/// Version numbering scheme.
|
||||
/// See http://en.wikipedia.org/wiki/Software_versioning
|
||||
struct b2Version
|
||||
{
|
||||
int32 major; ///< significant changes
|
||||
int32 minor; ///< incremental changes
|
||||
int32 revision; ///< bug fixes
|
||||
};
|
||||
|
||||
/// Current version.
|
||||
extern b2Version b2_version;
|
||||
|
||||
/// Friction mixing law. Feel free to customize this.
|
||||
inline float32 b2MixFriction(float32 friction1, float32 friction2)
|
||||
{
|
||||
return sqrtf(friction1 * friction2);
|
||||
}
|
||||
|
||||
/// Restitution mixing law. Feel free to customize this.
|
||||
inline float32 b2MixRestitution(float32 restitution1, float32 restitution2)
|
||||
{
|
||||
return restitution1 > restitution2 ? restitution1 : restitution2;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_STACK_ALLOCATOR_H
|
||||
#define B2_STACK_ALLOCATOR_H
|
||||
|
||||
#include "b2Settings.h"
|
||||
|
||||
const int32 b2_stackSize = 100 * 1024; // 100k
|
||||
const int32 b2_maxStackEntries = 32;
|
||||
|
||||
struct b2StackEntry
|
||||
{
|
||||
char* data;
|
||||
int32 size;
|
||||
bool usedMalloc;
|
||||
};
|
||||
|
||||
// This is a stack allocator used for fast per step allocations.
|
||||
// You must nest allocate/free pairs. The code will assert
|
||||
// if you try to interleave multiple allocate/free pairs.
|
||||
class b2StackAllocator
|
||||
{
|
||||
public:
|
||||
b2StackAllocator();
|
||||
~b2StackAllocator();
|
||||
|
||||
void* Allocate(int32 size);
|
||||
void Free(void* p);
|
||||
|
||||
int32 GetMaxAllocation() const;
|
||||
|
||||
private:
|
||||
|
||||
char m_data[b2_stackSize];
|
||||
int32 m_index;
|
||||
|
||||
int32 m_allocation;
|
||||
int32 m_maxAllocation;
|
||||
|
||||
b2StackEntry m_entries[b2_maxStackEntries];
|
||||
int32 m_entryCount;
|
||||
};
|
||||
|
||||
#endif
|
139
build/linux/libs/box2d-svn/include/Source/Common/jtypes.h
Normal file
139
build/linux/libs/box2d-svn/include/Source/Common/jtypes.h
Normal file
@ -0,0 +1,139 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
$Id: jtypes.h,v 1.17 2007/07/18 05:20:45 wntrmute Exp $
|
||||
|
||||
jtypes.h -- Common types (and a few useful macros)
|
||||
|
||||
Copyright (C) 2005
|
||||
Michael Noland (joat)
|
||||
Jason Rogers (dovoto)
|
||||
Dave Murphy (WinterMute)
|
||||
Chris Double (doublec)
|
||||
|
||||
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 NDS_JTYPES_INCLUDE
|
||||
#define NDS_JTYPES_INCLUDE
|
||||
//---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#define PACKED __attribute__ ((packed))
|
||||
#define packed_struct struct PACKED
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// libgba compatible section macros
|
||||
//---------------------------------------------------------------------------------
|
||||
#define ITCM_CODE __attribute__((section(".itcm"), long_call))
|
||||
|
||||
#define DTCM_DATA __attribute__((section(".dtcm")))
|
||||
#define DTCM_BSS __attribute__((section(".sbss")))
|
||||
#define ALIGN(m) __attribute__((aligned (m)))
|
||||
|
||||
#define PACKED __attribute__ ((packed))
|
||||
#define packed_struct struct PACKED
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// These are linked to the bin2o macro in the Makefile
|
||||
//---------------------------------------------------------------------------------
|
||||
#define GETRAW(name) (name)
|
||||
#define GETRAWSIZE(name) ((int)name##_size)
|
||||
#define GETRAWEND(name) ((int)name##_end)
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#define BIT(n) (1 << (n))
|
||||
|
||||
// define libnds types in terms of stdint
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint8_t uint8;
|
||||
typedef uint16_t uint16;
|
||||
typedef uint32_t uint32;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
typedef int8_t int8;
|
||||
typedef int16_t int16;
|
||||
typedef int32_t int32;
|
||||
typedef int64_t int64;
|
||||
|
||||
//typedef float float32;
|
||||
typedef double float64;
|
||||
|
||||
typedef volatile uint8_t vuint8;
|
||||
typedef volatile uint16_t vuint16;
|
||||
typedef volatile uint32_t vuint32;
|
||||
typedef volatile uint64_t vuint64;
|
||||
|
||||
typedef volatile int8_t vint8;
|
||||
typedef volatile int16_t vint16;
|
||||
typedef volatile int32_t vint32;
|
||||
typedef volatile int64_t vint64;
|
||||
|
||||
typedef volatile float vfloat32;
|
||||
typedef volatile float64 vfloat64;
|
||||
|
||||
typedef uint8_t byte;
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
|
||||
typedef volatile u8 vu8;
|
||||
typedef volatile u16 vu16;
|
||||
typedef volatile u32 vu32;
|
||||
typedef volatile u64 vu64;
|
||||
|
||||
typedef volatile s8 vs8;
|
||||
typedef volatile s16 vs16;
|
||||
typedef volatile s32 vs32;
|
||||
typedef volatile s64 vs64;
|
||||
|
||||
typedef struct touchPosition {
|
||||
int16 x;
|
||||
int16 y;
|
||||
int16 px;
|
||||
int16 py;
|
||||
int16 z1;
|
||||
int16 z2;
|
||||
} touchPosition;
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
/** C++ compatible bool for C
|
||||
|
||||
*/
|
||||
typedef enum { false, true } bool;
|
||||
#endif
|
||||
|
||||
// Handy function pointer typedefs
|
||||
typedef void ( * IntFn)(void);
|
||||
typedef void (* VoidFunctionPointer)(void);
|
||||
typedef void (* fp)(void);
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
#endif
|
||||
//---------------------------------------------------------------------------------
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef CIRCLE_CONTACT_H
|
||||
#define CIRCLE_CONTACT_H
|
||||
|
||||
#include "../../Common/b2Math.h"
|
||||
#include "../../Collision/b2Collision.h"
|
||||
#include "b2Contact.h"
|
||||
|
||||
class b2BlockAllocator;
|
||||
|
||||
class b2CircleContact : public b2Contact
|
||||
{
|
||||
public:
|
||||
static b2Contact* Create(b2Shape* shape1, b2Shape* shape2, b2BlockAllocator* allocator);
|
||||
static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
|
||||
|
||||
b2CircleContact(b2Shape* shape1, b2Shape* shape2);
|
||||
~b2CircleContact() {}
|
||||
|
||||
void Evaluate(b2ContactListener* listener);
|
||||
b2Manifold* GetManifolds()
|
||||
{
|
||||
return &m_manifold;
|
||||
}
|
||||
|
||||
b2Manifold m_manifold;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef CONTACT_H
|
||||
#define CONTACT_H
|
||||
|
||||
#include "../../Common/b2Math.h"
|
||||
#include "../../Collision/b2Collision.h"
|
||||
#include "../../Collision/Shapes/b2Shape.h"
|
||||
|
||||
class b2Body;
|
||||
class b2Contact;
|
||||
class b2World;
|
||||
class b2BlockAllocator;
|
||||
class b2StackAllocator;
|
||||
class b2ContactListener;
|
||||
|
||||
typedef b2Contact* b2ContactCreateFcn(b2Shape* shape1, b2Shape* shape2, b2BlockAllocator* allocator);
|
||||
typedef void b2ContactDestroyFcn(b2Contact* contact, b2BlockAllocator* allocator);
|
||||
|
||||
struct b2ContactRegister
|
||||
{
|
||||
b2ContactCreateFcn* createFcn;
|
||||
b2ContactDestroyFcn* destroyFcn;
|
||||
bool primary;
|
||||
};
|
||||
|
||||
/// A contact edge is used to connect bodies and contacts together
|
||||
/// in a contact graph where each body is a node and each contact
|
||||
/// is an edge. A contact edge belongs to a doubly linked list
|
||||
/// maintained in each attached body. Each contact has two contact
|
||||
/// nodes, one for each attached body.
|
||||
struct b2ContactEdge
|
||||
{
|
||||
b2Body* other; ///< provides quick access to the other body attached.
|
||||
b2Contact* contact; ///< the contact
|
||||
b2ContactEdge* prev; ///< the previous contact edge in the body's contact list
|
||||
b2ContactEdge* next; ///< the next contact edge in the body's contact list
|
||||
};
|
||||
|
||||
/// This structure is used to report contact points.
|
||||
struct b2ContactPoint
|
||||
{
|
||||
b2Shape* shape1; ///< the first shape
|
||||
b2Shape* shape2; ///< the second shape
|
||||
b2Vec2 position; ///< position in world coordinates
|
||||
b2Vec2 velocity; ///< velocity of point on body2 relative to point on body1 (pre-solver)
|
||||
b2Vec2 normal; ///< points from shape1 to shape2
|
||||
float32 separation; ///< the separation is negative when shapes are touching
|
||||
float32 friction; ///< the combined friction coefficient
|
||||
float32 restitution; ///< the combined restitution coefficient
|
||||
b2ContactID id; ///< the contact id identifies the features in contact
|
||||
};
|
||||
|
||||
/// This structure is used to report contact point results.
|
||||
struct b2ContactResult
|
||||
{
|
||||
b2Shape* shape1; ///< the first shape
|
||||
b2Shape* shape2; ///< the second shape
|
||||
b2Vec2 position; ///< position in world coordinates
|
||||
b2Vec2 normal; ///< points from shape1 to shape2
|
||||
float32 normalImpulse; ///< the normal impulse applied to body2
|
||||
float32 tangentImpulse; ///< the tangent impulse applied to body2
|
||||
b2ContactID id; ///< the contact id identifies the features in contact
|
||||
};
|
||||
|
||||
/// The class manages contact between two shapes. A contact exists for each overlapping
|
||||
/// AABB in the broad-phase (except if filtered). Therefore a contact object may exist
|
||||
/// that has no contact points.
|
||||
class b2Contact
|
||||
{
|
||||
public:
|
||||
|
||||
/// Get the manifold array.
|
||||
virtual b2Manifold* GetManifolds() = 0;
|
||||
|
||||
/// Get the number of manifolds. This is 0 or 1 between convex shapes.
|
||||
/// This may be greater than 1 for convex-vs-concave shapes. Each
|
||||
/// manifold holds up to two contact points with a shared contact normal.
|
||||
int32 GetManifoldCount() const;
|
||||
|
||||
/// Is this contact solid?
|
||||
/// @return true if this contact should generate a response.
|
||||
bool IsSolid() const;
|
||||
|
||||
/// Get the next contact in the world's contact list.
|
||||
b2Contact* GetNext();
|
||||
|
||||
/// Get the first shape in this contact.
|
||||
b2Shape* GetShape1();
|
||||
|
||||
/// Get the second shape in this contact.
|
||||
b2Shape* GetShape2();
|
||||
|
||||
//--------------- Internals Below -------------------
|
||||
public:
|
||||
|
||||
// m_flags
|
||||
enum
|
||||
{
|
||||
e_nonSolidFlag = 0x0001,
|
||||
e_slowFlag = 0x0002,
|
||||
e_islandFlag = 0x0004,
|
||||
e_toiFlag = 0x0008,
|
||||
};
|
||||
|
||||
static void AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* destroyFcn,
|
||||
b2ShapeType type1, b2ShapeType type2);
|
||||
static void InitializeRegisters();
|
||||
static b2Contact* Create(b2Shape* shape1, b2Shape* shape2, b2BlockAllocator* allocator);
|
||||
static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
|
||||
|
||||
b2Contact() : m_shape1(NULL), m_shape2(NULL) {}
|
||||
b2Contact(b2Shape* shape1, b2Shape* shape2);
|
||||
virtual ~b2Contact() {}
|
||||
|
||||
void Update(b2ContactListener* listener);
|
||||
virtual void Evaluate(b2ContactListener* listener) = 0;
|
||||
static b2ContactRegister s_registers[e_shapeTypeCount][e_shapeTypeCount];
|
||||
static bool s_initialized;
|
||||
|
||||
uint32 m_flags;
|
||||
int32 m_manifoldCount;
|
||||
|
||||
// World pool and list pointers.
|
||||
b2Contact* m_prev;
|
||||
b2Contact* m_next;
|
||||
|
||||
// Nodes for connecting bodies.
|
||||
b2ContactEdge m_node1;
|
||||
b2ContactEdge m_node2;
|
||||
|
||||
b2Shape* m_shape1;
|
||||
b2Shape* m_shape2;
|
||||
|
||||
// Combined friction
|
||||
float32 m_friction;
|
||||
float32 m_restitution;
|
||||
|
||||
float32 m_toi;
|
||||
};
|
||||
|
||||
inline int32 b2Contact::GetManifoldCount() const
|
||||
{
|
||||
return m_manifoldCount;
|
||||
}
|
||||
|
||||
inline bool b2Contact::IsSolid() const
|
||||
{
|
||||
return (m_flags & e_nonSolidFlag) == 0;
|
||||
}
|
||||
|
||||
inline b2Contact* b2Contact::GetNext()
|
||||
{
|
||||
return m_next;
|
||||
}
|
||||
|
||||
inline b2Shape* b2Contact::GetShape1()
|
||||
{
|
||||
return m_shape1;
|
||||
}
|
||||
|
||||
inline b2Shape* b2Contact::GetShape2()
|
||||
{
|
||||
return m_shape2;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef CONTACT_SOLVER_H
|
||||
#define CONTACT_SOLVER_H
|
||||
|
||||
#include "../../Common/b2Math.h"
|
||||
#include "../../Collision/b2Collision.h"
|
||||
#include "../b2World.h"
|
||||
|
||||
class b2Contact;
|
||||
class b2Body;
|
||||
class b2Island;
|
||||
class b2StackAllocator;
|
||||
|
||||
struct b2ContactConstraintPoint
|
||||
{
|
||||
b2Vec2 localAnchor1;
|
||||
b2Vec2 localAnchor2;
|
||||
b2Vec2 r1;
|
||||
b2Vec2 r2;
|
||||
float32 normalImpulse;
|
||||
float32 tangentImpulse;
|
||||
float32 positionImpulse;
|
||||
float32 normalMass;
|
||||
float32 tangentMass;
|
||||
float32 equalizedMass;
|
||||
float32 separation;
|
||||
float32 velocityBias;
|
||||
};
|
||||
|
||||
struct b2ContactConstraint
|
||||
{
|
||||
b2ContactConstraintPoint points[b2_maxManifoldPoints];
|
||||
b2Vec2 normal;
|
||||
b2Manifold* manifold;
|
||||
b2Body* body1;
|
||||
b2Body* body2;
|
||||
float32 friction;
|
||||
float32 restitution;
|
||||
int32 pointCount;
|
||||
};
|
||||
|
||||
class b2ContactSolver
|
||||
{
|
||||
public:
|
||||
b2ContactSolver(const b2TimeStep& step, b2Contact** contacts, int32 contactCount, b2StackAllocator* allocator);
|
||||
~b2ContactSolver();
|
||||
|
||||
void InitVelocityConstraints(const b2TimeStep& step);
|
||||
void SolveVelocityConstraints();
|
||||
void FinalizeVelocityConstraints();
|
||||
|
||||
bool SolvePositionConstraints(float32 baumgarte);
|
||||
|
||||
b2TimeStep m_step;
|
||||
b2StackAllocator* m_allocator;
|
||||
b2ContactConstraint* m_constraints;
|
||||
int m_constraintCount;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_NULL_CONTACT_H
|
||||
#define B2_NULL_CONTACT_H
|
||||
|
||||
#include "../../Common/b2Math.h"
|
||||
#include "b2Contact.h"
|
||||
|
||||
class b2NullContact : public b2Contact
|
||||
{
|
||||
public:
|
||||
b2NullContact() {}
|
||||
void Evaluate(b2ContactListener*) {}
|
||||
b2Manifold* GetManifolds() { return NULL; }
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef POLY_AND_CIRCLE_CONTACT_H
|
||||
#define POLY_AND_CIRCLE_CONTACT_H
|
||||
|
||||
#include "b2Contact.h"
|
||||
|
||||
class b2BlockAllocator;
|
||||
|
||||
class b2PolyAndCircleContact : public b2Contact
|
||||
{
|
||||
public:
|
||||
static b2Contact* Create(b2Shape* shape1, b2Shape* shape2, b2BlockAllocator* allocator);
|
||||
static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
|
||||
|
||||
b2PolyAndCircleContact(b2Shape* shape1, b2Shape* shape2);
|
||||
~b2PolyAndCircleContact() {}
|
||||
|
||||
void Evaluate(b2ContactListener* listener);
|
||||
b2Manifold* GetManifolds()
|
||||
{
|
||||
return &m_manifold;
|
||||
}
|
||||
|
||||
b2Manifold m_manifold;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef POLYCONTACT_H
|
||||
#define POLYCONTACT_H
|
||||
|
||||
#include "b2Contact.h"
|
||||
|
||||
class b2BlockAllocator;
|
||||
|
||||
class b2PolygonContact : public b2Contact
|
||||
{
|
||||
public:
|
||||
static b2Contact* Create(b2Shape* shape1, b2Shape* shape2, b2BlockAllocator* allocator);
|
||||
static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
|
||||
|
||||
b2PolygonContact(b2Shape* shape1, b2Shape* shape2);
|
||||
~b2PolygonContact() {}
|
||||
|
||||
void Evaluate(b2ContactListener* listener);
|
||||
b2Manifold* GetManifolds()
|
||||
{
|
||||
return &m_manifold;
|
||||
}
|
||||
|
||||
b2Manifold m_manifold;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_DISTANCE_JOINT_H
|
||||
#define B2_DISTANCE_JOINT_H
|
||||
|
||||
#include "b2Joint.h"
|
||||
|
||||
/// Distance joint definition. This requires defining an
|
||||
/// anchor point on both bodies and the non-zero length of the
|
||||
/// distance joint. The definition uses local anchor points
|
||||
/// so that the initial configuration can violate the constraint
|
||||
/// slightly. This helps when saving and loading a game.
|
||||
/// @warning Do not use a zero or short length.
|
||||
struct b2DistanceJointDef : public b2JointDef
|
||||
{
|
||||
b2DistanceJointDef()
|
||||
{
|
||||
type = e_distanceJoint;
|
||||
localAnchor1.Set(0.0f, 0.0f);
|
||||
localAnchor2.Set(0.0f, 0.0f);
|
||||
length = 1.0f;
|
||||
frequencyHz = 0.0f;
|
||||
dampingRatio = 0.0f;
|
||||
}
|
||||
|
||||
/// Initialize the bodies, anchors, and length using the world
|
||||
/// anchors.
|
||||
void Initialize(b2Body* body1, b2Body* body2,
|
||||
const b2Vec2& anchor1, const b2Vec2& anchor2);
|
||||
|
||||
/// The local anchor point relative to body1's origin.
|
||||
b2Vec2 localAnchor1;
|
||||
|
||||
/// The local anchor point relative to body2's origin.
|
||||
b2Vec2 localAnchor2;
|
||||
|
||||
/// The equilibrium length between the anchor points.
|
||||
float32 length;
|
||||
|
||||
/// The response speed.
|
||||
float32 frequencyHz;
|
||||
|
||||
/// The damping ratio. 0 = no damping, 1 = critical damping.
|
||||
float32 dampingRatio;
|
||||
};
|
||||
|
||||
/// A distance joint constrains two points on two bodies
|
||||
/// to remain at a fixed distance from each other. You can view
|
||||
/// this as a massless, rigid rod.
|
||||
class b2DistanceJoint : public b2Joint
|
||||
{
|
||||
public:
|
||||
|
||||
b2Vec2 GetAnchor1() const;
|
||||
b2Vec2 GetAnchor2() const;
|
||||
|
||||
b2Vec2 GetReactionForce() const;
|
||||
float32 GetReactionTorque() const;
|
||||
|
||||
//--------------- Internals Below -------------------
|
||||
|
||||
b2DistanceJoint(const b2DistanceJointDef* data);
|
||||
|
||||
void InitVelocityConstraints(const b2TimeStep& step);
|
||||
void SolveVelocityConstraints(const b2TimeStep& step);
|
||||
bool SolvePositionConstraints();
|
||||
|
||||
b2Vec2 m_localAnchor1;
|
||||
b2Vec2 m_localAnchor2;
|
||||
b2Vec2 m_u;
|
||||
float32 m_frequencyHz;
|
||||
float32 m_dampingRatio;
|
||||
float32 m_gamma;
|
||||
float32 m_bias;
|
||||
float32 m_impulse;
|
||||
float32 m_mass; // effective mass for the constraint.
|
||||
float32 m_length;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_GEAR_JOINT_H
|
||||
#define B2_GEAR_JOINT_H
|
||||
|
||||
#include "b2Joint.h"
|
||||
|
||||
class b2RevoluteJoint;
|
||||
class b2PrismaticJoint;
|
||||
|
||||
/// Gear joint definition. This definition requires two existing
|
||||
/// revolute or prismatic joints (any combination will work).
|
||||
/// The provided joints must attach a dynamic body to a static body.
|
||||
struct b2GearJointDef : public b2JointDef
|
||||
{
|
||||
b2GearJointDef()
|
||||
{
|
||||
type = e_gearJoint;
|
||||
joint1 = NULL;
|
||||
joint2 = NULL;
|
||||
ratio = 1.0f;
|
||||
}
|
||||
|
||||
/// The first revolute/prismatic joint attached to the gear joint.
|
||||
b2Joint* joint1;
|
||||
|
||||
/// The second revolute/prismatic joint attached to the gear joint.
|
||||
b2Joint* joint2;
|
||||
|
||||
/// The gear ratio.
|
||||
/// @see b2GearJoint for explanation.
|
||||
float32 ratio;
|
||||
};
|
||||
|
||||
/// A gear joint is used to connect two joints together. Either joint
|
||||
/// can be a revolute or prismatic joint. You specify a gear ratio
|
||||
/// to bind the motions together:
|
||||
/// coordinate1 + ratio * coordinate2 = constant
|
||||
/// The ratio can be negative or positive. If one joint is a revolute joint
|
||||
/// and the other joint is a prismatic joint, then the ratio will have units
|
||||
/// of length or units of 1/length.
|
||||
/// @warning The revolute and prismatic joints must be attached to
|
||||
/// fixed bodies (which must be body1 on those joints).
|
||||
class b2GearJoint : public b2Joint
|
||||
{
|
||||
public:
|
||||
b2Vec2 GetAnchor1() const;
|
||||
b2Vec2 GetAnchor2() const;
|
||||
|
||||
b2Vec2 GetReactionForce() const;
|
||||
float32 GetReactionTorque() const;
|
||||
|
||||
/// Get the gear ratio.
|
||||
float32 GetRatio() const;
|
||||
|
||||
//--------------- Internals Below -------------------
|
||||
|
||||
b2GearJoint(const b2GearJointDef* data);
|
||||
|
||||
void InitVelocityConstraints(const b2TimeStep& step);
|
||||
void SolveVelocityConstraints(const b2TimeStep& step);
|
||||
bool SolvePositionConstraints();
|
||||
|
||||
b2Body* m_ground1;
|
||||
b2Body* m_ground2;
|
||||
|
||||
// One of these is NULL.
|
||||
b2RevoluteJoint* m_revolute1;
|
||||
b2PrismaticJoint* m_prismatic1;
|
||||
|
||||
// One of these is NULL.
|
||||
b2RevoluteJoint* m_revolute2;
|
||||
b2PrismaticJoint* m_prismatic2;
|
||||
|
||||
b2Vec2 m_groundAnchor1;
|
||||
b2Vec2 m_groundAnchor2;
|
||||
|
||||
b2Vec2 m_localAnchor1;
|
||||
b2Vec2 m_localAnchor2;
|
||||
|
||||
b2Jacobian m_J;
|
||||
|
||||
float32 m_constant;
|
||||
float32 m_ratio;
|
||||
|
||||
// Effective mass
|
||||
float32 m_mass;
|
||||
|
||||
// Impulse for accumulation/warm starting.
|
||||
float32 m_force;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef JOINT_H
|
||||
#define JOINT_H
|
||||
|
||||
#include "../../Common/b2Math.h"
|
||||
|
||||
class b2Body;
|
||||
class b2Joint;
|
||||
struct b2TimeStep;
|
||||
class b2BlockAllocator;
|
||||
|
||||
enum b2JointType
|
||||
{
|
||||
e_unknownJoint,
|
||||
e_revoluteJoint,
|
||||
e_prismaticJoint,
|
||||
e_distanceJoint,
|
||||
e_pulleyJoint,
|
||||
e_mouseJoint,
|
||||
e_gearJoint
|
||||
};
|
||||
|
||||
enum b2LimitState
|
||||
{
|
||||
e_inactiveLimit,
|
||||
e_atLowerLimit,
|
||||
e_atUpperLimit,
|
||||
e_equalLimits
|
||||
};
|
||||
|
||||
struct b2Jacobian
|
||||
{
|
||||
b2Vec2 linear1;
|
||||
float32 angular1;
|
||||
b2Vec2 linear2;
|
||||
float32 angular2;
|
||||
|
||||
void SetZero();
|
||||
void Set(const b2Vec2& x1, float32 a1, const b2Vec2& x2, float32 a2);
|
||||
float32 Compute(const b2Vec2& x1, float32 a1, const b2Vec2& x2, float32 a2);
|
||||
};
|
||||
|
||||
/// A joint edge is used to connect bodies and joints together
|
||||
/// in a joint graph where each body is a node and each joint
|
||||
/// is an edge. A joint edge belongs to a doubly linked list
|
||||
/// maintained in each attached body. Each joint has two joint
|
||||
/// nodes, one for each attached body.
|
||||
struct b2JointEdge
|
||||
{
|
||||
b2Body* other; ///< provides quick access to the other body attached.
|
||||
b2Joint* joint; ///< the joint
|
||||
b2JointEdge* prev; ///< the previous joint edge in the body's joint list
|
||||
b2JointEdge* next; ///< the next joint edge in the body's joint list
|
||||
};
|
||||
|
||||
/// Joint definitions are used to construct joints.
|
||||
struct b2JointDef
|
||||
{
|
||||
b2JointDef()
|
||||
{
|
||||
type = e_unknownJoint;
|
||||
userData = NULL;
|
||||
body1 = NULL;
|
||||
body2 = NULL;
|
||||
collideConnected = false;
|
||||
}
|
||||
|
||||
/// The joint type is set automatically for concrete joint types.
|
||||
b2JointType type;
|
||||
|
||||
/// Use this to attach application specific data to your joints.
|
||||
void* userData;
|
||||
|
||||
/// The first attached body.
|
||||
b2Body* body1;
|
||||
|
||||
/// The second attached body.
|
||||
b2Body* body2;
|
||||
|
||||
/// Set this flag to true if the attached bodies should collide.
|
||||
bool collideConnected;
|
||||
};
|
||||
|
||||
/// The base joint class. Joints are used to constraint two bodies together in
|
||||
/// various fashions. Some joints also feature limits and motors.
|
||||
class b2Joint
|
||||
{
|
||||
public:
|
||||
|
||||
/// Get the type of the concrete joint.
|
||||
b2JointType GetType() const;
|
||||
|
||||
/// Get the first body attached to this joint.
|
||||
b2Body* GetBody1();
|
||||
|
||||
/// Get the second body attached to this joint.
|
||||
b2Body* GetBody2();
|
||||
|
||||
/// Get the anchor point on body1 in world coordinates.
|
||||
virtual b2Vec2 GetAnchor1() const = 0;
|
||||
|
||||
/// Get the anchor point on body2 in world coordinates.
|
||||
virtual b2Vec2 GetAnchor2() const = 0;
|
||||
|
||||
/// Get the reaction force on body2 at the joint anchor.
|
||||
virtual b2Vec2 GetReactionForce() const = 0;
|
||||
|
||||
/// Get the reaction torque on body2.
|
||||
virtual float32 GetReactionTorque() const = 0;
|
||||
|
||||
/// Get the next joint the world joint list.
|
||||
b2Joint* GetNext();
|
||||
|
||||
/// Get the user data pointer.
|
||||
void* GetUserData();
|
||||
|
||||
/// Set the user data pointer.
|
||||
void SetUserData(void* data);
|
||||
|
||||
//--------------- Internals Below -------------------
|
||||
protected:
|
||||
friend class b2World;
|
||||
friend class b2Body;
|
||||
friend class b2Island;
|
||||
|
||||
static b2Joint* Create(const b2JointDef* def, b2BlockAllocator* allocator);
|
||||
static void Destroy(b2Joint* joint, b2BlockAllocator* allocator);
|
||||
|
||||
b2Joint(const b2JointDef* def);
|
||||
virtual ~b2Joint() {}
|
||||
|
||||
virtual void InitVelocityConstraints(const b2TimeStep& step) = 0;
|
||||
virtual void SolveVelocityConstraints(const b2TimeStep& step) = 0;
|
||||
|
||||
// This returns true if the position errors are within tolerance.
|
||||
virtual void InitPositionConstraints() {}
|
||||
virtual bool SolvePositionConstraints() = 0;
|
||||
|
||||
b2JointType m_type;
|
||||
b2Joint* m_prev;
|
||||
b2Joint* m_next;
|
||||
b2JointEdge m_node1;
|
||||
b2JointEdge m_node2;
|
||||
b2Body* m_body1;
|
||||
b2Body* m_body2;
|
||||
|
||||
float32 m_inv_dt;
|
||||
|
||||
bool m_islandFlag;
|
||||
bool m_collideConnected;
|
||||
|
||||
void* m_userData;
|
||||
};
|
||||
|
||||
inline void b2Jacobian::SetZero()
|
||||
{
|
||||
linear1.SetZero(); angular1 = 0.0f;
|
||||
linear2.SetZero(); angular2 = 0.0f;
|
||||
}
|
||||
|
||||
inline void b2Jacobian::Set(const b2Vec2& x1, float32 a1, const b2Vec2& x2, float32 a2)
|
||||
{
|
||||
linear1 = x1; angular1 = a1;
|
||||
linear2 = x2; angular2 = a2;
|
||||
}
|
||||
|
||||
inline float32 b2Jacobian::Compute(const b2Vec2& x1, float32 a1, const b2Vec2& x2, float32 a2)
|
||||
{
|
||||
return b2Dot(linear1, x1) + angular1 * a1 + b2Dot(linear2, x2) + angular2 * a2;
|
||||
}
|
||||
|
||||
inline b2JointType b2Joint::GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
inline b2Body* b2Joint::GetBody1()
|
||||
{
|
||||
return m_body1;
|
||||
}
|
||||
|
||||
inline b2Body* b2Joint::GetBody2()
|
||||
{
|
||||
return m_body2;
|
||||
}
|
||||
|
||||
inline b2Joint* b2Joint::GetNext()
|
||||
{
|
||||
return m_next;
|
||||
}
|
||||
|
||||
inline void* b2Joint::GetUserData()
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
|
||||
inline void b2Joint::SetUserData(void* data)
|
||||
{
|
||||
m_userData = data;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_MOUSE_JOINT_H
|
||||
#define B2_MOUSE_JOINT_H
|
||||
|
||||
#include "b2Joint.h"
|
||||
|
||||
/// Mouse joint definition. This requires a world target point,
|
||||
/// tuning parameters, and the time step.
|
||||
struct b2MouseJointDef : public b2JointDef
|
||||
{
|
||||
b2MouseJointDef()
|
||||
{
|
||||
type = e_mouseJoint;
|
||||
target.Set(0.0f, 0.0f);
|
||||
maxForce = 0.0f;
|
||||
frequencyHz = 5.0f;
|
||||
dampingRatio = 0.7f;
|
||||
timeStep = 1.0f / 60.0f;
|
||||
}
|
||||
|
||||
/// The initial world target point. This is assumed
|
||||
/// to coincide with the body anchor initially.
|
||||
b2Vec2 target;
|
||||
|
||||
/// The maximum constraint force that can be exerted
|
||||
/// to move the candidate body. Usually you will express
|
||||
/// as some multiple of the weight (multiplier * mass * gravity).
|
||||
float32 maxForce;
|
||||
|
||||
/// The response speed.
|
||||
float32 frequencyHz;
|
||||
|
||||
/// The damping ratio. 0 = no damping, 1 = critical damping.
|
||||
float32 dampingRatio;
|
||||
|
||||
/// The time step used in the simulation.
|
||||
float32 timeStep;
|
||||
};
|
||||
|
||||
/// A mouse joint is used to make a point on a body track a
|
||||
/// specified world point. This a soft constraint with a maximum
|
||||
/// force. This allows the constraint to stretch and without
|
||||
/// applying huge forces.
|
||||
class b2MouseJoint : public b2Joint
|
||||
{
|
||||
public:
|
||||
|
||||
/// Implements b2Joint.
|
||||
b2Vec2 GetAnchor1() const;
|
||||
|
||||
/// Implements b2Joint.
|
||||
b2Vec2 GetAnchor2() const;
|
||||
|
||||
/// Implements b2Joint.
|
||||
b2Vec2 GetReactionForce() const;
|
||||
|
||||
/// Implements b2Joint.
|
||||
float32 GetReactionTorque() const;
|
||||
|
||||
/// Use this to update the target point.
|
||||
void SetTarget(const b2Vec2& target);
|
||||
|
||||
//--------------- Internals Below -------------------
|
||||
|
||||
b2MouseJoint(const b2MouseJointDef* def);
|
||||
|
||||
void InitVelocityConstraints(const b2TimeStep& step);
|
||||
void SolveVelocityConstraints(const b2TimeStep& step);
|
||||
bool SolvePositionConstraints()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
b2Vec2 m_localAnchor;
|
||||
b2Vec2 m_target;
|
||||
b2Vec2 m_impulse;
|
||||
|
||||
b2Mat22 m_mass; // effective mass for point-to-point constraint.
|
||||
b2Vec2 m_C; // position error
|
||||
float32 m_maxForce;
|
||||
float32 m_beta; // bias factor
|
||||
float32 m_gamma; // softness
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_PRISMATIC_JOINT_H
|
||||
#define B2_PRISMATIC_JOINT_H
|
||||
|
||||
#include "b2Joint.h"
|
||||
|
||||
/// Prismatic joint definition. This requires defining a line of
|
||||
/// motion using an axis and an anchor point. The definition uses local
|
||||
/// anchor points and a local axis so that the initial configuration
|
||||
/// can violate the constraint slightly. The joint translation is zero
|
||||
/// when the local anchor points coincide in world space. Using local
|
||||
/// anchors and a local axis helps when saving and loading a game.
|
||||
struct b2PrismaticJointDef : public b2JointDef
|
||||
{
|
||||
b2PrismaticJointDef()
|
||||
{
|
||||
type = e_prismaticJoint;
|
||||
localAnchor1.SetZero();
|
||||
localAnchor2.SetZero();
|
||||
localAxis1.Set(1.0f, 0.0f);
|
||||
referenceAngle = 0.0f;
|
||||
enableLimit = false;
|
||||
lowerTranslation = 0.0f;
|
||||
upperTranslation = 0.0f;
|
||||
enableMotor = false;
|
||||
maxMotorForce = 0.0f;
|
||||
motorSpeed = 0.0f;
|
||||
}
|
||||
|
||||
/// Initialize the bodies, anchors, axis, and reference angle using the world
|
||||
/// anchor and world axis.
|
||||
void Initialize(b2Body* body1, b2Body* body2, const b2Vec2& anchor, const b2Vec2& axis);
|
||||
|
||||
/// The local anchor point relative to body1's origin.
|
||||
b2Vec2 localAnchor1;
|
||||
|
||||
/// The local anchor point relative to body2's origin.
|
||||
b2Vec2 localAnchor2;
|
||||
|
||||
/// The local translation axis in body1.
|
||||
b2Vec2 localAxis1;
|
||||
|
||||
/// The constrained angle between the bodies: body2_angle - body1_angle.
|
||||
float32 referenceAngle;
|
||||
|
||||
/// Enable/disable the joint limit.
|
||||
bool enableLimit;
|
||||
|
||||
/// The lower translation limit, usually in meters.
|
||||
float32 lowerTranslation;
|
||||
|
||||
/// The upper translation limit, usually in meters.
|
||||
float32 upperTranslation;
|
||||
|
||||
/// Enable/disable the joint motor.
|
||||
bool enableMotor;
|
||||
|
||||
/// The maximum motor torque, usually in N-m.
|
||||
float32 maxMotorForce;
|
||||
|
||||
/// The desired motor speed in radians per second.
|
||||
float32 motorSpeed;
|
||||
};
|
||||
|
||||
/// A prismatic joint. This joint provides one degree of freedom: translation
|
||||
/// along an axis fixed in body1. Relative rotation is prevented. You can
|
||||
/// use a joint limit to restrict the range of motion and a joint motor to
|
||||
/// drive the motion or to model joint friction.
|
||||
class b2PrismaticJoint : public b2Joint
|
||||
{
|
||||
public:
|
||||
b2Vec2 GetAnchor1() const;
|
||||
b2Vec2 GetAnchor2() const;
|
||||
|
||||
b2Vec2 GetReactionForce() const;
|
||||
float32 GetReactionTorque() const;
|
||||
|
||||
/// Get the current joint translation, usually in meters.
|
||||
float32 GetJointTranslation() const;
|
||||
|
||||
/// Get the current joint translation speed, usually in meters per second.
|
||||
float32 GetJointSpeed() const;
|
||||
|
||||
/// Is the joint limit enabled?
|
||||
bool IsLimitEnabled() const;
|
||||
|
||||
/// Enable/disable the joint limit.
|
||||
void EnableLimit(bool flag);
|
||||
|
||||
/// Get the lower joint limit, usually in meters.
|
||||
float32 GetLowerLimit() const;
|
||||
|
||||
/// Get the upper joint limit, usually in meters.
|
||||
float32 GetUpperLimit() const;
|
||||
|
||||
/// Set the joint limits, usually in meters.
|
||||
void SetLimits(float32 lower, float32 upper);
|
||||
|
||||
/// Is the joint motor enabled?
|
||||
bool IsMotorEnabled() const;
|
||||
|
||||
/// Enable/disable the joint motor.
|
||||
void EnableMotor(bool flag);
|
||||
|
||||
/// Set the motor speed, usually in meters per second.
|
||||
void SetMotorSpeed(float32 speed);
|
||||
|
||||
/// Get the motor speed, usually in meters per second.
|
||||
float32 GetMotorSpeed() const;
|
||||
|
||||
/// Set the maximum motor force, usually in N.
|
||||
void SetMaxMotorForce(float32 force);
|
||||
|
||||
/// Get the current motor force, usually in N.
|
||||
float32 GetMotorForce() const;
|
||||
|
||||
//--------------- Internals Below -------------------
|
||||
|
||||
b2PrismaticJoint(const b2PrismaticJointDef* def);
|
||||
|
||||
void InitVelocityConstraints(const b2TimeStep& step);
|
||||
void SolveVelocityConstraints(const b2TimeStep& step);
|
||||
bool SolvePositionConstraints();
|
||||
|
||||
b2Vec2 m_localAnchor1;
|
||||
b2Vec2 m_localAnchor2;
|
||||
b2Vec2 m_localXAxis1;
|
||||
b2Vec2 m_localYAxis1;
|
||||
float32 m_refAngle;
|
||||
|
||||
b2Jacobian m_linearJacobian;
|
||||
float32 m_linearMass; // effective mass for point-to-line constraint.
|
||||
float32 m_force;
|
||||
|
||||
float32 m_angularMass; // effective mass for angular constraint.
|
||||
float32 m_torque;
|
||||
|
||||
b2Jacobian m_motorJacobian;
|
||||
float32 m_motorMass; // effective mass for motor/limit translational constraint.
|
||||
float32 m_motorForce;
|
||||
float32 m_limitForce;
|
||||
float32 m_limitPositionImpulse;
|
||||
|
||||
float32 m_lowerTranslation;
|
||||
float32 m_upperTranslation;
|
||||
float32 m_maxMotorForce;
|
||||
float32 m_motorSpeed;
|
||||
|
||||
bool m_enableLimit;
|
||||
bool m_enableMotor;
|
||||
b2LimitState m_limitState;
|
||||
};
|
||||
|
||||
inline float32 b2PrismaticJoint::GetMotorSpeed() const
|
||||
{
|
||||
return m_motorSpeed;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_PULLEY_JOINT_H
|
||||
#define B2_PULLEY_JOINT_H
|
||||
|
||||
#include "b2Joint.h"
|
||||
|
||||
const float32 b2_minPulleyLength = 2.0f;
|
||||
|
||||
/// Pulley joint definition. This requires two ground anchors,
|
||||
/// two dynamic body anchor points, max lengths for each side,
|
||||
/// and a pulley ratio.
|
||||
struct b2PulleyJointDef : public b2JointDef
|
||||
{
|
||||
b2PulleyJointDef()
|
||||
{
|
||||
type = e_pulleyJoint;
|
||||
groundAnchor1.Set(-1.0f, 1.0f);
|
||||
groundAnchor2.Set(1.0f, 1.0f);
|
||||
localAnchor1.Set(-1.0f, 0.0f);
|
||||
localAnchor2.Set(1.0f, 0.0f);
|
||||
length1 = 0.0f;
|
||||
maxLength1 = 0.0f;
|
||||
length2 = 0.0f;
|
||||
maxLength2 = 0.0f;
|
||||
ratio = 1.0f;
|
||||
collideConnected = true;
|
||||
}
|
||||
|
||||
/// Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
|
||||
void Initialize(b2Body* body1, b2Body* body2,
|
||||
const b2Vec2& groundAnchor1, const b2Vec2& groundAnchor2,
|
||||
const b2Vec2& anchor1, const b2Vec2& anchor2,
|
||||
float32 ratio);
|
||||
|
||||
/// The first ground anchor in world coordinates. This point never moves.
|
||||
b2Vec2 groundAnchor1;
|
||||
|
||||
/// The second ground anchor in world coordinates. This point never moves.
|
||||
b2Vec2 groundAnchor2;
|
||||
|
||||
/// The local anchor point relative to body1's origin.
|
||||
b2Vec2 localAnchor1;
|
||||
|
||||
/// The local anchor point relative to body2's origin.
|
||||
b2Vec2 localAnchor2;
|
||||
|
||||
/// The a reference length for the segment attached to body1.
|
||||
float32 length1;
|
||||
|
||||
/// The maximum length of the segment attached to body1.
|
||||
float32 maxLength1;
|
||||
|
||||
/// The a reference length for the segment attached to body2.
|
||||
float32 length2;
|
||||
|
||||
/// The maximum length of the segment attached to body2.
|
||||
float32 maxLength2;
|
||||
|
||||
/// The pulley ratio, used to simulate a block-and-tackle.
|
||||
float32 ratio;
|
||||
};
|
||||
|
||||
/// The pulley joint is connected to two bodies and two fixed ground points.
|
||||
/// The pulley supports a ratio such that:
|
||||
/// length1 + ratio * length2 <= constant
|
||||
/// Yes, the force transmitted is scaled by the ratio.
|
||||
/// The pulley also enforces a maximum length limit on both sides. This is
|
||||
/// useful to prevent one side of the pulley hitting the top.
|
||||
class b2PulleyJoint : public b2Joint
|
||||
{
|
||||
public:
|
||||
b2Vec2 GetAnchor1() const;
|
||||
b2Vec2 GetAnchor2() const;
|
||||
|
||||
b2Vec2 GetReactionForce() const;
|
||||
float32 GetReactionTorque() const;
|
||||
|
||||
/// Get the first ground anchor.
|
||||
b2Vec2 GetGroundAnchor1() const;
|
||||
|
||||
/// Get the second ground anchor.
|
||||
b2Vec2 GetGroundAnchor2() const;
|
||||
|
||||
/// Get the current length of the segment attached to body1.
|
||||
float32 GetLength1() const;
|
||||
|
||||
/// Get the current length of the segment attached to body2.
|
||||
float32 GetLength2() const;
|
||||
|
||||
/// Get the pulley ratio.
|
||||
float32 GetRatio() const;
|
||||
|
||||
//--------------- Internals Below -------------------
|
||||
|
||||
b2PulleyJoint(const b2PulleyJointDef* data);
|
||||
|
||||
void InitVelocityConstraints(const b2TimeStep& step);
|
||||
void SolveVelocityConstraints(const b2TimeStep& step);
|
||||
bool SolvePositionConstraints();
|
||||
|
||||
b2Body* m_ground;
|
||||
b2Vec2 m_groundAnchor1;
|
||||
b2Vec2 m_groundAnchor2;
|
||||
b2Vec2 m_localAnchor1;
|
||||
b2Vec2 m_localAnchor2;
|
||||
|
||||
b2Vec2 m_u1;
|
||||
b2Vec2 m_u2;
|
||||
|
||||
float32 m_constant;
|
||||
float32 m_ratio;
|
||||
|
||||
float32 m_maxLength1;
|
||||
float32 m_maxLength2;
|
||||
|
||||
// Effective masses
|
||||
float32 m_pulleyMass;
|
||||
float32 m_limitMass1;
|
||||
float32 m_limitMass2;
|
||||
|
||||
// Impulses for accumulation/warm starting.
|
||||
float32 m_force;
|
||||
float32 m_limitForce1;
|
||||
float32 m_limitForce2;
|
||||
|
||||
// Position impulses for accumulation.
|
||||
float32 m_positionImpulse;
|
||||
float32 m_limitPositionImpulse1;
|
||||
float32 m_limitPositionImpulse2;
|
||||
|
||||
b2LimitState m_state;
|
||||
b2LimitState m_limitState1;
|
||||
b2LimitState m_limitState2;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_REVOLUTE_JOINT_H
|
||||
#define B2_REVOLUTE_JOINT_H
|
||||
|
||||
#include "b2Joint.h"
|
||||
|
||||
/// Revolute joint definition. This requires defining an
|
||||
/// anchor point where the bodies are joined. The definition
|
||||
/// uses local anchor points so that the initial configuration
|
||||
/// can violate the constraint slightly. You also need to
|
||||
/// specify the initial relative angle for joint limits. This
|
||||
/// helps when saving and loading a game.
|
||||
/// The local anchor points are measured from the body's origin
|
||||
/// rather than the center of mass because:
|
||||
/// 1. you might not know where the center of mass will be.
|
||||
/// 2. if you add/remove shapes from a body and recompute the mass,
|
||||
/// the joints will be broken.
|
||||
struct b2RevoluteJointDef : public b2JointDef
|
||||
{
|
||||
b2RevoluteJointDef()
|
||||
{
|
||||
type = e_revoluteJoint;
|
||||
localAnchor1.Set(0.0f, 0.0f);
|
||||
localAnchor2.Set(0.0f, 0.0f);
|
||||
referenceAngle = 0.0f;
|
||||
lowerAngle = 0.0f;
|
||||
upperAngle = 0.0f;
|
||||
maxMotorTorque = 0.0f;
|
||||
motorSpeed = 0.0f;
|
||||
enableLimit = false;
|
||||
enableMotor = false;
|
||||
}
|
||||
|
||||
/// Initialize the bodies, anchors, and reference angle using the world
|
||||
/// anchor.
|
||||
void Initialize(b2Body* body1, b2Body* body2, const b2Vec2& anchor);
|
||||
|
||||
/// The local anchor point relative to body1's origin.
|
||||
b2Vec2 localAnchor1;
|
||||
|
||||
/// The local anchor point relative to body2's origin.
|
||||
b2Vec2 localAnchor2;
|
||||
|
||||
/// The body2 angle minus body1 angle in the reference state (radians).
|
||||
float32 referenceAngle;
|
||||
|
||||
/// A flag to enable joint limits.
|
||||
bool enableLimit;
|
||||
|
||||
/// The lower angle for the joint limit (radians).
|
||||
float32 lowerAngle;
|
||||
|
||||
/// The upper angle for the joint limit (radians).
|
||||
float32 upperAngle;
|
||||
|
||||
/// A flag to enable the joint motor.
|
||||
bool enableMotor;
|
||||
|
||||
/// The desired motor speed. Usually in radians per second.
|
||||
float32 motorSpeed;
|
||||
|
||||
/// The maximum motor torque used to achieve the desired motor speed.
|
||||
/// Usually in N-m.
|
||||
float32 maxMotorTorque;
|
||||
};
|
||||
|
||||
/// A revolute joint constrains to bodies to share a common point while they
|
||||
/// are free to rotate about the point. The relative rotation about the shared
|
||||
/// point is the joint angle. You can limit the relative rotation with
|
||||
/// a joint limit that specifies a lower and upper angle. You can use a motor
|
||||
/// to drive the relative rotation about the shared point. A maximum motor torque
|
||||
/// is provided so that infinite forces are not generated.
|
||||
class b2RevoluteJoint : public b2Joint
|
||||
{
|
||||
public:
|
||||
b2Vec2 GetAnchor1() const;
|
||||
b2Vec2 GetAnchor2() const;
|
||||
|
||||
b2Vec2 GetReactionForce() const;
|
||||
float32 GetReactionTorque() const;
|
||||
|
||||
/// Get the current joint angle in radians.
|
||||
float32 GetJointAngle() const;
|
||||
|
||||
/// Get the current joint angle speed in radians per second.
|
||||
float32 GetJointSpeed() const;
|
||||
|
||||
/// Is the joint limit enabled?
|
||||
bool IsLimitEnabled() const;
|
||||
|
||||
/// Enable/disable the joint limit.
|
||||
void EnableLimit(bool flag);
|
||||
|
||||
/// Get the lower joint limit in radians.
|
||||
float32 GetLowerLimit() const;
|
||||
|
||||
/// Get the upper joint limit in radians.
|
||||
float32 GetUpperLimit() const;
|
||||
|
||||
/// Set the joint limits in radians.
|
||||
void SetLimits(float32 lower, float32 upper);
|
||||
|
||||
/// Is the joint motor enabled?
|
||||
bool IsMotorEnabled() const;
|
||||
|
||||
/// Enable/disable the joint motor.
|
||||
void EnableMotor(bool flag);
|
||||
|
||||
/// Set the motor speed in radians per second.
|
||||
void SetMotorSpeed(float32 speed);
|
||||
|
||||
/// Get the motor speed in radians per second.
|
||||
float32 GetMotorSpeed() const;
|
||||
|
||||
/// Set the maximum motor torque, usually in N-m.
|
||||
void SetMaxMotorTorque(float32 torque);
|
||||
|
||||
/// Get the current motor torque, usually in N-m.
|
||||
float32 GetMotorTorque() const;
|
||||
|
||||
//--------------- Internals Below -------------------
|
||||
b2RevoluteJoint(const b2RevoluteJointDef* def);
|
||||
|
||||
void InitVelocityConstraints(const b2TimeStep& step);
|
||||
void SolveVelocityConstraints(const b2TimeStep& step);
|
||||
|
||||
bool SolvePositionConstraints();
|
||||
|
||||
b2Vec2 m_localAnchor1; // relative
|
||||
b2Vec2 m_localAnchor2;
|
||||
b2Vec2 m_pivotForce;
|
||||
float32 m_motorForce;
|
||||
float32 m_limitForce;
|
||||
float32 m_limitPositionImpulse;
|
||||
|
||||
b2Mat22 m_pivotMass; // effective mass for point-to-point constraint.
|
||||
float32 m_motorMass; // effective mass for motor/limit angular constraint.
|
||||
|
||||
bool m_enableMotor;
|
||||
float32 m_maxMotorTorque;
|
||||
float32 m_motorSpeed;
|
||||
|
||||
bool m_enableLimit;
|
||||
float32 m_referenceAngle;
|
||||
float32 m_lowerAngle;
|
||||
float32 m_upperAngle;
|
||||
b2LimitState m_limitState;
|
||||
};
|
||||
|
||||
inline float32 b2RevoluteJoint::GetMotorSpeed() const
|
||||
{
|
||||
return m_motorSpeed;
|
||||
}
|
||||
|
||||
#endif
|
587
build/linux/libs/box2d-svn/include/Source/Dynamics/b2Body.h
Normal file
587
build/linux/libs/box2d-svn/include/Source/Dynamics/b2Body.h
Normal file
@ -0,0 +1,587 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_BODY_H
|
||||
#define B2_BODY_H
|
||||
|
||||
#include "../Common/b2Math.h"
|
||||
#include "../Collision/Shapes/b2Shape.h"
|
||||
#include "Joints/b2Joint.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class b2Joint;
|
||||
class b2Contact;
|
||||
class b2World;
|
||||
struct b2JointEdge;
|
||||
struct b2ContactEdge;
|
||||
|
||||
/// A body definition holds all the data needed to construct a rigid body.
|
||||
/// You can safely re-use body definitions.
|
||||
struct b2BodyDef
|
||||
{
|
||||
/// This constructor sets the body definition default values.
|
||||
b2BodyDef()
|
||||
{
|
||||
massData.center.SetZero();
|
||||
massData.mass = 0.0f;
|
||||
massData.I = 0.0f;
|
||||
userData = NULL;
|
||||
position.Set(0.0f, 0.0f);
|
||||
angle = 0.0f;
|
||||
linearDamping = 0.0f;
|
||||
angularDamping = 0.0f;
|
||||
allowSleep = true;
|
||||
isSleeping = false;
|
||||
fixedRotation = false;
|
||||
isBullet = false;
|
||||
}
|
||||
|
||||
/// You can use this to initialized the mass properties of the body.
|
||||
/// If you prefer, you can set the mass properties after the shapes
|
||||
/// have been added using b2Body::SetMassFromShapes.
|
||||
b2MassData massData;
|
||||
|
||||
/// Use this to store application specific body data.
|
||||
void* userData;
|
||||
|
||||
/// The world position of the body. Avoid creating bodies at the origin
|
||||
/// since this can lead to many overlapping shapes.
|
||||
b2Vec2 position;
|
||||
|
||||
/// The world angle of the body in radians.
|
||||
float32 angle;
|
||||
|
||||
/// Linear damping is use to reduce the linear velocity. The damping parameter
|
||||
/// can be larger than 1.0f but the damping effect becomes sensitive to the
|
||||
/// time step when the damping parameter is large.
|
||||
float32 linearDamping;
|
||||
|
||||
/// Angular damping is use to reduce the angular velocity. The damping parameter
|
||||
/// can be larger than 1.0f but the damping effect becomes sensitive to the
|
||||
/// time step when the damping parameter is large.
|
||||
float32 angularDamping;
|
||||
|
||||
/// Set this flag to false if this body should never fall asleep. Note that
|
||||
/// this increases CPU usage.
|
||||
bool allowSleep;
|
||||
|
||||
/// Is this body initially sleeping?
|
||||
bool isSleeping;
|
||||
|
||||
/// Should this body be prevented from rotating? Useful for characters.
|
||||
bool fixedRotation;
|
||||
|
||||
/// Is this a fast moving body that should be prevented from tunneling through
|
||||
/// other moving bodies? Note that all bodies are prevented from tunneling through
|
||||
/// static bodies.
|
||||
/// @warning You should use this flag sparingly since it increases processing time.
|
||||
bool isBullet;
|
||||
};
|
||||
|
||||
/// A rigid body.
|
||||
class b2Body
|
||||
{
|
||||
public:
|
||||
/// Creates a shape and attach it to this body.
|
||||
/// @param shapeDef the shape definition.
|
||||
/// @warning This function is locked during callbacks.
|
||||
b2Shape* CreateShape(b2ShapeDef* shapeDef);
|
||||
|
||||
/// Destroy a shape. This removes the shape from the broad-phase and
|
||||
/// therefore destroys any contacts associated with this shape. All shapes
|
||||
/// attached to a body are implicitly destroyed when the body is destroyed.
|
||||
/// @param shape the shape to be removed.
|
||||
/// @warning This function is locked during callbacks.
|
||||
void DestroyShape(b2Shape* shape);
|
||||
|
||||
/// Set the mass properties. Note that this changes the center of mass position.
|
||||
/// If you are not sure how to compute mass properties, use SetMassFromShapes.
|
||||
/// The inertia tensor is assumed to be relative to the center of mass.
|
||||
/// @param massData the mass properties.
|
||||
void SetMass(const b2MassData* massData);
|
||||
|
||||
/// Compute the mass properties from the attached shapes. You typically call this
|
||||
/// after adding all the shapes. If you add or remove shapes later, you may want
|
||||
/// to call this again. Note that this changes the center of mass position.
|
||||
void SetMassFromShapes();
|
||||
|
||||
/// Set the position of the body's origin and rotation (radians).
|
||||
/// This breaks any contacts and wakes the other bodies.
|
||||
/// @param position the new world position of the body's origin (not necessarily
|
||||
/// the center of mass).
|
||||
/// @param angle the new world rotation angle of the body in radians.
|
||||
/// @return false if the movement put a shape outside the world. In this case the
|
||||
/// body is automatically frozen.
|
||||
bool SetXForm(const b2Vec2& position, float32 angle);
|
||||
|
||||
/// Get the body transform for the body's origin.
|
||||
/// @return the world transform of the body's origin.
|
||||
const b2XForm& GetXForm() const;
|
||||
|
||||
/// Get the world body origin position.
|
||||
/// @return the world position of the body's origin.
|
||||
const b2Vec2& GetPosition() const;
|
||||
|
||||
/// Get the angle in radians.
|
||||
/// @return the current world rotation angle in radians.
|
||||
float32 GetAngle() const;
|
||||
|
||||
/// Get the world position of the center of mass.
|
||||
const b2Vec2& GetWorldCenter() const;
|
||||
|
||||
/// Get the local position of the center of mass.
|
||||
const b2Vec2& GetLocalCenter() const;
|
||||
|
||||
/// Set the linear velocity of the center of mass.
|
||||
/// @param v the new linear velocity of the center of mass.
|
||||
void SetLinearVelocity(const b2Vec2& v);
|
||||
|
||||
/// Get the linear velocity of the center of mass.
|
||||
/// @return the linear velocity of the center of mass.
|
||||
b2Vec2 GetLinearVelocity() const;
|
||||
|
||||
/// Set the angular velocity.
|
||||
/// @param omega the new angular velocity in radians/second.
|
||||
void SetAngularVelocity(float32 omega);
|
||||
|
||||
/// Get the angular velocity.
|
||||
/// @return the angular velocity in radians/second.
|
||||
float32 GetAngularVelocity() const;
|
||||
|
||||
/// Apply a force at a world point. If the force is not
|
||||
/// applied at the center of mass, it will generate a torque and
|
||||
/// affect the angular velocity. This wakes up the body.
|
||||
/// @param force the world force vector, usually in Newtons (N).
|
||||
/// @param point the world position of the point of application.
|
||||
void ApplyForce(const b2Vec2& force, const b2Vec2& point);
|
||||
|
||||
/// Apply a torque. This affects the angular velocity
|
||||
/// without affecting the linear velocity of the center of mass.
|
||||
/// This wakes up the body.
|
||||
/// @param torque about the z-axis (out of the screen), usually in N-m.
|
||||
void ApplyTorque(float32 torque);
|
||||
|
||||
/// Apply an impulse at a point. This immediately modifies the velocity.
|
||||
/// It also modifies the angular velocity if the point of application
|
||||
/// is not at the center of mass. This wakes up the body.
|
||||
/// @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
|
||||
/// @param point the world position of the point of application.
|
||||
void ApplyImpulse(const b2Vec2& impulse, const b2Vec2& point);
|
||||
|
||||
/// Get the total mass of the body.
|
||||
/// @return the mass, usually in kilograms (kg).
|
||||
float32 GetMass() const;
|
||||
|
||||
/// Get the central rotational inertia of the body.
|
||||
/// @return the rotational inertia, usually in kg-m^2.
|
||||
float32 GetInertia() const;
|
||||
|
||||
/// Get the world coordinates of a point given the local coordinates.
|
||||
/// @param localPoint a point on the body measured relative the the body's origin.
|
||||
/// @return the same point expressed in world coordinates.
|
||||
b2Vec2 GetWorldPoint(const b2Vec2& localPoint) const;
|
||||
|
||||
/// Get the world coordinates of a vector given the local coordinates.
|
||||
/// @param localVector a vector fixed in the body.
|
||||
/// @return the same vector expressed in world coordinates.
|
||||
b2Vec2 GetWorldVector(const b2Vec2& localVector) const;
|
||||
|
||||
/// Gets a local point relative to the body's origin given a world point.
|
||||
/// @param a point in world coordinates.
|
||||
/// @return the corresponding local point relative to the body's origin.
|
||||
b2Vec2 GetLocalPoint(const b2Vec2& worldPoint) const;
|
||||
|
||||
/// Gets a local vector given a world vector.
|
||||
/// @param a vector in world coordinates.
|
||||
/// @return the corresponding local vector.
|
||||
b2Vec2 GetLocalVector(const b2Vec2& worldVector) const;
|
||||
|
||||
/// Get the world linear velocity of a world point attached to this body.
|
||||
/// @param a point in world coordinates.
|
||||
/// @return the world velocity of a point.
|
||||
b2Vec2 GetLinearVelocityFromWorldPoint(const b2Vec2& worldPoint) const;
|
||||
|
||||
/// Get the world velocity of a local point.
|
||||
/// @param a point in local coordinates.
|
||||
/// @return the world velocity of a point.
|
||||
b2Vec2 GetLinearVelocityFromLocalPoint(const b2Vec2& localPoint) const;
|
||||
|
||||
/// Is this body treated like a bullet for continuous collision detection?
|
||||
bool IsBullet() const;
|
||||
|
||||
/// Should this body be treated like a bullet for continuous collision detection?
|
||||
void SetBullet(bool flag);
|
||||
|
||||
/// Is this body static (immovable)?
|
||||
bool IsStatic() const;
|
||||
|
||||
/// Is this body dynamic (movable)?
|
||||
bool IsDynamic() const;
|
||||
|
||||
/// Is this body frozen?
|
||||
bool IsFrozen() const;
|
||||
|
||||
/// Is this body sleeping (not simulating).
|
||||
bool IsSleeping() const;
|
||||
|
||||
/// You can disable sleeping on this body.
|
||||
void AllowSleeping(bool flag);
|
||||
|
||||
/// Wake up this body so it will begin simulating.
|
||||
void WakeUp();
|
||||
|
||||
/// Put this body to sleep so it will stop simulating.
|
||||
/// This also sets the velocity to zero.
|
||||
void PutToSleep();
|
||||
|
||||
/// Get the list of all shapes attached to this body.
|
||||
b2Shape* GetShapeList();
|
||||
|
||||
/// Get the list of all joints attached to this body.
|
||||
b2JointEdge* GetJointList();
|
||||
|
||||
/// Get the next body in the world's body list.
|
||||
b2Body* GetNext();
|
||||
|
||||
/// Get the user data pointer that was provided in the body definition.
|
||||
void* GetUserData();
|
||||
|
||||
/// Set the user data. Use this to store your application specific data.
|
||||
void SetUserData(void* data);
|
||||
|
||||
/// Get the parent world of this body.
|
||||
b2World* GetWorld();
|
||||
|
||||
private:
|
||||
|
||||
friend class b2World;
|
||||
friend class b2Island;
|
||||
friend class b2ContactManager;
|
||||
friend class b2ContactSolver;
|
||||
|
||||
friend class b2DistanceJoint;
|
||||
friend class b2GearJoint;
|
||||
friend class b2MouseJoint;
|
||||
friend class b2PrismaticJoint;
|
||||
friend class b2PulleyJoint;
|
||||
friend class b2RevoluteJoint;
|
||||
|
||||
// m_flags
|
||||
enum
|
||||
{
|
||||
e_frozenFlag = 0x0002,
|
||||
e_islandFlag = 0x0004,
|
||||
e_sleepFlag = 0x0008,
|
||||
e_allowSleepFlag = 0x0010,
|
||||
e_bulletFlag = 0x0020,
|
||||
e_fixedRotationFlag = 0x0040,
|
||||
};
|
||||
|
||||
// m_type
|
||||
enum
|
||||
{
|
||||
e_staticType,
|
||||
e_dynamicType,
|
||||
e_maxTypes,
|
||||
};
|
||||
|
||||
b2Body(const b2BodyDef* bd, b2World* world);
|
||||
~b2Body();
|
||||
|
||||
bool SynchronizeShapes();
|
||||
|
||||
void SynchronizeTransform();
|
||||
|
||||
// This is used to prevent connected bodies from colliding.
|
||||
// It may lie, depending on the collideConnected flag.
|
||||
bool IsConnected(const b2Body* other) const;
|
||||
|
||||
void Advance(float32 t);
|
||||
|
||||
uint16 m_flags;
|
||||
int16 m_type;
|
||||
|
||||
b2XForm m_xf; // the body origin transform
|
||||
|
||||
b2Sweep m_sweep; // the swept motion for CCD
|
||||
|
||||
b2Vec2 m_linearVelocity;
|
||||
float32 m_angularVelocity;
|
||||
|
||||
b2Vec2 m_force;
|
||||
float32 m_torque;
|
||||
|
||||
b2World* m_world;
|
||||
b2Body* m_prev;
|
||||
b2Body* m_next;
|
||||
|
||||
b2Shape* m_shapeList;
|
||||
int32 m_shapeCount;
|
||||
|
||||
b2JointEdge* m_jointList;
|
||||
b2ContactEdge* m_contactList;
|
||||
|
||||
float32 m_mass, m_invMass;
|
||||
float32 m_I, m_invI;
|
||||
|
||||
float32 m_linearDamping;
|
||||
float32 m_angularDamping;
|
||||
|
||||
float32 m_sleepTime;
|
||||
|
||||
void* m_userData;
|
||||
};
|
||||
|
||||
inline const b2XForm& b2Body::GetXForm() const
|
||||
{
|
||||
return m_xf;
|
||||
}
|
||||
|
||||
inline const b2Vec2& b2Body::GetPosition() const
|
||||
{
|
||||
return m_xf.position;
|
||||
}
|
||||
|
||||
inline float32 b2Body::GetAngle() const
|
||||
{
|
||||
return m_sweep.a;
|
||||
}
|
||||
|
||||
inline const b2Vec2& b2Body::GetWorldCenter() const
|
||||
{
|
||||
return m_sweep.c;
|
||||
}
|
||||
|
||||
inline const b2Vec2& b2Body::GetLocalCenter() const
|
||||
{
|
||||
return m_sweep.localCenter;
|
||||
}
|
||||
|
||||
inline void b2Body::SetLinearVelocity(const b2Vec2& v)
|
||||
{
|
||||
m_linearVelocity = v;
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Body::GetLinearVelocity() const
|
||||
{
|
||||
return m_linearVelocity;
|
||||
}
|
||||
|
||||
inline void b2Body::SetAngularVelocity(float32 w)
|
||||
{
|
||||
m_angularVelocity = w;
|
||||
}
|
||||
|
||||
inline float32 b2Body::GetAngularVelocity() const
|
||||
{
|
||||
return m_angularVelocity;
|
||||
}
|
||||
|
||||
inline float32 b2Body::GetMass() const
|
||||
{
|
||||
return m_mass;
|
||||
}
|
||||
|
||||
inline float32 b2Body::GetInertia() const
|
||||
{
|
||||
return m_I;
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Body::GetWorldPoint(const b2Vec2& localPoint) const
|
||||
{
|
||||
return b2Mul(m_xf, localPoint);
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Body::GetWorldVector(const b2Vec2& localVector) const
|
||||
{
|
||||
return b2Mul(m_xf.R, localVector);
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Body::GetLocalPoint(const b2Vec2& worldPoint) const
|
||||
{
|
||||
return b2MulT(m_xf, worldPoint);
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Body::GetLocalVector(const b2Vec2& worldVector) const
|
||||
{
|
||||
return b2MulT(m_xf.R, worldVector);
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Body::GetLinearVelocityFromWorldPoint(const b2Vec2& worldPoint) const
|
||||
{
|
||||
return m_linearVelocity + b2Cross(m_angularVelocity, worldPoint - m_sweep.c);
|
||||
}
|
||||
|
||||
inline b2Vec2 b2Body::GetLinearVelocityFromLocalPoint(const b2Vec2& localPoint) const
|
||||
{
|
||||
return GetLinearVelocityFromWorldPoint(GetWorldPoint(localPoint));
|
||||
}
|
||||
|
||||
inline bool b2Body::IsBullet() const
|
||||
{
|
||||
return (m_flags & e_bulletFlag) == e_bulletFlag;
|
||||
}
|
||||
|
||||
inline void b2Body::SetBullet(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
m_flags |= e_bulletFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flags &= ~e_bulletFlag;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool b2Body::IsStatic() const
|
||||
{
|
||||
return m_type == e_staticType;
|
||||
}
|
||||
|
||||
inline bool b2Body::IsDynamic() const
|
||||
{
|
||||
return m_type == e_dynamicType;
|
||||
}
|
||||
|
||||
inline bool b2Body::IsFrozen() const
|
||||
{
|
||||
return (m_flags & e_frozenFlag) == e_frozenFlag;
|
||||
}
|
||||
|
||||
inline bool b2Body::IsSleeping() const
|
||||
{
|
||||
return (m_flags & e_sleepFlag) == e_sleepFlag;
|
||||
}
|
||||
|
||||
inline void b2Body::AllowSleeping(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
m_flags |= e_allowSleepFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flags &= ~e_allowSleepFlag;
|
||||
WakeUp();
|
||||
}
|
||||
}
|
||||
|
||||
inline void b2Body::WakeUp()
|
||||
{
|
||||
m_flags &= ~e_sleepFlag;
|
||||
m_sleepTime = 0.0f;
|
||||
}
|
||||
|
||||
inline void b2Body::PutToSleep()
|
||||
{
|
||||
m_flags |= e_sleepFlag;
|
||||
m_sleepTime = 0.0f;
|
||||
m_linearVelocity.SetZero();
|
||||
m_angularVelocity = 0.0f;
|
||||
m_force.SetZero();
|
||||
m_torque = 0.0f;
|
||||
}
|
||||
|
||||
inline b2Shape* b2Body::GetShapeList()
|
||||
{
|
||||
return m_shapeList;
|
||||
}
|
||||
|
||||
inline b2JointEdge* b2Body::GetJointList()
|
||||
{
|
||||
return m_jointList;
|
||||
}
|
||||
|
||||
inline b2Body* b2Body::GetNext()
|
||||
{
|
||||
return m_next;
|
||||
}
|
||||
|
||||
inline void* b2Body::GetUserData()
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
|
||||
inline void b2Body::SetUserData(void* data)
|
||||
{
|
||||
m_userData = data;
|
||||
}
|
||||
|
||||
inline bool b2Body::IsConnected(const b2Body* other) const
|
||||
{
|
||||
for (b2JointEdge* jn = m_jointList; jn; jn = jn->next)
|
||||
{
|
||||
if (jn->other == other)
|
||||
return jn->joint->m_collideConnected == false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void b2Body::ApplyForce(const b2Vec2& force, const b2Vec2& point)
|
||||
{
|
||||
if (IsSleeping())
|
||||
{
|
||||
WakeUp();
|
||||
}
|
||||
m_force += force;
|
||||
m_torque += b2Cross(point - m_sweep.c, force);
|
||||
}
|
||||
|
||||
inline void b2Body::ApplyTorque(float32 torque)
|
||||
{
|
||||
if (IsSleeping())
|
||||
{
|
||||
WakeUp();
|
||||
}
|
||||
m_torque += torque;
|
||||
}
|
||||
|
||||
inline void b2Body::ApplyImpulse(const b2Vec2& impulse, const b2Vec2& point)
|
||||
{
|
||||
if (IsSleeping())
|
||||
{
|
||||
WakeUp();
|
||||
}
|
||||
m_linearVelocity += m_invMass * impulse;
|
||||
m_angularVelocity += m_invI * b2Cross(point - m_sweep.c, impulse);
|
||||
}
|
||||
|
||||
inline void b2Body::SynchronizeTransform()
|
||||
{
|
||||
m_xf.R.Set(m_sweep.a);
|
||||
m_xf.position = m_sweep.c - b2Mul(m_xf.R, m_sweep.localCenter);
|
||||
}
|
||||
|
||||
inline void b2Body::Advance(float32 t)
|
||||
{
|
||||
// Advance to the new safe time.
|
||||
m_sweep.Advance(t);
|
||||
m_sweep.c = m_sweep.c0;
|
||||
m_sweep.a = m_sweep.a0;
|
||||
SynchronizeTransform();
|
||||
}
|
||||
|
||||
inline b2World* b2Body::GetWorld()
|
||||
{
|
||||
return m_world;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_CONTACT_MANAGER_H
|
||||
#define B2_CONTACT_MANAGER_H
|
||||
|
||||
#include "../Collision/b2BroadPhase.h"
|
||||
#include "../Dynamics/Contacts/b2NullContact.h"
|
||||
|
||||
class b2World;
|
||||
class b2Contact;
|
||||
struct b2TimeStep;
|
||||
|
||||
// Delegate of b2World.
|
||||
class b2ContactManager : public b2PairCallback
|
||||
{
|
||||
public:
|
||||
b2ContactManager() : m_world(NULL), m_destroyImmediate(false) {}
|
||||
|
||||
// Implements PairCallback
|
||||
void* PairAdded(void* proxyUserData1, void* proxyUserData2);
|
||||
|
||||
// Implements PairCallback
|
||||
void PairRemoved(void* proxyUserData1, void* proxyUserData2, void* pairUserData);
|
||||
|
||||
void Destroy(b2Contact* c);
|
||||
|
||||
void Collide();
|
||||
|
||||
b2World* m_world;
|
||||
|
||||
// This lets us provide broadphase proxy pair user data for
|
||||
// contacts that shouldn't exist.
|
||||
b2NullContact m_nullContact;
|
||||
|
||||
bool m_destroyImmediate;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_ISLAND_H
|
||||
#define B2_ISLAND_H
|
||||
|
||||
#include "../Common/b2Math.h"
|
||||
|
||||
class b2Contact;
|
||||
class b2Body;
|
||||
class b2Joint;
|
||||
class b2StackAllocator;
|
||||
class b2ContactListener;
|
||||
struct b2ContactConstraint;
|
||||
struct b2TimeStep;
|
||||
|
||||
class b2Island
|
||||
{
|
||||
public:
|
||||
b2Island(int32 bodyCapacity, int32 contactCapacity, int32 jointCapacity,
|
||||
b2StackAllocator* allocator, b2ContactListener* listener);
|
||||
~b2Island();
|
||||
|
||||
void Clear()
|
||||
{
|
||||
m_bodyCount = 0;
|
||||
m_contactCount = 0;
|
||||
m_jointCount = 0;
|
||||
}
|
||||
|
||||
void Solve(const b2TimeStep& step, const b2Vec2& gravity, bool correctPositions, bool allowSleep);
|
||||
|
||||
void SolveTOI(const b2TimeStep& subStep);
|
||||
|
||||
void Add(b2Body* body)
|
||||
{
|
||||
b2Assert(m_bodyCount < m_bodyCapacity);
|
||||
m_bodies[m_bodyCount++] = body;
|
||||
}
|
||||
|
||||
void Add(b2Contact* contact)
|
||||
{
|
||||
b2Assert(m_contactCount < m_contactCapacity);
|
||||
m_contacts[m_contactCount++] = contact;
|
||||
}
|
||||
|
||||
void Add(b2Joint* joint)
|
||||
{
|
||||
b2Assert(m_jointCount < m_jointCapacity);
|
||||
m_joints[m_jointCount++] = joint;
|
||||
}
|
||||
|
||||
void Report(b2ContactConstraint* constraints);
|
||||
|
||||
b2StackAllocator* m_allocator;
|
||||
b2ContactListener* m_listener;
|
||||
|
||||
b2Body** m_bodies;
|
||||
b2Contact** m_contacts;
|
||||
b2Joint** m_joints;
|
||||
|
||||
int32 m_bodyCount;
|
||||
int32 m_jointCount;
|
||||
int32 m_contactCount;
|
||||
|
||||
int32 m_bodyCapacity;
|
||||
int32 m_contactCapacity;
|
||||
int32 m_jointCapacity;
|
||||
|
||||
int32 m_positionIterationCount;
|
||||
};
|
||||
|
||||
#endif
|
256
build/linux/libs/box2d-svn/include/Source/Dynamics/b2World.h
Normal file
256
build/linux/libs/box2d-svn/include/Source/Dynamics/b2World.h
Normal file
@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_WORLD_H
|
||||
#define B2_WORLD_H
|
||||
|
||||
#include "../Common/b2Math.h"
|
||||
#include "../Common/b2BlockAllocator.h"
|
||||
#include "../Common/b2StackAllocator.h"
|
||||
#include "b2ContactManager.h"
|
||||
#include "b2WorldCallbacks.h"
|
||||
|
||||
struct b2AABB;
|
||||
struct b2ShapeDef;
|
||||
struct b2BodyDef;
|
||||
struct b2JointDef;
|
||||
class b2Body;
|
||||
class b2Joint;
|
||||
class b2Shape;
|
||||
class b2Contact;
|
||||
class b2BroadPhase;
|
||||
|
||||
struct b2TimeStep
|
||||
{
|
||||
float32 dt; // time step
|
||||
float32 inv_dt; // inverse time step (0 if dt == 0).
|
||||
float32 dtRatio; // dt * inv_dt0
|
||||
int32 maxIterations;
|
||||
bool warmStarting;
|
||||
bool positionCorrection;
|
||||
};
|
||||
|
||||
/// The world class manages all physics entities, dynamic simulation,
|
||||
/// and asynchronous queries. The world also contains efficient memory
|
||||
/// management facilities.
|
||||
class b2World
|
||||
{
|
||||
public:
|
||||
/// Construct a world object.
|
||||
/// @param worldAABB a bounding box that completely encompasses all your shapes.
|
||||
/// @param gravity the world gravity vector.
|
||||
/// @param doSleep improve performance by not simulating inactive bodies.
|
||||
b2World(const b2AABB& worldAABB, const b2Vec2& gravity, bool doSleep);
|
||||
|
||||
/// Destruct the world. All physics entities are destroyed and all heap memory is released.
|
||||
~b2World();
|
||||
|
||||
/// Register a destruction listener.
|
||||
void SetDestructionListener(b2DestructionListener* listener);
|
||||
|
||||
/// Register a broad-phase boundary listener.
|
||||
void SetBoundaryListener(b2BoundaryListener* listener);
|
||||
|
||||
/// Register a contact filter to provide specific control over collision.
|
||||
/// Otherwise the default filter is used (b2_defaultFilter).
|
||||
void SetContactFilter(b2ContactFilter* filter);
|
||||
|
||||
/// Register a contact event listener
|
||||
void SetContactListener(b2ContactListener* listener);
|
||||
|
||||
/// Register a routine for debug drawing. The debug draw functions are called
|
||||
/// inside the b2World::Step method, so make sure your renderer is ready to
|
||||
/// consume draw commands when you call Step().
|
||||
void SetDebugDraw(b2DebugDraw* debugDraw);
|
||||
|
||||
/// Create a rigid body given a definition. No reference to the definition
|
||||
/// is retained.
|
||||
/// @warning This function is locked during callbacks.
|
||||
b2Body* CreateBody(const b2BodyDef* def);
|
||||
|
||||
/// Destroy a rigid body given a definition. No reference to the definition
|
||||
/// is retained. This function is locked during callbacks.
|
||||
/// @warning This automatically deletes all associated shapes and joints.
|
||||
/// @warning This function is locked during callbacks.
|
||||
void DestroyBody(b2Body* body);
|
||||
|
||||
/// Create a joint to constrain bodies together. No reference to the definition
|
||||
/// is retained. This may cause the connected bodies to cease colliding.
|
||||
/// @warning This function is locked during callbacks.
|
||||
b2Joint* CreateJoint(const b2JointDef* def);
|
||||
|
||||
/// Destroy a joint. This may cause the connected bodies to begin colliding.
|
||||
/// @warning This function is locked during callbacks.
|
||||
void DestroyJoint(b2Joint* joint);
|
||||
|
||||
/// The world provides a single static ground body with no collision shapes.
|
||||
/// You can use this to simplify the creation of joints and static shapes.
|
||||
b2Body* GetGroundBody();
|
||||
|
||||
/// Take a time step. This performs collision detection, integration,
|
||||
/// and constraint solution.
|
||||
/// @param timeStep the amount of time to simulate, this should not vary.
|
||||
/// @param iterations the number of iterations to be used by the constraint solver.
|
||||
void Step(float32 timeStep, int32 iterations);
|
||||
|
||||
/// Query the world for all shapes that potentially overlap the
|
||||
/// provided AABB. You provide a shape pointer buffer of specified
|
||||
/// size. The number of shapes found is returned.
|
||||
/// @param aabb the query box.
|
||||
/// @param shapes a user allocated shape pointer array of size maxCount (or greater).
|
||||
/// @param maxCount the capacity of the shapes array.
|
||||
/// @return the number of shapes found in aabb.
|
||||
int32 Query(const b2AABB& aabb, b2Shape** shapes, int32 maxCount);
|
||||
|
||||
/// Check if the AABB is within the broadphase limits.
|
||||
bool InRange(const b2AABB& aabb) const;
|
||||
|
||||
/// Get the world body list. With the returned body, use b2Body::GetNext to get
|
||||
/// the next body in the world list. A NULL body indicates the end of the list.
|
||||
/// @return the head of the world body list.
|
||||
b2Body* GetBodyList();
|
||||
|
||||
/// Get the world joint list. With the returned joint, use b2Joint::GetNext to get
|
||||
/// the next joint in the world list. A NULL joint indicates the end of the list.
|
||||
/// @return the head of the world joint list.
|
||||
b2Joint* GetJointList();
|
||||
|
||||
/// Re-filter a shape. This re-runs contact filtering on a shape.
|
||||
void Refilter(b2Shape* shape);
|
||||
|
||||
/// Enable/disable warm starting. For testing.
|
||||
void SetWarmStarting(bool flag) { m_warmStarting = flag; }
|
||||
|
||||
/// Enable/disable position correction. For testing.
|
||||
void SetPositionCorrection(bool flag) { m_positionCorrection = flag; }
|
||||
|
||||
/// Enable/disable continuous physics. For testing.
|
||||
void SetContinuousPhysics(bool flag) { m_continuousPhysics = flag; }
|
||||
|
||||
/// Perform validation of internal data structures.
|
||||
void Validate();
|
||||
|
||||
/// Get the number of broad-phase proxies.
|
||||
int32 GetProxyCount() const;
|
||||
|
||||
/// Get the number of broad-phase pairs.
|
||||
int32 GetPairCount() const;
|
||||
|
||||
/// Get the number of bodies.
|
||||
int32 GetBodyCount() const;
|
||||
|
||||
/// Get the number joints.
|
||||
int32 GetJointCount() const;
|
||||
|
||||
/// Get the number of contacts (each may have 0 or more contact points).
|
||||
int32 GetContactCount() const;
|
||||
|
||||
/// Change the global gravity vector.
|
||||
void SetGravity(const b2Vec2& gravity);
|
||||
|
||||
private:
|
||||
|
||||
friend class b2Body;
|
||||
friend class b2ContactManager;
|
||||
|
||||
void Solve(const b2TimeStep& step);
|
||||
void SolveTOI(const b2TimeStep& step);
|
||||
|
||||
void DrawJoint(b2Joint* joint);
|
||||
void DrawShape(b2Shape* shape, const b2XForm& xf, const b2Color& color, bool core);
|
||||
void DrawDebugData();
|
||||
|
||||
b2BlockAllocator m_blockAllocator;
|
||||
b2StackAllocator m_stackAllocator;
|
||||
|
||||
bool m_lock;
|
||||
|
||||
b2BroadPhase* m_broadPhase;
|
||||
b2ContactManager m_contactManager;
|
||||
|
||||
b2Body* m_bodyList;
|
||||
b2Joint* m_jointList;
|
||||
|
||||
// Do not access
|
||||
b2Contact* m_contactList;
|
||||
|
||||
int32 m_bodyCount;
|
||||
int32 m_contactCount;
|
||||
int32 m_jointCount;
|
||||
|
||||
b2Vec2 m_gravity;
|
||||
bool m_allowSleep;
|
||||
|
||||
b2Body* m_groundBody;
|
||||
|
||||
b2DestructionListener* m_destructionListener;
|
||||
b2BoundaryListener* m_boundaryListener;
|
||||
b2ContactFilter* m_contactFilter;
|
||||
b2ContactListener* m_contactListener;
|
||||
b2DebugDraw* m_debugDraw;
|
||||
|
||||
float32 m_inv_dt0;
|
||||
|
||||
int32 m_positionIterationCount;
|
||||
|
||||
// This is for debugging the solver.
|
||||
bool m_positionCorrection;
|
||||
|
||||
// This is for debugging the solver.
|
||||
bool m_warmStarting;
|
||||
|
||||
// This is for debugging the solver.
|
||||
bool m_continuousPhysics;
|
||||
};
|
||||
|
||||
inline b2Body* b2World::GetGroundBody()
|
||||
{
|
||||
return m_groundBody;
|
||||
}
|
||||
|
||||
inline b2Body* b2World::GetBodyList()
|
||||
{
|
||||
return m_bodyList;
|
||||
}
|
||||
|
||||
inline b2Joint* b2World::GetJointList()
|
||||
{
|
||||
return m_jointList;
|
||||
}
|
||||
|
||||
inline int32 b2World::GetBodyCount() const
|
||||
{
|
||||
return m_bodyCount;
|
||||
}
|
||||
|
||||
inline int32 b2World::GetJointCount() const
|
||||
{
|
||||
return m_jointCount;
|
||||
}
|
||||
|
||||
inline int32 b2World::GetContactCount() const
|
||||
{
|
||||
return m_contactCount;
|
||||
}
|
||||
|
||||
inline void b2World::SetGravity(const b2Vec2& gravity)
|
||||
{
|
||||
m_gravity = gravity;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_WORLD_CALLBACKS_H
|
||||
#define B2_WORLD_CALLBACKS_H
|
||||
|
||||
#include "../Common/b2Settings.h"
|
||||
|
||||
struct b2Vec2;
|
||||
struct b2XForm;
|
||||
class b2Shape;
|
||||
class b2Body;
|
||||
class b2Joint;
|
||||
class b2Contact;
|
||||
struct b2ContactPoint;
|
||||
struct b2ContactResult;
|
||||
|
||||
/// Joints and shapes are destroyed when their associated
|
||||
/// body is destroyed. Implement this listener so that you
|
||||
/// may nullify references to these joints and shapes.
|
||||
class b2DestructionListener
|
||||
{
|
||||
public:
|
||||
virtual ~b2DestructionListener() {}
|
||||
|
||||
/// Called when any joint is about to be destroyed due
|
||||
/// to the destruction of one of its attached bodies.
|
||||
virtual void SayGoodbye(b2Joint* joint) = 0;
|
||||
|
||||
/// Called when any shape is about to be destroyed due
|
||||
/// to the destruction of its parent body.
|
||||
virtual void SayGoodbye(b2Shape* shape) = 0;
|
||||
};
|
||||
|
||||
|
||||
/// This is called when a body's shape passes outside of the world boundary.
|
||||
class b2BoundaryListener
|
||||
{
|
||||
public:
|
||||
virtual ~b2BoundaryListener() {}
|
||||
|
||||
/// This is called for each body that leaves the world boundary.
|
||||
/// @warning you can't modify the world inside this callback.
|
||||
virtual void Violation(b2Body* body) = 0;
|
||||
};
|
||||
|
||||
|
||||
/// Implement this class to provide collision filtering. In other words, you can implement
|
||||
/// this class if you want finer control over contact creation.
|
||||
class b2ContactFilter
|
||||
{
|
||||
public:
|
||||
virtual ~b2ContactFilter() {}
|
||||
|
||||
/// Return true if contact calculations should be performed between these two shapes.
|
||||
/// @warning for performance reasons this is only called when the AABBs begin to overlap.
|
||||
virtual bool ShouldCollide(b2Shape* shape1, b2Shape* shape2);
|
||||
};
|
||||
|
||||
/// The default contact filter.
|
||||
extern b2ContactFilter b2_defaultFilter;
|
||||
|
||||
/// Implement this class to get collision results. You can use these results for
|
||||
/// things like sounds and game logic. You can also get contact results by
|
||||
/// traversing the contact lists after the time step. However, you might miss
|
||||
/// some contacts because continuous physics leads to sub-stepping.
|
||||
/// Additionally you may receive multiple callbacks for the same contact in a
|
||||
/// single time step.
|
||||
/// You should strive to make your callbacks efficient because there may be
|
||||
/// many callbacks per time step.
|
||||
/// @warning The contact separation is the last computed value.
|
||||
/// @warning You cannot create/destroy Box2D entities inside these callbacks.
|
||||
class b2ContactListener
|
||||
{
|
||||
public:
|
||||
virtual ~b2ContactListener() {}
|
||||
|
||||
/// Called when a contact point is added. This includes the geometry
|
||||
/// and the forces.
|
||||
virtual void Add(const b2ContactPoint* point) { B2_NOT_USED(point); }
|
||||
|
||||
/// Called when a contact point persists. This includes the geometry
|
||||
/// and the forces.
|
||||
virtual void Persist(const b2ContactPoint* point) { B2_NOT_USED(point); }
|
||||
|
||||
/// Called when a contact point is removed. This includes the last
|
||||
/// computed geometry and forces.
|
||||
virtual void Remove(const b2ContactPoint* point) { B2_NOT_USED(point); }
|
||||
|
||||
/// Called after a contact point is solved.
|
||||
virtual void Result(const b2ContactResult* point) { B2_NOT_USED(point); }
|
||||
};
|
||||
|
||||
/// Color for debug drawing. Each value has the range [0,1].
|
||||
struct b2Color
|
||||
{
|
||||
b2Color() {}
|
||||
b2Color(float32 r, float32 g, float32 b) : r(r), g(g), b(b) {}
|
||||
float32 r, g, b;
|
||||
};
|
||||
|
||||
/// Implement and register this class with a b2World to provide debug drawing of physics
|
||||
/// entities in your game.
|
||||
class b2DebugDraw
|
||||
{
|
||||
public:
|
||||
b2DebugDraw();
|
||||
|
||||
virtual ~b2DebugDraw() {}
|
||||
|
||||
enum
|
||||
{
|
||||
e_shapeBit = 0x0001, ///< draw shapes
|
||||
e_jointBit = 0x0002, ///< draw joint connections
|
||||
e_coreShapeBit = 0x0004, ///< draw core (TOI) shapes
|
||||
e_aabbBit = 0x0008, ///< draw axis aligned bounding boxes
|
||||
e_obbBit = 0x0010, ///< draw oriented bounding boxes
|
||||
e_pairBit = 0x0020, ///< draw broad-phase pairs
|
||||
e_centerOfMassBit = 0x0040, ///< draw center of mass frame
|
||||
};
|
||||
|
||||
/// Set the drawing flags.
|
||||
void SetFlags(uint32 flags);
|
||||
|
||||
/// Get the drawing flags.
|
||||
uint32 GetFlags() const;
|
||||
|
||||
/// Append flags to the current flags.
|
||||
void AppendFlags(uint32 flags);
|
||||
|
||||
/// Clear flags from the current flags.
|
||||
void ClearFlags(uint32 flags);
|
||||
|
||||
/// Draw a closed polygon provided in CCW order.
|
||||
virtual void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0;
|
||||
|
||||
/// Draw a solid closed polygon provided in CCW order.
|
||||
virtual void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0;
|
||||
|
||||
/// Draw a circle.
|
||||
virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) = 0;
|
||||
|
||||
/// Draw a solid circle.
|
||||
virtual void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) = 0;
|
||||
|
||||
/// Draw a line segment.
|
||||
virtual void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) = 0;
|
||||
|
||||
/// Draw a transform. Choose your own length scale.
|
||||
/// @param xf a transform.
|
||||
virtual void DrawXForm(const b2XForm& xf) = 0;
|
||||
|
||||
protected:
|
||||
uint32 m_drawFlags;
|
||||
};
|
||||
|
||||
#endif
|
11
build/linux/libs/ogg-1.1.3/include/ogg/config_types.h
Normal file
11
build/linux/libs/ogg-1.1.3/include/ogg/config_types.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef __CONFIG_TYPES_H__
|
||||
#define __CONFIG_TYPES_H__
|
||||
|
||||
/* these are filled in by configure */
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef u_int16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef u_int32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
|
||||
#endif
|
202
build/linux/libs/ogg-1.1.3/include/ogg/ogg.h
Normal file
202
build/linux/libs/ogg-1.1.3/include/ogg/ogg.h
Normal file
@ -0,0 +1,202 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: toplevel libogg include
|
||||
last mod: $Id: ogg.h 7188 2004-07-20 07:26:04Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OGG_H
|
||||
#define _OGG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ogg/os_types.h>
|
||||
|
||||
typedef struct {
|
||||
long endbyte;
|
||||
int endbit;
|
||||
|
||||
unsigned char *buffer;
|
||||
unsigned char *ptr;
|
||||
long storage;
|
||||
} oggpack_buffer;
|
||||
|
||||
/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *header;
|
||||
long header_len;
|
||||
unsigned char *body;
|
||||
long body_len;
|
||||
} ogg_page;
|
||||
|
||||
/* ogg_stream_state contains the current encode/decode state of a logical
|
||||
Ogg bitstream **********************************************************/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *body_data; /* bytes from packet bodies */
|
||||
long body_storage; /* storage elements allocated */
|
||||
long body_fill; /* elements stored; fill mark */
|
||||
long body_returned; /* elements of fill returned */
|
||||
|
||||
|
||||
int *lacing_vals; /* The values that will go to the segment table */
|
||||
ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
|
||||
this way, but it is simple coupled to the
|
||||
lacing fifo */
|
||||
long lacing_storage;
|
||||
long lacing_fill;
|
||||
long lacing_packet;
|
||||
long lacing_returned;
|
||||
|
||||
unsigned char header[282]; /* working space for header encode */
|
||||
int header_fill;
|
||||
|
||||
int e_o_s; /* set when we have buffered the last packet in the
|
||||
logical bitstream */
|
||||
int b_o_s; /* set after we've written the initial page
|
||||
of a logical bitstream */
|
||||
long serialno;
|
||||
long pageno;
|
||||
ogg_int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a seperate abstraction
|
||||
layer) also knows about the gap */
|
||||
ogg_int64_t granulepos;
|
||||
|
||||
} ogg_stream_state;
|
||||
|
||||
/* ogg_packet is used to encapsulate the data and metadata belonging
|
||||
to a single raw Ogg/Vorbis packet *************************************/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *packet;
|
||||
long bytes;
|
||||
long b_o_s;
|
||||
long e_o_s;
|
||||
|
||||
ogg_int64_t granulepos;
|
||||
|
||||
ogg_int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a seperate abstraction
|
||||
layer) also knows about the gap */
|
||||
} ogg_packet;
|
||||
|
||||
typedef struct {
|
||||
unsigned char *data;
|
||||
int storage;
|
||||
int fill;
|
||||
int returned;
|
||||
|
||||
int unsynced;
|
||||
int headerbytes;
|
||||
int bodybytes;
|
||||
} ogg_sync_state;
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
|
||||
|
||||
extern void oggpack_writeinit(oggpack_buffer *b);
|
||||
extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
|
||||
extern void oggpack_writealign(oggpack_buffer *b);
|
||||
extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
|
||||
extern void oggpack_reset(oggpack_buffer *b);
|
||||
extern void oggpack_writeclear(oggpack_buffer *b);
|
||||
extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
|
||||
extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
|
||||
extern long oggpack_look(oggpack_buffer *b,int bits);
|
||||
extern long oggpack_look1(oggpack_buffer *b);
|
||||
extern void oggpack_adv(oggpack_buffer *b,int bits);
|
||||
extern void oggpack_adv1(oggpack_buffer *b);
|
||||
extern long oggpack_read(oggpack_buffer *b,int bits);
|
||||
extern long oggpack_read1(oggpack_buffer *b);
|
||||
extern long oggpack_bytes(oggpack_buffer *b);
|
||||
extern long oggpack_bits(oggpack_buffer *b);
|
||||
extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
|
||||
|
||||
extern void oggpackB_writeinit(oggpack_buffer *b);
|
||||
extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
|
||||
extern void oggpackB_writealign(oggpack_buffer *b);
|
||||
extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
|
||||
extern void oggpackB_reset(oggpack_buffer *b);
|
||||
extern void oggpackB_writeclear(oggpack_buffer *b);
|
||||
extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
|
||||
extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
|
||||
extern long oggpackB_look(oggpack_buffer *b,int bits);
|
||||
extern long oggpackB_look1(oggpack_buffer *b);
|
||||
extern void oggpackB_adv(oggpack_buffer *b,int bits);
|
||||
extern void oggpackB_adv1(oggpack_buffer *b);
|
||||
extern long oggpackB_read(oggpack_buffer *b,int bits);
|
||||
extern long oggpackB_read1(oggpack_buffer *b);
|
||||
extern long oggpackB_bytes(oggpack_buffer *b);
|
||||
extern long oggpackB_bits(oggpack_buffer *b);
|
||||
extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: encoding **************************/
|
||||
|
||||
extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
|
||||
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
|
||||
extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
|
||||
|
||||
extern int ogg_sync_init(ogg_sync_state *oy);
|
||||
extern int ogg_sync_clear(ogg_sync_state *oy);
|
||||
extern int ogg_sync_reset(ogg_sync_state *oy);
|
||||
extern int ogg_sync_destroy(ogg_sync_state *oy);
|
||||
|
||||
extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
|
||||
extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
|
||||
extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
|
||||
extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
|
||||
extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
|
||||
extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
|
||||
extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: general ***************************/
|
||||
|
||||
extern int ogg_stream_init(ogg_stream_state *os,int serialno);
|
||||
extern int ogg_stream_clear(ogg_stream_state *os);
|
||||
extern int ogg_stream_reset(ogg_stream_state *os);
|
||||
extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
|
||||
extern int ogg_stream_destroy(ogg_stream_state *os);
|
||||
extern int ogg_stream_eos(ogg_stream_state *os);
|
||||
|
||||
extern void ogg_page_checksum_set(ogg_page *og);
|
||||
|
||||
extern int ogg_page_version(ogg_page *og);
|
||||
extern int ogg_page_continued(ogg_page *og);
|
||||
extern int ogg_page_bos(ogg_page *og);
|
||||
extern int ogg_page_eos(ogg_page *og);
|
||||
extern ogg_int64_t ogg_page_granulepos(ogg_page *og);
|
||||
extern int ogg_page_serialno(ogg_page *og);
|
||||
extern long ogg_page_pageno(ogg_page *og);
|
||||
extern int ogg_page_packets(ogg_page *og);
|
||||
|
||||
extern void ogg_packet_clear(ogg_packet *op);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OGG_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
127
build/linux/libs/ogg-1.1.3/include/ogg/os_types.h
Normal file
127
build/linux/libs/ogg-1.1.3/include/ogg/os_types.h
Normal file
@ -0,0 +1,127 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OS_TYPES_H
|
||||
#define _OS_TYPES_H
|
||||
|
||||
/* make it easy on the folks that want to compile the libs with a
|
||||
different malloc than stdlib */
|
||||
#define _ogg_malloc malloc
|
||||
#define _ogg_calloc calloc
|
||||
#define _ogg_realloc realloc
|
||||
#define _ogg_free free
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
# if defined(__CYGWIN__)
|
||||
# include <_G_config.h>
|
||||
typedef _G_int64_t ogg_int64_t;
|
||||
typedef _G_int32_t ogg_int32_t;
|
||||
typedef _G_uint32_t ogg_uint32_t;
|
||||
typedef _G_int16_t ogg_int16_t;
|
||||
typedef _G_uint16_t ogg_uint16_t;
|
||||
# elif defined(__MINGW32__)
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
typedef unsigned long long ogg_uint64_t;
|
||||
# elif defined(__MWERKS__)
|
||||
typedef long long ogg_int64_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
# else
|
||||
/* MSVC/Borland */
|
||||
typedef __int64 ogg_int64_t;
|
||||
typedef __int32 ogg_int32_t;
|
||||
typedef unsigned __int32 ogg_uint32_t;
|
||||
typedef __int16 ogg_int16_t;
|
||||
typedef unsigned __int16 ogg_uint16_t;
|
||||
# endif
|
||||
|
||||
#elif defined(__MACOS__)
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef SInt16 ogg_int16_t;
|
||||
typedef UInt16 ogg_uint16_t;
|
||||
typedef SInt32 ogg_int32_t;
|
||||
typedef UInt32 ogg_uint32_t;
|
||||
typedef SInt64 ogg_int64_t;
|
||||
|
||||
#elif defined(__MACOSX__) /* MacOS X Framework build */
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef u_int16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef u_int32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
|
||||
#elif defined(__BEOS__)
|
||||
|
||||
/* Be */
|
||||
# include <inttypes.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef u_int16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef u_int32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
|
||||
#elif defined (__EMX__)
|
||||
|
||||
/* OS/2 GCC */
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
|
||||
#elif defined (DJGPP)
|
||||
|
||||
/* DJGPP */
|
||||
typedef short ogg_int16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
|
||||
#elif defined(R5900)
|
||||
|
||||
/* PS2 EE */
|
||||
typedef long ogg_int64_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned ogg_uint32_t;
|
||||
typedef short ogg_int16_t;
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
|
||||
/* Symbian GCC */
|
||||
typedef signed short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef signed int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long int ogg_int64_t;
|
||||
|
||||
#else
|
||||
|
||||
# include <sys/types.h>
|
||||
# include <ogg/config_types.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _OS_TYPES_H */
|
94
build/linux/libs/sdl-1.2.13/include/SDL.h
Normal file
94
build/linux/libs/sdl-1.2.13/include/SDL.h
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Main include header for the SDL library */
|
||||
|
||||
#ifndef _SDL_H
|
||||
#define _SDL_H
|
||||
|
||||
#include "SDL_main.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_cdrom.h"
|
||||
#include "SDL_cpuinfo.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_rwops.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
||||
|
||||
/* These are the flags which may be passed to SDL_Init() -- you should
|
||||
specify the subsystems which you will be using in your application.
|
||||
*/
|
||||
#define SDL_INIT_TIMER 0x00000001
|
||||
#define SDL_INIT_AUDIO 0x00000010
|
||||
#define SDL_INIT_VIDEO 0x00000020
|
||||
#define SDL_INIT_CDROM 0x00000100
|
||||
#define SDL_INIT_JOYSTICK 0x00000200
|
||||
#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
|
||||
#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
|
||||
#define SDL_INIT_EVERYTHING 0x0000FFFF
|
||||
|
||||
/* This function loads the SDL dynamically linked library and initializes
|
||||
* the subsystems specified by 'flags' (and those satisfying dependencies)
|
||||
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
|
||||
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
||||
|
||||
/* This function initializes specific SDL subsystems */
|
||||
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
||||
|
||||
/* This function cleans up specific SDL subsystems */
|
||||
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
||||
|
||||
/* This function returns mask of the specified subsystems which have
|
||||
been initialized.
|
||||
If 'flags' is 0, it returns a mask of all initialized subsystems.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
||||
|
||||
/* This function cleans up all initialized subsystems and unloads the
|
||||
* dynamically linked library. You should call it upon all exit conditions.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_H */
|
58
build/linux/libs/sdl-1.2.13/include/SDL_active.h
Normal file
58
build/linux/libs/sdl-1.2.13/include/SDL_active.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL application focus event handling */
|
||||
|
||||
#ifndef _SDL_active_h
|
||||
#define _SDL_active_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The available application states */
|
||||
#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */
|
||||
#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */
|
||||
#define SDL_APPACTIVE 0x04 /* The application is active */
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* This function returns the current state of the application, which is a
|
||||
* bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
|
||||
* SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
|
||||
* see your application, otherwise it has been iconified or disabled.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_active_h */
|
253
build/linux/libs/sdl-1.2.13/include/SDL_audio.h
Normal file
253
build/linux/libs/sdl-1.2.13/include/SDL_audio.h
Normal file
@ -0,0 +1,253 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Access to the raw audio mixing buffer for the SDL library */
|
||||
|
||||
#ifndef _SDL_audio_h
|
||||
#define _SDL_audio_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_rwops.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The calculated values in this structure are calculated by SDL_OpenAudio() */
|
||||
typedef struct SDL_AudioSpec {
|
||||
int freq; /* DSP frequency -- samples per second */
|
||||
Uint16 format; /* Audio data format */
|
||||
Uint8 channels; /* Number of channels: 1 mono, 2 stereo */
|
||||
Uint8 silence; /* Audio buffer silence value (calculated) */
|
||||
Uint16 samples; /* Audio buffer size in samples (power of 2) */
|
||||
Uint16 padding; /* Necessary for some compile environments */
|
||||
Uint32 size; /* Audio buffer size in bytes (calculated) */
|
||||
/* This function is called when the audio device needs more data.
|
||||
'stream' is a pointer to the audio data buffer
|
||||
'len' is the length of that buffer in bytes.
|
||||
Once the callback returns, the buffer will no longer be valid.
|
||||
Stereo samples are stored in a LRLRLR ordering.
|
||||
*/
|
||||
void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
|
||||
void *userdata;
|
||||
} SDL_AudioSpec;
|
||||
|
||||
/* Audio format flags (defaults to LSB byte order) */
|
||||
#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */
|
||||
#define AUDIO_S8 0x8008 /* Signed 8-bit samples */
|
||||
#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */
|
||||
#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */
|
||||
#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */
|
||||
#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */
|
||||
#define AUDIO_U16 AUDIO_U16LSB
|
||||
#define AUDIO_S16 AUDIO_S16LSB
|
||||
|
||||
/* Native audio byte ordering */
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define AUDIO_U16SYS AUDIO_U16LSB
|
||||
#define AUDIO_S16SYS AUDIO_S16LSB
|
||||
#else
|
||||
#define AUDIO_U16SYS AUDIO_U16MSB
|
||||
#define AUDIO_S16SYS AUDIO_S16MSB
|
||||
#endif
|
||||
|
||||
|
||||
/* A structure to hold a set of audio conversion filters and buffers */
|
||||
typedef struct SDL_AudioCVT {
|
||||
int needed; /* Set to 1 if conversion possible */
|
||||
Uint16 src_format; /* Source audio format */
|
||||
Uint16 dst_format; /* Target audio format */
|
||||
double rate_incr; /* Rate conversion increment */
|
||||
Uint8 *buf; /* Buffer to hold entire audio data */
|
||||
int len; /* Length of original audio buffer */
|
||||
int len_cvt; /* Length of converted audio buffer */
|
||||
int len_mult; /* buffer must be len*len_mult big */
|
||||
double len_ratio; /* Given len, final size is len*len_ratio */
|
||||
void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
|
||||
int filter_index; /* Current audio conversion function */
|
||||
} SDL_AudioCVT;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* These functions are used internally, and should not be used unless you
|
||||
* have a specific need to specify the audio driver you want to use.
|
||||
* You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
||||
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
||||
|
||||
/* This function fills the given character buffer with the name of the
|
||||
* current audio driver, and returns a pointer to it if the audio driver has
|
||||
* been initialized. It returns NULL if no driver has been initialized.
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
|
||||
|
||||
/*
|
||||
* This function opens the audio device with the desired parameters, and
|
||||
* returns 0 if successful, placing the actual hardware parameters in the
|
||||
* structure pointed to by 'obtained'. If 'obtained' is NULL, the audio
|
||||
* data passed to the callback function will be guaranteed to be in the
|
||||
* requested format, and will be automatically converted to the hardware
|
||||
* audio format if necessary. This function returns -1 if it failed
|
||||
* to open the audio device, or couldn't set up the audio thread.
|
||||
*
|
||||
* When filling in the desired audio spec structure,
|
||||
* 'desired->freq' should be the desired audio frequency in samples-per-second.
|
||||
* 'desired->format' should be the desired audio format.
|
||||
* 'desired->samples' is the desired size of the audio buffer, in samples.
|
||||
* This number should be a power of two, and may be adjusted by the audio
|
||||
* driver to a value more suitable for the hardware. Good values seem to
|
||||
* range between 512 and 8096 inclusive, depending on the application and
|
||||
* CPU speed. Smaller values yield faster response time, but can lead
|
||||
* to underflow if the application is doing heavy processing and cannot
|
||||
* fill the audio buffer in time. A stereo sample consists of both right
|
||||
* and left channels in LR ordering.
|
||||
* Note that the number of samples is directly related to time by the
|
||||
* following formula: ms = (samples*1000)/freq
|
||||
* 'desired->size' is the size in bytes of the audio buffer, and is
|
||||
* calculated by SDL_OpenAudio().
|
||||
* 'desired->silence' is the value used to set the buffer to silence,
|
||||
* and is calculated by SDL_OpenAudio().
|
||||
* 'desired->callback' should be set to a function that will be called
|
||||
* when the audio device is ready for more data. It is passed a pointer
|
||||
* to the audio buffer, and the length in bytes of the audio buffer.
|
||||
* This function usually runs in a separate thread, and so you should
|
||||
* protect data structures that it accesses by calling SDL_LockAudio()
|
||||
* and SDL_UnlockAudio() in your code.
|
||||
* 'desired->userdata' is passed as the first parameter to your callback
|
||||
* function.
|
||||
*
|
||||
* The audio device starts out playing silence when it's opened, and should
|
||||
* be enabled for playing by calling SDL_PauseAudio(0) when you are ready
|
||||
* for your audio callback function to be called. Since the audio driver
|
||||
* may modify the requested size of the audio buffer, you should allocate
|
||||
* any local mixing buffers after you open the audio device.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
|
||||
|
||||
/*
|
||||
* Get the current audio state:
|
||||
*/
|
||||
typedef enum {
|
||||
SDL_AUDIO_STOPPED = 0,
|
||||
SDL_AUDIO_PLAYING,
|
||||
SDL_AUDIO_PAUSED
|
||||
} SDL_audiostatus;
|
||||
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
|
||||
|
||||
/*
|
||||
* This function pauses and unpauses the audio callback processing.
|
||||
* It should be called with a parameter of 0 after opening the audio
|
||||
* device to start playing sound. This is so you can safely initialize
|
||||
* data for your callback function after opening the audio device.
|
||||
* Silence will be written to the audio device during the pause.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
||||
|
||||
/*
|
||||
* This function loads a WAVE from the data source, automatically freeing
|
||||
* that source if 'freesrc' is non-zero. For example, to load a WAVE file,
|
||||
* you could do:
|
||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
||||
*
|
||||
* If this function succeeds, it returns the given SDL_AudioSpec,
|
||||
* filled with the audio data format of the wave data, and sets
|
||||
* 'audio_buf' to a malloc()'d buffer containing the audio data,
|
||||
* and sets 'audio_len' to the length of that audio buffer, in bytes.
|
||||
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
||||
* done with it.
|
||||
*
|
||||
* This function returns NULL and sets the SDL error message if the
|
||||
* wave file cannot be opened, uses an unknown data format, or is
|
||||
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
|
||||
*/
|
||||
extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
|
||||
|
||||
/* Compatibility convenience function -- loads a WAV from a file */
|
||||
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
|
||||
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
||||
|
||||
/*
|
||||
* This function frees data previously allocated with SDL_LoadWAV_RW()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
|
||||
|
||||
/*
|
||||
* This function takes a source format and rate and a destination format
|
||||
* and rate, and initializes the 'cvt' structure with information needed
|
||||
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
|
||||
* to the other.
|
||||
* This function returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
|
||||
Uint16 src_format, Uint8 src_channels, int src_rate,
|
||||
Uint16 dst_format, Uint8 dst_channels, int dst_rate);
|
||||
|
||||
/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
|
||||
* created an audio buffer cvt->buf, and filled it with cvt->len bytes of
|
||||
* audio data in the source format, this function will convert it in-place
|
||||
* to the desired format.
|
||||
* The data conversion may expand the size of the audio data, so the buffer
|
||||
* cvt->buf should be allocated after the cvt structure is initialized by
|
||||
* SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
|
||||
|
||||
/*
|
||||
* This takes two audio buffers of the playing audio format and mixes
|
||||
* them, performing addition, volume adjustment, and overflow clipping.
|
||||
* The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
||||
* for full audio volume. Note this does not change hardware volume.
|
||||
* This is provided for convenience -- you can mix your own audio data.
|
||||
*/
|
||||
#define SDL_MIX_MAXVOLUME 128
|
||||
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
|
||||
|
||||
/*
|
||||
* The lock manipulated by these functions protects the callback function.
|
||||
* During a LockAudio/UnlockAudio pair, you can be guaranteed that the
|
||||
* callback function is not running. Do not call these from the callback
|
||||
* function or you will cause deadlock.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
||||
|
||||
/*
|
||||
* This function shuts down audio processing and closes the audio device.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_audio_h */
|
24
build/linux/libs/sdl-1.2.13/include/SDL_byteorder.h
Normal file
24
build/linux/libs/sdl-1.2.13/include/SDL_byteorder.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* DEPRECATED */
|
||||
#include "SDL_endian.h"
|
171
build/linux/libs/sdl-1.2.13/include/SDL_cdrom.h
Normal file
171
build/linux/libs/sdl-1.2.13/include/SDL_cdrom.h
Normal file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This is the CD-audio control API for Simple DirectMedia Layer */
|
||||
|
||||
#ifndef _SDL_cdrom_h
|
||||
#define _SDL_cdrom_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* In order to use these functions, SDL_Init() must have been called
|
||||
with the SDL_INIT_CDROM flag. This causes SDL to scan the system
|
||||
for CD-ROM drives, and load appropriate drivers.
|
||||
*/
|
||||
|
||||
/* The maximum number of CD-ROM tracks on a disk */
|
||||
#define SDL_MAX_TRACKS 99
|
||||
|
||||
/* The types of CD-ROM track possible */
|
||||
#define SDL_AUDIO_TRACK 0x00
|
||||
#define SDL_DATA_TRACK 0x04
|
||||
|
||||
/* The possible states which a CD-ROM drive can be in. */
|
||||
typedef enum {
|
||||
CD_TRAYEMPTY,
|
||||
CD_STOPPED,
|
||||
CD_PLAYING,
|
||||
CD_PAUSED,
|
||||
CD_ERROR = -1
|
||||
} CDstatus;
|
||||
|
||||
/* Given a status, returns true if there's a disk in the drive */
|
||||
#define CD_INDRIVE(status) ((int)(status) > 0)
|
||||
|
||||
typedef struct SDL_CDtrack {
|
||||
Uint8 id; /* Track number */
|
||||
Uint8 type; /* Data or audio track */
|
||||
Uint16 unused;
|
||||
Uint32 length; /* Length, in frames, of this track */
|
||||
Uint32 offset; /* Offset, in frames, from start of disk */
|
||||
} SDL_CDtrack;
|
||||
|
||||
/* This structure is only current as of the last call to SDL_CDStatus() */
|
||||
typedef struct SDL_CD {
|
||||
int id; /* Private drive identifier */
|
||||
CDstatus status; /* Current drive status */
|
||||
|
||||
/* The rest of this structure is only valid if there's a CD in drive */
|
||||
int numtracks; /* Number of tracks on disk */
|
||||
int cur_track; /* Current track position */
|
||||
int cur_frame; /* Current frame offset within current track */
|
||||
SDL_CDtrack track[SDL_MAX_TRACKS+1];
|
||||
} SDL_CD;
|
||||
|
||||
/* Conversion functions from frames to Minute/Second/Frames and vice versa */
|
||||
#define CD_FPS 75
|
||||
#define FRAMES_TO_MSF(f, M,S,F) { \
|
||||
int value = f; \
|
||||
*(F) = value%CD_FPS; \
|
||||
value /= CD_FPS; \
|
||||
*(S) = value%60; \
|
||||
value /= 60; \
|
||||
*(M) = value; \
|
||||
}
|
||||
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
|
||||
|
||||
/* CD-audio API functions: */
|
||||
|
||||
/* Returns the number of CD-ROM drives on the system, or -1 if
|
||||
SDL_Init() has not been called with the SDL_INIT_CDROM flag.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
|
||||
|
||||
/* Returns a human-readable, system-dependent identifier for the CD-ROM.
|
||||
Example:
|
||||
"/dev/cdrom"
|
||||
"E:"
|
||||
"/dev/disk/ide/1/master"
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
|
||||
|
||||
/* Opens a CD-ROM drive for access. It returns a drive handle on success,
|
||||
or NULL if the drive was invalid or busy. This newly opened CD-ROM
|
||||
becomes the default CD used when other CD functions are passed a NULL
|
||||
CD-ROM handle.
|
||||
Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
|
||||
*/
|
||||
extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
|
||||
|
||||
/* This function returns the current status of the given drive.
|
||||
If the drive has a CD in it, the table of contents of the CD and current
|
||||
play position of the CD will be stored in the SDL_CD structure.
|
||||
*/
|
||||
extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
|
||||
|
||||
/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
|
||||
tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
|
||||
until the end of the CD. This function will skip data tracks.
|
||||
This function should only be called after calling SDL_CDStatus() to
|
||||
get track information about the CD.
|
||||
For example:
|
||||
// Play entire CD:
|
||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
||||
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
|
||||
// Play last track:
|
||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
|
||||
SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
|
||||
}
|
||||
// Play first and second track and 10 seconds of third track:
|
||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
||||
SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
|
||||
|
||||
This function returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
|
||||
int start_track, int start_frame, int ntracks, int nframes);
|
||||
|
||||
/* Play the given CD starting at 'start' frame for 'length' frames.
|
||||
It returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
|
||||
|
||||
/* Pause play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
|
||||
|
||||
/* Resume play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
|
||||
|
||||
/* Stop play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
|
||||
|
||||
/* Eject CD-ROM -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
|
||||
|
||||
/* Closes the handle for the CD-ROM drive */
|
||||
extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_video_h */
|
307
build/linux/libs/sdl-1.2.13/include/SDL_config.h
Normal file
307
build/linux/libs/sdl-1.2.13/include/SDL_config.h
Normal file
@ -0,0 +1,307 @@
|
||||
/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_config_h
|
||||
#define _SDL_config_h
|
||||
|
||||
/* This is a set of defines to configure the SDL features */
|
||||
|
||||
/* General platform specific identifiers */
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* Make sure that this isn't included by Visual C++ */
|
||||
#ifdef _MSC_VER
|
||||
#error You should copy include/SDL_config.h.default to include/SDL_config.h
|
||||
#endif
|
||||
|
||||
/* C language features */
|
||||
/* #undef const */
|
||||
/* #undef inline */
|
||||
/* #undef volatile */
|
||||
|
||||
/* C datatypes */
|
||||
/* #undef size_t */
|
||||
/* #undef int8_t */
|
||||
/* #undef uint8_t */
|
||||
/* #undef int16_t */
|
||||
/* #undef uint16_t */
|
||||
/* #undef int32_t */
|
||||
/* #undef uint32_t */
|
||||
/* #undef int64_t */
|
||||
/* #undef uint64_t */
|
||||
/* #undef uintptr_t */
|
||||
#define SDL_HAS_64BIT_TYPE 1
|
||||
|
||||
/* Endianness */
|
||||
#define SDL_BYTEORDER 1234
|
||||
|
||||
/* Comment this if you want to build without any C library requirements */
|
||||
#define HAVE_LIBC 1
|
||||
#if HAVE_LIBC
|
||||
|
||||
/* Useful headers */
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_ICONV_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
/* #undef HAVE_ALTIVEC_H */
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#endif
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
/* #undef HAVE_STRLCPY */
|
||||
/* #undef HAVE_STRLCAT */
|
||||
#define HAVE_STRDUP 1
|
||||
/* #undef HAVE__STRREV */
|
||||
/* #undef HAVE__STRUPR */
|
||||
/* #undef HAVE__STRLWR */
|
||||
/* #undef HAVE_INDEX */
|
||||
/* #undef HAVE_RINDEX */
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
/* #undef HAVE_ITOA */
|
||||
/* #undef HAVE__LTOA */
|
||||
/* #undef HAVE__UITOA */
|
||||
/* #undef HAVE__ULTOA */
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
/* #undef HAVE__I64TOA */
|
||||
/* #undef HAVE__UI64TOA */
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
/* #undef HAVE__STRICMP */
|
||||
#define HAVE_STRCASECMP 1
|
||||
/* #undef HAVE__STRNICMP */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_ICONV 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
/* #undef HAVE_CLOCK_GETTIME */
|
||||
#define HAVE_DLVSYM 1
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
#define HAVE_MPROTECT 1
|
||||
|
||||
#else
|
||||
/* We may need some replacement for stdarg.h here */
|
||||
#include <stdarg.h>
|
||||
#endif /* HAVE_LIBC */
|
||||
|
||||
/* Allow disabling of core subsystems */
|
||||
#define SDL_AUDIO_DISABLED 1
|
||||
/* #undef SDL_CDROM_DISABLED */
|
||||
/* #undef SDL_CPUINFO_DISABLED */
|
||||
/* #undef SDL_EVENTS_DISABLED */
|
||||
/* #undef SDL_FILE_DISABLED */
|
||||
/* #undef SDL_JOYSTICK_DISABLED */
|
||||
/* #undef SDL_LOADSO_DISABLED */
|
||||
/* #undef SDL_THREADS_DISABLED */
|
||||
/* #undef SDL_TIMERS_DISABLED */
|
||||
/* #undef SDL_VIDEO_DISABLED */
|
||||
|
||||
/* Enable various audio drivers */
|
||||
/* #undef SDL_AUDIO_DRIVER_ALSA */
|
||||
/* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
|
||||
/* #undef SDL_AUDIO_DRIVER_ARTS */
|
||||
/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
|
||||
/* #undef SDL_AUDIO_DRIVER_BAUDIO */
|
||||
/* #undef SDL_AUDIO_DRIVER_BSD */
|
||||
/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
|
||||
/* #undef SDL_AUDIO_DRIVER_DART */
|
||||
/* #undef SDL_AUDIO_DRIVER_DC */
|
||||
/* #undef SDL_AUDIO_DRIVER_DISK */
|
||||
/* #undef SDL_AUDIO_DRIVER_DUMMY */
|
||||
/* #undef SDL_AUDIO_DRIVER_DMEDIA */
|
||||
/* #undef SDL_AUDIO_DRIVER_DSOUND */
|
||||
/* #undef SDL_AUDIO_DRIVER_PULSE */
|
||||
/* #undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC */
|
||||
/* #undef SDL_AUDIO_DRIVER_ESD */
|
||||
/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
|
||||
/* #undef SDL_AUDIO_DRIVER_MINT */
|
||||
/* #undef SDL_AUDIO_DRIVER_MMEAUDIO */
|
||||
/* #undef SDL_AUDIO_DRIVER_NAS */
|
||||
/* #undef SDL_AUDIO_DRIVER_OSS */
|
||||
/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
|
||||
/* #undef SDL_AUDIO_DRIVER_PAUD */
|
||||
/* #undef SDL_AUDIO_DRIVER_QNXNTO */
|
||||
/* #undef SDL_AUDIO_DRIVER_SNDMGR */
|
||||
/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
|
||||
/* #undef SDL_AUDIO_DRIVER_WAVEOUT */
|
||||
|
||||
/* Enable various cdrom drivers */
|
||||
/* #undef SDL_CDROM_AIX */
|
||||
/* #undef SDL_CDROM_BEOS */
|
||||
/* #undef SDL_CDROM_BSDI */
|
||||
/* #undef SDL_CDROM_DC */
|
||||
/* #undef SDL_CDROM_DUMMY */
|
||||
/* #undef SDL_CDROM_FREEBSD */
|
||||
#define SDL_CDROM_LINUX 1
|
||||
/* #undef SDL_CDROM_MACOS */
|
||||
/* #undef SDL_CDROM_MACOSX */
|
||||
/* #undef SDL_CDROM_MINT */
|
||||
/* #undef SDL_CDROM_OPENBSD */
|
||||
/* #undef SDL_CDROM_OS2 */
|
||||
/* #undef SDL_CDROM_OSF */
|
||||
/* #undef SDL_CDROM_QNX */
|
||||
/* #undef SDL_CDROM_WIN32 */
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_INPUT_LINUXEV 1
|
||||
/* #undef SDL_INPUT_TSLIB */
|
||||
/* #undef SDL_JOYSTICK_BEOS */
|
||||
/* #undef SDL_JOYSTICK_DC */
|
||||
/* #undef SDL_JOYSTICK_DUMMY */
|
||||
/* #undef SDL_JOYSTICK_IOKIT */
|
||||
#define SDL_JOYSTICK_LINUX 1
|
||||
/* #undef SDL_JOYSTICK_MACOS */
|
||||
/* #undef SDL_JOYSTICK_MINT */
|
||||
/* #undef SDL_JOYSTICK_OS2 */
|
||||
/* #undef SDL_JOYSTICK_RISCOS */
|
||||
/* #undef SDL_JOYSTICK_WINMM */
|
||||
/* #undef SDL_JOYSTICK_USBHID */
|
||||
/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
/* #undef SDL_LOADSO_BEOS */
|
||||
/* #undef SDL_LOADSO_DLCOMPAT */
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
/* #undef SDL_LOADSO_DUMMY */
|
||||
/* #undef SDL_LOADSO_LDG */
|
||||
/* #undef SDL_LOADSO_MACOS */
|
||||
/* #undef SDL_LOADSO_OS2 */
|
||||
/* #undef SDL_LOADSO_WIN32 */
|
||||
|
||||
/* Enable various threading systems */
|
||||
/* #undef SDL_THREAD_BEOS */
|
||||
/* #undef SDL_THREAD_DC */
|
||||
/* #undef SDL_THREAD_OS2 */
|
||||
/* #undef SDL_THREAD_PTH */
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||
/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
|
||||
/* #undef SDL_THREAD_SPROC */
|
||||
/* #undef SDL_THREAD_WIN32 */
|
||||
|
||||
/* Enable various timer systems */
|
||||
/* #undef SDL_TIMER_BEOS */
|
||||
/* #undef SDL_TIMER_DC */
|
||||
/* #undef SDL_TIMER_DUMMY */
|
||||
/* #undef SDL_TIMER_MACOS */
|
||||
/* #undef SDL_TIMER_MINT */
|
||||
/* #undef SDL_TIMER_OS2 */
|
||||
/* #undef SDL_TIMER_RISCOS */
|
||||
#define SDL_TIMER_UNIX 1
|
||||
/* #undef SDL_TIMER_WIN32 */
|
||||
/* #undef SDL_TIMER_WINCE */
|
||||
|
||||
/* Enable various video drivers */
|
||||
/* #undef SDL_VIDEO_DRIVER_AALIB */
|
||||
/* #undef SDL_VIDEO_DRIVER_BWINDOW */
|
||||
/* #undef SDL_VIDEO_DRIVER_DC */
|
||||
/* #undef SDL_VIDEO_DRIVER_DDRAW */
|
||||
#define SDL_VIDEO_DRIVER_DGA 1
|
||||
/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
|
||||
/* #undef SDL_VIDEO_DRIVER_DRAWSPROCKET */
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_FBCON 1
|
||||
/* #undef SDL_VIDEO_DRIVER_GAPI */
|
||||
/* #undef SDL_VIDEO_DRIVER_GEM */
|
||||
/* #undef SDL_VIDEO_DRIVER_GGI */
|
||||
/* #undef SDL_VIDEO_DRIVER_IPOD */
|
||||
/* #undef SDL_VIDEO_DRIVER_NANOX */
|
||||
/* #undef SDL_VIDEO_DRIVER_OS2FS */
|
||||
/* #undef SDL_VIDEO_DRIVER_PHOTON */
|
||||
/* #undef SDL_VIDEO_DRIVER_PICOGUI */
|
||||
/* #undef SDL_VIDEO_DRIVER_PS2GS */
|
||||
/* #undef SDL_VIDEO_DRIVER_QTOPIA */
|
||||
/* #undef SDL_VIDEO_DRIVER_QUARTZ */
|
||||
/* #undef SDL_VIDEO_DRIVER_RISCOS */
|
||||
/* #undef SDL_VIDEO_DRIVER_SVGALIB */
|
||||
/* #undef SDL_VIDEO_DRIVER_TOOLBOX */
|
||||
/* #undef SDL_VIDEO_DRIVER_VGL */
|
||||
/* #undef SDL_VIDEO_DRIVER_WINDIB */
|
||||
/* #undef SDL_VIDEO_DRIVER_WSCONS */
|
||||
#define SDL_VIDEO_DRIVER_X11 1
|
||||
#define SDL_VIDEO_DRIVER_X11_DGAMOUSE 1
|
||||
#define SDL_VIDEO_DRIVER_X11_DPMS 1
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"
|
||||
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */
|
||||
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER */
|
||||
#define SDL_VIDEO_DRIVER_X11_VIDMODE 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XME 1
|
||||
/* #undef SDL_VIDEO_DRIVER_X11_XRANDR */
|
||||
#define SDL_VIDEO_DRIVER_X11_XV 1
|
||||
/* #undef SDL_VIDEO_DRIVER_XBIOS */
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#define SDL_VIDEO_OPENGL_GLX 1
|
||||
/* #undef SDL_VIDEO_OPENGL_WGL */
|
||||
/* #undef SDL_VIDEO_OPENGL_OSMESA */
|
||||
/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
|
||||
|
||||
/* Enable assembly routines */
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
/* #undef SDL_HERMES_BLITTERS */
|
||||
/* #undef SDL_ALTIVEC_BLITTERS */
|
||||
|
||||
#endif /* _SDL_config_h */
|
45
build/linux/libs/sdl-1.2.13/include/SDL_config.h.default
Normal file
45
build/linux/libs/sdl-1.2.13/include/SDL_config.h.default
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_config_h
|
||||
#define _SDL_config_h
|
||||
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* Add any platform that doesn't build using the configure system */
|
||||
#if defined(__DREAMCAST__)
|
||||
#include "SDL_config_dreamcast.h"
|
||||
#elif defined(__MACOS__)
|
||||
#include "SDL_config_macos.h"
|
||||
#elif defined(__MACOSX__)
|
||||
#include "SDL_config_macosx.h"
|
||||
#elif defined(__SYMBIAN32__)
|
||||
#include "SDL_config_symbian.h" /* must be before win32! */
|
||||
#elif defined(__WIN32__)
|
||||
#include "SDL_config_win32.h"
|
||||
#elif defined(__OS2__)
|
||||
#include "SDL_config_os2.h"
|
||||
#else
|
||||
#include "SDL_config_minimal.h"
|
||||
#endif /* platform config */
|
||||
|
||||
#endif /* _SDL_config_h */
|
306
build/linux/libs/sdl-1.2.13/include/SDL_config.h.in
Normal file
306
build/linux/libs/sdl-1.2.13/include/SDL_config.h.in
Normal file
@ -0,0 +1,306 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_config_h
|
||||
#define _SDL_config_h
|
||||
|
||||
/* This is a set of defines to configure the SDL features */
|
||||
|
||||
/* General platform specific identifiers */
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* Make sure that this isn't included by Visual C++ */
|
||||
#ifdef _MSC_VER
|
||||
#error You should copy include/SDL_config.h.default to include/SDL_config.h
|
||||
#endif
|
||||
|
||||
/* C language features */
|
||||
#undef const
|
||||
#undef inline
|
||||
#undef volatile
|
||||
|
||||
/* C datatypes */
|
||||
#undef size_t
|
||||
#undef int8_t
|
||||
#undef uint8_t
|
||||
#undef int16_t
|
||||
#undef uint16_t
|
||||
#undef int32_t
|
||||
#undef uint32_t
|
||||
#undef int64_t
|
||||
#undef uint64_t
|
||||
#undef uintptr_t
|
||||
#undef SDL_HAS_64BIT_TYPE
|
||||
|
||||
/* Endianness */
|
||||
#undef SDL_BYTEORDER
|
||||
|
||||
/* Comment this if you want to build without any C library requirements */
|
||||
#undef HAVE_LIBC
|
||||
#if HAVE_LIBC
|
||||
|
||||
/* Useful headers */
|
||||
#undef HAVE_ALLOCA_H
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
#undef HAVE_STDIO_H
|
||||
#undef STDC_HEADERS
|
||||
#undef HAVE_STDLIB_H
|
||||
#undef HAVE_STDARG_H
|
||||
#undef HAVE_MALLOC_H
|
||||
#undef HAVE_MEMORY_H
|
||||
#undef HAVE_STRING_H
|
||||
#undef HAVE_STRINGS_H
|
||||
#undef HAVE_INTTYPES_H
|
||||
#undef HAVE_STDINT_H
|
||||
#undef HAVE_CTYPE_H
|
||||
#undef HAVE_MATH_H
|
||||
#undef HAVE_ICONV_H
|
||||
#undef HAVE_SIGNAL_H
|
||||
#undef HAVE_ALTIVEC_H
|
||||
|
||||
/* C library functions */
|
||||
#undef HAVE_MALLOC
|
||||
#undef HAVE_CALLOC
|
||||
#undef HAVE_REALLOC
|
||||
#undef HAVE_FREE
|
||||
#undef HAVE_ALLOCA
|
||||
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
|
||||
#undef HAVE_GETENV
|
||||
#undef HAVE_PUTENV
|
||||
#undef HAVE_UNSETENV
|
||||
#endif
|
||||
#undef HAVE_QSORT
|
||||
#undef HAVE_ABS
|
||||
#undef HAVE_BCOPY
|
||||
#undef HAVE_MEMSET
|
||||
#undef HAVE_MEMCPY
|
||||
#undef HAVE_MEMMOVE
|
||||
#undef HAVE_MEMCMP
|
||||
#undef HAVE_STRLEN
|
||||
#undef HAVE_STRLCPY
|
||||
#undef HAVE_STRLCAT
|
||||
#undef HAVE_STRDUP
|
||||
#undef HAVE__STRREV
|
||||
#undef HAVE__STRUPR
|
||||
#undef HAVE__STRLWR
|
||||
#undef HAVE_INDEX
|
||||
#undef HAVE_RINDEX
|
||||
#undef HAVE_STRCHR
|
||||
#undef HAVE_STRRCHR
|
||||
#undef HAVE_STRSTR
|
||||
#undef HAVE_ITOA
|
||||
#undef HAVE__LTOA
|
||||
#undef HAVE__UITOA
|
||||
#undef HAVE__ULTOA
|
||||
#undef HAVE_STRTOL
|
||||
#undef HAVE_STRTOUL
|
||||
#undef HAVE__I64TOA
|
||||
#undef HAVE__UI64TOA
|
||||
#undef HAVE_STRTOLL
|
||||
#undef HAVE_STRTOULL
|
||||
#undef HAVE_STRTOD
|
||||
#undef HAVE_ATOI
|
||||
#undef HAVE_ATOF
|
||||
#undef HAVE_STRCMP
|
||||
#undef HAVE_STRNCMP
|
||||
#undef HAVE__STRICMP
|
||||
#undef HAVE_STRCASECMP
|
||||
#undef HAVE__STRNICMP
|
||||
#undef HAVE_STRNCASECMP
|
||||
#undef HAVE_SSCANF
|
||||
#undef HAVE_SNPRINTF
|
||||
#undef HAVE_VSNPRINTF
|
||||
#undef HAVE_ICONV
|
||||
#undef HAVE_SIGACTION
|
||||
#undef HAVE_SETJMP
|
||||
#undef HAVE_NANOSLEEP
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
#undef HAVE_DLVSYM
|
||||
#undef HAVE_GETPAGESIZE
|
||||
#undef HAVE_MPROTECT
|
||||
|
||||
#else
|
||||
/* We may need some replacement for stdarg.h here */
|
||||
#include <stdarg.h>
|
||||
#endif /* HAVE_LIBC */
|
||||
|
||||
/* Allow disabling of core subsystems */
|
||||
#undef SDL_AUDIO_DISABLED
|
||||
#undef SDL_CDROM_DISABLED
|
||||
#undef SDL_CPUINFO_DISABLED
|
||||
#undef SDL_EVENTS_DISABLED
|
||||
#undef SDL_FILE_DISABLED
|
||||
#undef SDL_JOYSTICK_DISABLED
|
||||
#undef SDL_LOADSO_DISABLED
|
||||
#undef SDL_THREADS_DISABLED
|
||||
#undef SDL_TIMERS_DISABLED
|
||||
#undef SDL_VIDEO_DISABLED
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#undef SDL_AUDIO_DRIVER_ALSA
|
||||
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
|
||||
#undef SDL_AUDIO_DRIVER_ARTS
|
||||
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
|
||||
#undef SDL_AUDIO_DRIVER_BAUDIO
|
||||
#undef SDL_AUDIO_DRIVER_BSD
|
||||
#undef SDL_AUDIO_DRIVER_COREAUDIO
|
||||
#undef SDL_AUDIO_DRIVER_DART
|
||||
#undef SDL_AUDIO_DRIVER_DC
|
||||
#undef SDL_AUDIO_DRIVER_DISK
|
||||
#undef SDL_AUDIO_DRIVER_DUMMY
|
||||
#undef SDL_AUDIO_DRIVER_DMEDIA
|
||||
#undef SDL_AUDIO_DRIVER_DSOUND
|
||||
#undef SDL_AUDIO_DRIVER_PULSE
|
||||
#undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
|
||||
#undef SDL_AUDIO_DRIVER_ESD
|
||||
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
|
||||
#undef SDL_AUDIO_DRIVER_MINT
|
||||
#undef SDL_AUDIO_DRIVER_MMEAUDIO
|
||||
#undef SDL_AUDIO_DRIVER_NAS
|
||||
#undef SDL_AUDIO_DRIVER_OSS
|
||||
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
|
||||
#undef SDL_AUDIO_DRIVER_PAUD
|
||||
#undef SDL_AUDIO_DRIVER_QNXNTO
|
||||
#undef SDL_AUDIO_DRIVER_SNDMGR
|
||||
#undef SDL_AUDIO_DRIVER_SUNAUDIO
|
||||
#undef SDL_AUDIO_DRIVER_WAVEOUT
|
||||
|
||||
/* Enable various cdrom drivers */
|
||||
#undef SDL_CDROM_AIX
|
||||
#undef SDL_CDROM_BEOS
|
||||
#undef SDL_CDROM_BSDI
|
||||
#undef SDL_CDROM_DC
|
||||
#undef SDL_CDROM_DUMMY
|
||||
#undef SDL_CDROM_FREEBSD
|
||||
#undef SDL_CDROM_LINUX
|
||||
#undef SDL_CDROM_MACOS
|
||||
#undef SDL_CDROM_MACOSX
|
||||
#undef SDL_CDROM_MINT
|
||||
#undef SDL_CDROM_OPENBSD
|
||||
#undef SDL_CDROM_OS2
|
||||
#undef SDL_CDROM_OSF
|
||||
#undef SDL_CDROM_QNX
|
||||
#undef SDL_CDROM_WIN32
|
||||
|
||||
/* Enable various input drivers */
|
||||
#undef SDL_INPUT_LINUXEV
|
||||
#undef SDL_INPUT_TSLIB
|
||||
#undef SDL_JOYSTICK_BEOS
|
||||
#undef SDL_JOYSTICK_DC
|
||||
#undef SDL_JOYSTICK_DUMMY
|
||||
#undef SDL_JOYSTICK_IOKIT
|
||||
#undef SDL_JOYSTICK_LINUX
|
||||
#undef SDL_JOYSTICK_MACOS
|
||||
#undef SDL_JOYSTICK_MINT
|
||||
#undef SDL_JOYSTICK_OS2
|
||||
#undef SDL_JOYSTICK_RISCOS
|
||||
#undef SDL_JOYSTICK_WINMM
|
||||
#undef SDL_JOYSTICK_USBHID
|
||||
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#undef SDL_LOADSO_BEOS
|
||||
#undef SDL_LOADSO_DLCOMPAT
|
||||
#undef SDL_LOADSO_DLOPEN
|
||||
#undef SDL_LOADSO_DUMMY
|
||||
#undef SDL_LOADSO_LDG
|
||||
#undef SDL_LOADSO_MACOS
|
||||
#undef SDL_LOADSO_OS2
|
||||
#undef SDL_LOADSO_WIN32
|
||||
|
||||
/* Enable various threading systems */
|
||||
#undef SDL_THREAD_BEOS
|
||||
#undef SDL_THREAD_DC
|
||||
#undef SDL_THREAD_OS2
|
||||
#undef SDL_THREAD_PTH
|
||||
#undef SDL_THREAD_PTHREAD
|
||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
|
||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
|
||||
#undef SDL_THREAD_SPROC
|
||||
#undef SDL_THREAD_WIN32
|
||||
|
||||
/* Enable various timer systems */
|
||||
#undef SDL_TIMER_BEOS
|
||||
#undef SDL_TIMER_DC
|
||||
#undef SDL_TIMER_DUMMY
|
||||
#undef SDL_TIMER_MACOS
|
||||
#undef SDL_TIMER_MINT
|
||||
#undef SDL_TIMER_OS2
|
||||
#undef SDL_TIMER_RISCOS
|
||||
#undef SDL_TIMER_UNIX
|
||||
#undef SDL_TIMER_WIN32
|
||||
#undef SDL_TIMER_WINCE
|
||||
|
||||
/* Enable various video drivers */
|
||||
#undef SDL_VIDEO_DRIVER_AALIB
|
||||
#undef SDL_VIDEO_DRIVER_BWINDOW
|
||||
#undef SDL_VIDEO_DRIVER_DC
|
||||
#undef SDL_VIDEO_DRIVER_DDRAW
|
||||
#undef SDL_VIDEO_DRIVER_DGA
|
||||
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
||||
#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
|
||||
#undef SDL_VIDEO_DRIVER_DUMMY
|
||||
#undef SDL_VIDEO_DRIVER_FBCON
|
||||
#undef SDL_VIDEO_DRIVER_GAPI
|
||||
#undef SDL_VIDEO_DRIVER_GEM
|
||||
#undef SDL_VIDEO_DRIVER_GGI
|
||||
#undef SDL_VIDEO_DRIVER_IPOD
|
||||
#undef SDL_VIDEO_DRIVER_NANOX
|
||||
#undef SDL_VIDEO_DRIVER_OS2FS
|
||||
#undef SDL_VIDEO_DRIVER_PHOTON
|
||||
#undef SDL_VIDEO_DRIVER_PICOGUI
|
||||
#undef SDL_VIDEO_DRIVER_PS2GS
|
||||
#undef SDL_VIDEO_DRIVER_QTOPIA
|
||||
#undef SDL_VIDEO_DRIVER_QUARTZ
|
||||
#undef SDL_VIDEO_DRIVER_RISCOS
|
||||
#undef SDL_VIDEO_DRIVER_SVGALIB
|
||||
#undef SDL_VIDEO_DRIVER_TOOLBOX
|
||||
#undef SDL_VIDEO_DRIVER_VGL
|
||||
#undef SDL_VIDEO_DRIVER_WINDIB
|
||||
#undef SDL_VIDEO_DRIVER_WSCONS
|
||||
#undef SDL_VIDEO_DRIVER_X11
|
||||
#undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
|
||||
#undef SDL_VIDEO_DRIVER_X11_DPMS
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
|
||||
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
|
||||
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
|
||||
#undef SDL_VIDEO_DRIVER_X11_XME
|
||||
#undef SDL_VIDEO_DRIVER_X11_XRANDR
|
||||
#undef SDL_VIDEO_DRIVER_X11_XV
|
||||
#undef SDL_VIDEO_DRIVER_XBIOS
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#undef SDL_VIDEO_OPENGL
|
||||
#undef SDL_VIDEO_OPENGL_GLX
|
||||
#undef SDL_VIDEO_OPENGL_WGL
|
||||
#undef SDL_VIDEO_OPENGL_OSMESA
|
||||
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
|
||||
|
||||
/* Enable assembly routines */
|
||||
#undef SDL_ASSEMBLY_ROUTINES
|
||||
#undef SDL_HERMES_BLITTERS
|
||||
#undef SDL_ALTIVEC_BLITTERS
|
||||
|
||||
#endif /* _SDL_config_h */
|
22
build/linux/libs/sdl-1.2.13/include/SDL_copying.h
Normal file
22
build/linux/libs/sdl-1.2.13/include/SDL_copying.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
75
build/linux/libs/sdl-1.2.13/include/SDL_cpuinfo.h
Normal file
75
build/linux/libs/sdl-1.2.13/include/SDL_cpuinfo.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* CPU feature detection for SDL */
|
||||
|
||||
#ifndef _SDL_cpuinfo_h
|
||||
#define _SDL_cpuinfo_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This function returns true if the CPU has the RDTSC instruction
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
||||
|
||||
/* This function returns true if the CPU has MMX features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
||||
|
||||
/* This function returns true if the CPU has MMX Ext. features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
|
||||
|
||||
/* This function returns true if the CPU has 3DNow features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
||||
|
||||
/* This function returns true if the CPU has 3DNow! Ext. features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
|
||||
|
||||
/* This function returns true if the CPU has SSE features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
||||
|
||||
/* This function returns true if the CPU has SSE2 features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
||||
|
||||
/* This function returns true if the CPU has AltiVec features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_cpuinfo_h */
|
194
build/linux/libs/sdl-1.2.13/include/SDL_endian.h
Normal file
194
build/linux/libs/sdl-1.2.13/include/SDL_endian.h
Normal file
@ -0,0 +1,194 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Functions for reading and writing endian-specific values */
|
||||
|
||||
#ifndef _SDL_endian_h
|
||||
#define _SDL_endian_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
/* The two types of endianness */
|
||||
#define SDL_LIL_ENDIAN 1234
|
||||
#define SDL_BIG_ENDIAN 4321
|
||||
|
||||
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
|
||||
#if defined(__hppa__) || \
|
||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
||||
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
||||
defined(__sparc__)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#endif
|
||||
#endif /* !SDL_BYTEORDER */
|
||||
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Use inline functions for compilers that support them, and static
|
||||
functions for those that do not. Because these functions become
|
||||
static for compilers that do not support inline functions, this
|
||||
header should only be included in files that actually use them.
|
||||
*/
|
||||
#if defined(__GNUC__) && defined(__i386__) && \
|
||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
Uint16 result;
|
||||
|
||||
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
|
||||
return result;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
|
||||
return((x<<8)|(x>>8));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__) && \
|
||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswap %0" : "=r" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswapl %0" : "=r" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
Uint32 result;
|
||||
|
||||
__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
|
||||
__asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x));
|
||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
|
||||
return result;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
|
||||
return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
#if defined(__GNUC__) && defined(__i386__) && \
|
||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
union {
|
||||
struct { Uint32 a,b; } s;
|
||||
Uint64 u;
|
||||
} v;
|
||||
v.u = x;
|
||||
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
||||
: "=r" (v.s.a), "=r" (v.s.b)
|
||||
: "0" (v.s.a), "1" (v.s.b));
|
||||
return v.u;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
__asm__("bswapq %0" : "=r" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
Uint32 hi, lo;
|
||||
|
||||
/* Separate into high and low 32-bit values and swap them */
|
||||
lo = (Uint32)(x&0xFFFFFFFF);
|
||||
x >>= 32;
|
||||
hi = (Uint32)(x&0xFFFFFFFF);
|
||||
x = SDL_Swap32(lo);
|
||||
x <<= 32;
|
||||
x |= SDL_Swap32(hi);
|
||||
return(x);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/* This is mainly to keep compilers from complaining in SDL code.
|
||||
If there is no real 64-bit datatype, then compilers will complain about
|
||||
the fake 64-bit datatype that SDL provides when it compiles user code.
|
||||
*/
|
||||
#define SDL_Swap64(X) (X)
|
||||
#endif /* SDL_HAS_64BIT_TYPE */
|
||||
|
||||
|
||||
/* Byteswap item from the specified endianness to the native endianness */
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define SDL_SwapLE16(X) (X)
|
||||
#define SDL_SwapLE32(X) (X)
|
||||
#define SDL_SwapLE64(X) (X)
|
||||
#define SDL_SwapBE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapBE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapBE64(X) SDL_Swap64(X)
|
||||
#else
|
||||
#define SDL_SwapLE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapLE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapLE64(X) SDL_Swap64(X)
|
||||
#define SDL_SwapBE16(X) (X)
|
||||
#define SDL_SwapBE32(X) (X)
|
||||
#define SDL_SwapBE64(X) (X)
|
||||
#endif
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_endian_h */
|
61
build/linux/libs/sdl-1.2.13/include/SDL_error.h
Normal file
61
build/linux/libs/sdl-1.2.13/include/SDL_error.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Simple error message routines for SDL */
|
||||
|
||||
#ifndef _SDL_error_h
|
||||
#define _SDL_error_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
|
||||
extern DECLSPEC char * SDLCALL SDL_GetError(void);
|
||||
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
||||
|
||||
/* Private error message function - used internally */
|
||||
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
||||
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
|
||||
typedef enum {
|
||||
SDL_ENOMEM,
|
||||
SDL_EFREAD,
|
||||
SDL_EFWRITE,
|
||||
SDL_EFSEEK,
|
||||
SDL_UNSUPPORTED,
|
||||
SDL_LASTERROR
|
||||
} SDL_errorcode;
|
||||
extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_error_h */
|
337
build/linux/libs/sdl-1.2.13/include/SDL_events.h
Normal file
337
build/linux/libs/sdl-1.2.13/include/SDL_events.h
Normal file
@ -0,0 +1,337 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL event handling */
|
||||
|
||||
#ifndef _SDL_events_h
|
||||
#define _SDL_events_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_active.h"
|
||||
#include "SDL_keyboard.h"
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_quit.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* General keyboard/mouse state definitions */
|
||||
#define SDL_RELEASED 0
|
||||
#define SDL_PRESSED 1
|
||||
|
||||
/* Event enumerations */
|
||||
typedef enum {
|
||||
SDL_NOEVENT = 0, /* Unused (do not remove) */
|
||||
SDL_ACTIVEEVENT, /* Application loses/gains visibility */
|
||||
SDL_KEYDOWN, /* Keys pressed */
|
||||
SDL_KEYUP, /* Keys released */
|
||||
SDL_MOUSEMOTION, /* Mouse moved */
|
||||
SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
|
||||
SDL_MOUSEBUTTONUP, /* Mouse button released */
|
||||
SDL_JOYAXISMOTION, /* Joystick axis motion */
|
||||
SDL_JOYBALLMOTION, /* Joystick trackball motion */
|
||||
SDL_JOYHATMOTION, /* Joystick hat position change */
|
||||
SDL_JOYBUTTONDOWN, /* Joystick button pressed */
|
||||
SDL_JOYBUTTONUP, /* Joystick button released */
|
||||
SDL_QUIT, /* User-requested quit */
|
||||
SDL_SYSWMEVENT, /* System specific event */
|
||||
SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
|
||||
SDL_VIDEORESIZE, /* User resized video mode */
|
||||
SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
|
||||
SDL_EVENT_RESERVED2, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED3, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED4, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED5, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED6, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED7, /* Reserved for future use.. */
|
||||
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
|
||||
SDL_USEREVENT = 24,
|
||||
/* This last event is only for bounding internal arrays
|
||||
It is the number of bits in the event mask datatype -- Uint32
|
||||
*/
|
||||
SDL_NUMEVENTS = 32
|
||||
} SDL_EventType;
|
||||
|
||||
/* Predefined event masks */
|
||||
#define SDL_EVENTMASK(X) (1<<(X))
|
||||
typedef enum {
|
||||
SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
|
||||
SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
|
||||
SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
|
||||
SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
|
||||
SDL_EVENTMASK(SDL_KEYUP),
|
||||
SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
|
||||
SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
|
||||
SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
||||
SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
|
||||
SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
|
||||
SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
||||
SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
|
||||
SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
|
||||
SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
|
||||
SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
|
||||
SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
||||
SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
|
||||
SDL_EVENTMASK(SDL_JOYBALLMOTION)|
|
||||
SDL_EVENTMASK(SDL_JOYHATMOTION)|
|
||||
SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
|
||||
SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
||||
SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
|
||||
SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
|
||||
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
|
||||
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
|
||||
} SDL_EventMask ;
|
||||
#define SDL_ALLEVENTS 0xFFFFFFFF
|
||||
|
||||
/* Application visibility event structure */
|
||||
typedef struct SDL_ActiveEvent {
|
||||
Uint8 type; /* SDL_ACTIVEEVENT */
|
||||
Uint8 gain; /* Whether given states were gained or lost (1/0) */
|
||||
Uint8 state; /* A mask of the focus states */
|
||||
} SDL_ActiveEvent;
|
||||
|
||||
/* Keyboard event structure */
|
||||
typedef struct SDL_KeyboardEvent {
|
||||
Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */
|
||||
Uint8 which; /* The keyboard device index */
|
||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||
SDL_keysym keysym;
|
||||
} SDL_KeyboardEvent;
|
||||
|
||||
/* Mouse motion event structure */
|
||||
typedef struct SDL_MouseMotionEvent {
|
||||
Uint8 type; /* SDL_MOUSEMOTION */
|
||||
Uint8 which; /* The mouse device index */
|
||||
Uint8 state; /* The current button state */
|
||||
Uint16 x, y; /* The X/Y coordinates of the mouse */
|
||||
Sint16 xrel; /* The relative motion in the X direction */
|
||||
Sint16 yrel; /* The relative motion in the Y direction */
|
||||
} SDL_MouseMotionEvent;
|
||||
|
||||
/* Mouse button event structure */
|
||||
typedef struct SDL_MouseButtonEvent {
|
||||
Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
|
||||
Uint8 which; /* The mouse device index */
|
||||
Uint8 button; /* The mouse button index */
|
||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||
Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
|
||||
} SDL_MouseButtonEvent;
|
||||
|
||||
/* Joystick axis motion event structure */
|
||||
typedef struct SDL_JoyAxisEvent {
|
||||
Uint8 type; /* SDL_JOYAXISMOTION */
|
||||
Uint8 which; /* The joystick device index */
|
||||
Uint8 axis; /* The joystick axis index */
|
||||
Sint16 value; /* The axis value (range: -32768 to 32767) */
|
||||
} SDL_JoyAxisEvent;
|
||||
|
||||
/* Joystick trackball motion event structure */
|
||||
typedef struct SDL_JoyBallEvent {
|
||||
Uint8 type; /* SDL_JOYBALLMOTION */
|
||||
Uint8 which; /* The joystick device index */
|
||||
Uint8 ball; /* The joystick trackball index */
|
||||
Sint16 xrel; /* The relative motion in the X direction */
|
||||
Sint16 yrel; /* The relative motion in the Y direction */
|
||||
} SDL_JoyBallEvent;
|
||||
|
||||
/* Joystick hat position change event structure */
|
||||
typedef struct SDL_JoyHatEvent {
|
||||
Uint8 type; /* SDL_JOYHATMOTION */
|
||||
Uint8 which; /* The joystick device index */
|
||||
Uint8 hat; /* The joystick hat index */
|
||||
Uint8 value; /* The hat position value:
|
||||
SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
|
||||
SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
|
||||
SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
|
||||
Note that zero means the POV is centered.
|
||||
*/
|
||||
} SDL_JoyHatEvent;
|
||||
|
||||
/* Joystick button event structure */
|
||||
typedef struct SDL_JoyButtonEvent {
|
||||
Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
|
||||
Uint8 which; /* The joystick device index */
|
||||
Uint8 button; /* The joystick button index */
|
||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||
} SDL_JoyButtonEvent;
|
||||
|
||||
/* The "window resized" event
|
||||
When you get this event, you are responsible for setting a new video
|
||||
mode with the new width and height.
|
||||
*/
|
||||
typedef struct SDL_ResizeEvent {
|
||||
Uint8 type; /* SDL_VIDEORESIZE */
|
||||
int w; /* New width */
|
||||
int h; /* New height */
|
||||
} SDL_ResizeEvent;
|
||||
|
||||
/* The "screen redraw" event */
|
||||
typedef struct SDL_ExposeEvent {
|
||||
Uint8 type; /* SDL_VIDEOEXPOSE */
|
||||
} SDL_ExposeEvent;
|
||||
|
||||
/* The "quit requested" event */
|
||||
typedef struct SDL_QuitEvent {
|
||||
Uint8 type; /* SDL_QUIT */
|
||||
} SDL_QuitEvent;
|
||||
|
||||
/* A user-defined event type */
|
||||
typedef struct SDL_UserEvent {
|
||||
Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */
|
||||
int code; /* User defined event code */
|
||||
void *data1; /* User defined data pointer */
|
||||
void *data2; /* User defined data pointer */
|
||||
} SDL_UserEvent;
|
||||
|
||||
/* If you want to use this event, you should include SDL_syswm.h */
|
||||
struct SDL_SysWMmsg;
|
||||
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
|
||||
typedef struct SDL_SysWMEvent {
|
||||
Uint8 type;
|
||||
SDL_SysWMmsg *msg;
|
||||
} SDL_SysWMEvent;
|
||||
|
||||
/* General event structure */
|
||||
typedef union SDL_Event {
|
||||
Uint8 type;
|
||||
SDL_ActiveEvent active;
|
||||
SDL_KeyboardEvent key;
|
||||
SDL_MouseMotionEvent motion;
|
||||
SDL_MouseButtonEvent button;
|
||||
SDL_JoyAxisEvent jaxis;
|
||||
SDL_JoyBallEvent jball;
|
||||
SDL_JoyHatEvent jhat;
|
||||
SDL_JoyButtonEvent jbutton;
|
||||
SDL_ResizeEvent resize;
|
||||
SDL_ExposeEvent expose;
|
||||
SDL_QuitEvent quit;
|
||||
SDL_UserEvent user;
|
||||
SDL_SysWMEvent syswm;
|
||||
} SDL_Event;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* Pumps the event loop, gathering events from the input devices.
|
||||
This function updates the event queue and internal input device state.
|
||||
This should only be run in the thread that sets the video mode.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
|
||||
|
||||
/* Checks the event queue for messages and optionally returns them.
|
||||
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
|
||||
the back of the event queue.
|
||||
If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
|
||||
of the event queue, matching 'mask', will be returned and will not
|
||||
be removed from the queue.
|
||||
If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
|
||||
of the event queue, matching 'mask', will be returned and will be
|
||||
removed from the queue.
|
||||
This function returns the number of events actually stored, or -1
|
||||
if there was an error. This function is thread-safe.
|
||||
*/
|
||||
typedef enum {
|
||||
SDL_ADDEVENT,
|
||||
SDL_PEEKEVENT,
|
||||
SDL_GETEVENT
|
||||
} SDL_eventaction;
|
||||
/* */
|
||||
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
|
||||
SDL_eventaction action, Uint32 mask);
|
||||
|
||||
/* Polls for currently pending events, and returns 1 if there are any pending
|
||||
events, or 0 if there are none available. If 'event' is not NULL, the next
|
||||
event is removed from the queue and stored in that area.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
|
||||
|
||||
/* Waits indefinitely for the next available event, returning 1, or 0 if there
|
||||
was an error while waiting for events. If 'event' is not NULL, the next
|
||||
event is removed from the queue and stored in that area.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
|
||||
|
||||
/* Add an event to the event queue.
|
||||
This function returns 0 on success, or -1 if the event queue was full
|
||||
or there was some other error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
|
||||
|
||||
/*
|
||||
This function sets up a filter to process all events before they
|
||||
change internal state and are posted to the internal event queue.
|
||||
|
||||
The filter is protypted as:
|
||||
*/
|
||||
typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
|
||||
/*
|
||||
If the filter returns 1, then the event will be added to the internal queue.
|
||||
If it returns 0, then the event will be dropped from the queue, but the
|
||||
internal state will still be updated. This allows selective filtering of
|
||||
dynamically arriving events.
|
||||
|
||||
WARNING: Be very careful of what you do in the event filter function, as
|
||||
it may run in a different thread!
|
||||
|
||||
There is one caveat when dealing with the SDL_QUITEVENT event type. The
|
||||
event filter is only called when the window manager desires to close the
|
||||
application window. If the event filter returns 1, then the window will
|
||||
be closed, otherwise the window will remain open if possible.
|
||||
If the quit event is generated by an interrupt signal, it will bypass the
|
||||
internal queue and be delivered to the application at the next event poll.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
|
||||
|
||||
/*
|
||||
Return the current event filter - can be used to "chain" filters.
|
||||
If there is no event filter set, this function returns NULL.
|
||||
*/
|
||||
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
|
||||
|
||||
/*
|
||||
This function allows you to set the state of processing certain events.
|
||||
If 'state' is set to SDL_IGNORE, that event will be automatically dropped
|
||||
from the event queue and will not event be filtered.
|
||||
If 'state' is set to SDL_ENABLE, that event will be processed normally.
|
||||
If 'state' is set to SDL_QUERY, SDL_EventState() will return the
|
||||
current processing state of the specified event.
|
||||
*/
|
||||
#define SDL_QUERY -1
|
||||
#define SDL_IGNORE 0
|
||||
#define SDL_DISABLE 0
|
||||
#define SDL_ENABLE 1
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_events_h */
|
24
build/linux/libs/sdl-1.2.13/include/SDL_getenv.h
Normal file
24
build/linux/libs/sdl-1.2.13/include/SDL_getenv.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* DEPRECATED */
|
||||
#include "SDL_stdinc.h"
|
167
build/linux/libs/sdl-1.2.13/include/SDL_joystick.h
Normal file
167
build/linux/libs/sdl-1.2.13/include/SDL_joystick.h
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL joystick event handling */
|
||||
|
||||
#ifndef _SDL_joystick_h
|
||||
#define _SDL_joystick_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* In order to use these functions, SDL_Init() must have been called
|
||||
with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
|
||||
for joysticks, and load appropriate drivers.
|
||||
*/
|
||||
|
||||
/* The joystick structure used to identify an SDL joystick */
|
||||
struct _SDL_Joystick;
|
||||
typedef struct _SDL_Joystick SDL_Joystick;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* Count the number of joysticks attached to the system
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
|
||||
|
||||
/*
|
||||
* Get the implementation dependent name of a joystick.
|
||||
* This can be called before any joysticks are opened.
|
||||
* If no name can be found, this function returns NULL.
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index);
|
||||
|
||||
/*
|
||||
* Open a joystick for use - the index passed as an argument refers to
|
||||
* the N'th joystick on the system. This index is the value which will
|
||||
* identify this joystick in future joystick events.
|
||||
*
|
||||
* This function returns a joystick identifier, or NULL if an error occurred.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index);
|
||||
|
||||
/*
|
||||
* Returns 1 if the joystick has been opened, or 0 if it has not.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
|
||||
|
||||
/*
|
||||
* Get the device index of an opened joystick.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* Get the number of general axis controls on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* Get the number of trackballs on a joystick
|
||||
* Joystick trackballs have only relative motion events associated
|
||||
* with them and their state cannot be polled.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* Get the number of POV hats on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* Get the number of buttons on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* Update the current state of the open joysticks.
|
||||
* This is called automatically by the event loop if any joystick
|
||||
* events are enabled.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
||||
|
||||
/*
|
||||
* Enable/disable joystick event polling.
|
||||
* If joystick events are disabled, you must call SDL_JoystickUpdate()
|
||||
* yourself and check the state of the joystick when you want joystick
|
||||
* information.
|
||||
* The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
||||
|
||||
/*
|
||||
* Get the current state of an axis control on a joystick
|
||||
* The state is a value ranging from -32768 to 32767.
|
||||
* The axis indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
|
||||
|
||||
/*
|
||||
* Get the current state of a POV hat on a joystick
|
||||
* The return value is one of the following positions:
|
||||
*/
|
||||
#define SDL_HAT_CENTERED 0x00
|
||||
#define SDL_HAT_UP 0x01
|
||||
#define SDL_HAT_RIGHT 0x02
|
||||
#define SDL_HAT_DOWN 0x04
|
||||
#define SDL_HAT_LEFT 0x08
|
||||
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
|
||||
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
|
||||
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
|
||||
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
|
||||
/*
|
||||
* The hat indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
|
||||
|
||||
/*
|
||||
* Get the ball axis change since the last poll
|
||||
* This returns 0, or -1 if you passed it invalid parameters.
|
||||
* The ball indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
|
||||
|
||||
/*
|
||||
* Get the current state of a button on a joystick
|
||||
* The button indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
|
||||
|
||||
/*
|
||||
* Close a joystick previously opened with SDL_JoystickOpen()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_joystick_h */
|
121
build/linux/libs/sdl-1.2.13/include/SDL_keyboard.h
Normal file
121
build/linux/libs/sdl-1.2.13/include/SDL_keyboard.h
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL keyboard event handling */
|
||||
|
||||
#ifndef _SDL_keyboard_h
|
||||
#define _SDL_keyboard_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_keysym.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Keysym structure
|
||||
- The scancode is hardware dependent, and should not be used by general
|
||||
applications. If no hardware scancode is available, it will be 0.
|
||||
|
||||
- The 'unicode' translated character is only available when character
|
||||
translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
|
||||
this is a UNICODE character corresponding to the keypress. If the
|
||||
high 9 bits of the character are 0, then this maps to the equivalent
|
||||
ASCII character:
|
||||
char ch;
|
||||
if ( (keysym.unicode & 0xFF80) == 0 ) {
|
||||
ch = keysym.unicode & 0x7F;
|
||||
} else {
|
||||
An international character..
|
||||
}
|
||||
*/
|
||||
typedef struct SDL_keysym {
|
||||
Uint8 scancode; /* hardware specific scancode */
|
||||
SDLKey sym; /* SDL virtual keysym */
|
||||
SDLMod mod; /* current key modifiers */
|
||||
Uint16 unicode; /* translated character */
|
||||
} SDL_keysym;
|
||||
|
||||
/* This is the mask which refers to all hotkey bindings */
|
||||
#define SDL_ALL_HOTKEYS 0xFFFFFFFF
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* Enable/Disable UNICODE translation of keyboard input.
|
||||
* This translation has some overhead, so translation defaults off.
|
||||
* If 'enable' is 1, translation is enabled.
|
||||
* If 'enable' is 0, translation is disabled.
|
||||
* If 'enable' is -1, the translation state is not changed.
|
||||
* It returns the previous state of keyboard translation.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
|
||||
|
||||
/*
|
||||
* Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
|
||||
* 'delay' is the initial delay in ms between the time when a key is
|
||||
* pressed, and keyboard repeat begins.
|
||||
* 'interval' is the time in ms between keyboard repeat events.
|
||||
*/
|
||||
#define SDL_DEFAULT_REPEAT_DELAY 500
|
||||
#define SDL_DEFAULT_REPEAT_INTERVAL 30
|
||||
/*
|
||||
* If 'delay' is set to 0, keyboard repeat is disabled.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
|
||||
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
|
||||
|
||||
/*
|
||||
* Get a snapshot of the current state of the keyboard.
|
||||
* Returns an array of keystates, indexed by the SDLK_* syms.
|
||||
* Used:
|
||||
* Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
* if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
|
||||
*/
|
||||
extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
|
||||
|
||||
/*
|
||||
* Get the current key modifier state
|
||||
*/
|
||||
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
|
||||
|
||||
/*
|
||||
* Set the current key modifier state
|
||||
* This does not change the keyboard state, only the key modifier flags.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
|
||||
|
||||
/*
|
||||
* Get the name of an SDL virtual keysym
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_keyboard_h */
|
311
build/linux/libs/sdl-1.2.13/include/SDL_keysym.h
Normal file
311
build/linux/libs/sdl-1.2.13/include/SDL_keysym.h
Normal file
@ -0,0 +1,311 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_keysym_h
|
||||
#define _SDL_keysym_h
|
||||
|
||||
/* What we really want is a mapping of every raw key on the keyboard.
|
||||
To support international keyboards, we use the range 0xA1 - 0xFF
|
||||
as international virtual keycodes. We'll follow in the footsteps of X11...
|
||||
The names of the keys
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
/* The keyboard syms have been cleverly chosen to map to ASCII */
|
||||
SDLK_UNKNOWN = 0,
|
||||
SDLK_FIRST = 0,
|
||||
SDLK_BACKSPACE = 8,
|
||||
SDLK_TAB = 9,
|
||||
SDLK_CLEAR = 12,
|
||||
SDLK_RETURN = 13,
|
||||
SDLK_PAUSE = 19,
|
||||
SDLK_ESCAPE = 27,
|
||||
SDLK_SPACE = 32,
|
||||
SDLK_EXCLAIM = 33,
|
||||
SDLK_QUOTEDBL = 34,
|
||||
SDLK_HASH = 35,
|
||||
SDLK_DOLLAR = 36,
|
||||
SDLK_AMPERSAND = 38,
|
||||
SDLK_QUOTE = 39,
|
||||
SDLK_LEFTPAREN = 40,
|
||||
SDLK_RIGHTPAREN = 41,
|
||||
SDLK_ASTERISK = 42,
|
||||
SDLK_PLUS = 43,
|
||||
SDLK_COMMA = 44,
|
||||
SDLK_MINUS = 45,
|
||||
SDLK_PERIOD = 46,
|
||||
SDLK_SLASH = 47,
|
||||
SDLK_0 = 48,
|
||||
SDLK_1 = 49,
|
||||
SDLK_2 = 50,
|
||||
SDLK_3 = 51,
|
||||
SDLK_4 = 52,
|
||||
SDLK_5 = 53,
|
||||
SDLK_6 = 54,
|
||||
SDLK_7 = 55,
|
||||
SDLK_8 = 56,
|
||||
SDLK_9 = 57,
|
||||
SDLK_COLON = 58,
|
||||
SDLK_SEMICOLON = 59,
|
||||
SDLK_LESS = 60,
|
||||
SDLK_EQUALS = 61,
|
||||
SDLK_GREATER = 62,
|
||||
SDLK_QUESTION = 63,
|
||||
SDLK_AT = 64,
|
||||
/*
|
||||
Skip uppercase letters
|
||||
*/
|
||||
SDLK_LEFTBRACKET = 91,
|
||||
SDLK_BACKSLASH = 92,
|
||||
SDLK_RIGHTBRACKET = 93,
|
||||
SDLK_CARET = 94,
|
||||
SDLK_UNDERSCORE = 95,
|
||||
SDLK_BACKQUOTE = 96,
|
||||
SDLK_a = 97,
|
||||
SDLK_b = 98,
|
||||
SDLK_c = 99,
|
||||
SDLK_d = 100,
|
||||
SDLK_e = 101,
|
||||
SDLK_f = 102,
|
||||
SDLK_g = 103,
|
||||
SDLK_h = 104,
|
||||
SDLK_i = 105,
|
||||
SDLK_j = 106,
|
||||
SDLK_k = 107,
|
||||
SDLK_l = 108,
|
||||
SDLK_m = 109,
|
||||
SDLK_n = 110,
|
||||
SDLK_o = 111,
|
||||
SDLK_p = 112,
|
||||
SDLK_q = 113,
|
||||
SDLK_r = 114,
|
||||
SDLK_s = 115,
|
||||
SDLK_t = 116,
|
||||
SDLK_u = 117,
|
||||
SDLK_v = 118,
|
||||
SDLK_w = 119,
|
||||
SDLK_x = 120,
|
||||
SDLK_y = 121,
|
||||
SDLK_z = 122,
|
||||
SDLK_DELETE = 127,
|
||||
/* End of ASCII mapped keysyms */
|
||||
|
||||
/* International keyboard syms */
|
||||
SDLK_WORLD_0 = 160, /* 0xA0 */
|
||||
SDLK_WORLD_1 = 161,
|
||||
SDLK_WORLD_2 = 162,
|
||||
SDLK_WORLD_3 = 163,
|
||||
SDLK_WORLD_4 = 164,
|
||||
SDLK_WORLD_5 = 165,
|
||||
SDLK_WORLD_6 = 166,
|
||||
SDLK_WORLD_7 = 167,
|
||||
SDLK_WORLD_8 = 168,
|
||||
SDLK_WORLD_9 = 169,
|
||||
SDLK_WORLD_10 = 170,
|
||||
SDLK_WORLD_11 = 171,
|
||||
SDLK_WORLD_12 = 172,
|
||||
SDLK_WORLD_13 = 173,
|
||||
SDLK_WORLD_14 = 174,
|
||||
SDLK_WORLD_15 = 175,
|
||||
SDLK_WORLD_16 = 176,
|
||||
SDLK_WORLD_17 = 177,
|
||||
SDLK_WORLD_18 = 178,
|
||||
SDLK_WORLD_19 = 179,
|
||||
SDLK_WORLD_20 = 180,
|
||||
SDLK_WORLD_21 = 181,
|
||||
SDLK_WORLD_22 = 182,
|
||||
SDLK_WORLD_23 = 183,
|
||||
SDLK_WORLD_24 = 184,
|
||||
SDLK_WORLD_25 = 185,
|
||||
SDLK_WORLD_26 = 186,
|
||||
SDLK_WORLD_27 = 187,
|
||||
SDLK_WORLD_28 = 188,
|
||||
SDLK_WORLD_29 = 189,
|
||||
SDLK_WORLD_30 = 190,
|
||||
SDLK_WORLD_31 = 191,
|
||||
SDLK_WORLD_32 = 192,
|
||||
SDLK_WORLD_33 = 193,
|
||||
SDLK_WORLD_34 = 194,
|
||||
SDLK_WORLD_35 = 195,
|
||||
SDLK_WORLD_36 = 196,
|
||||
SDLK_WORLD_37 = 197,
|
||||
SDLK_WORLD_38 = 198,
|
||||
SDLK_WORLD_39 = 199,
|
||||
SDLK_WORLD_40 = 200,
|
||||
SDLK_WORLD_41 = 201,
|
||||
SDLK_WORLD_42 = 202,
|
||||
SDLK_WORLD_43 = 203,
|
||||
SDLK_WORLD_44 = 204,
|
||||
SDLK_WORLD_45 = 205,
|
||||
SDLK_WORLD_46 = 206,
|
||||
SDLK_WORLD_47 = 207,
|
||||
SDLK_WORLD_48 = 208,
|
||||
SDLK_WORLD_49 = 209,
|
||||
SDLK_WORLD_50 = 210,
|
||||
SDLK_WORLD_51 = 211,
|
||||
SDLK_WORLD_52 = 212,
|
||||
SDLK_WORLD_53 = 213,
|
||||
SDLK_WORLD_54 = 214,
|
||||
SDLK_WORLD_55 = 215,
|
||||
SDLK_WORLD_56 = 216,
|
||||
SDLK_WORLD_57 = 217,
|
||||
SDLK_WORLD_58 = 218,
|
||||
SDLK_WORLD_59 = 219,
|
||||
SDLK_WORLD_60 = 220,
|
||||
SDLK_WORLD_61 = 221,
|
||||
SDLK_WORLD_62 = 222,
|
||||
SDLK_WORLD_63 = 223,
|
||||
SDLK_WORLD_64 = 224,
|
||||
SDLK_WORLD_65 = 225,
|
||||
SDLK_WORLD_66 = 226,
|
||||
SDLK_WORLD_67 = 227,
|
||||
SDLK_WORLD_68 = 228,
|
||||
SDLK_WORLD_69 = 229,
|
||||
SDLK_WORLD_70 = 230,
|
||||
SDLK_WORLD_71 = 231,
|
||||
SDLK_WORLD_72 = 232,
|
||||
SDLK_WORLD_73 = 233,
|
||||
SDLK_WORLD_74 = 234,
|
||||
SDLK_WORLD_75 = 235,
|
||||
SDLK_WORLD_76 = 236,
|
||||
SDLK_WORLD_77 = 237,
|
||||
SDLK_WORLD_78 = 238,
|
||||
SDLK_WORLD_79 = 239,
|
||||
SDLK_WORLD_80 = 240,
|
||||
SDLK_WORLD_81 = 241,
|
||||
SDLK_WORLD_82 = 242,
|
||||
SDLK_WORLD_83 = 243,
|
||||
SDLK_WORLD_84 = 244,
|
||||
SDLK_WORLD_85 = 245,
|
||||
SDLK_WORLD_86 = 246,
|
||||
SDLK_WORLD_87 = 247,
|
||||
SDLK_WORLD_88 = 248,
|
||||
SDLK_WORLD_89 = 249,
|
||||
SDLK_WORLD_90 = 250,
|
||||
SDLK_WORLD_91 = 251,
|
||||
SDLK_WORLD_92 = 252,
|
||||
SDLK_WORLD_93 = 253,
|
||||
SDLK_WORLD_94 = 254,
|
||||
SDLK_WORLD_95 = 255, /* 0xFF */
|
||||
|
||||
/* Numeric keypad */
|
||||
SDLK_KP0 = 256,
|
||||
SDLK_KP1 = 257,
|
||||
SDLK_KP2 = 258,
|
||||
SDLK_KP3 = 259,
|
||||
SDLK_KP4 = 260,
|
||||
SDLK_KP5 = 261,
|
||||
SDLK_KP6 = 262,
|
||||
SDLK_KP7 = 263,
|
||||
SDLK_KP8 = 264,
|
||||
SDLK_KP9 = 265,
|
||||
SDLK_KP_PERIOD = 266,
|
||||
SDLK_KP_DIVIDE = 267,
|
||||
SDLK_KP_MULTIPLY = 268,
|
||||
SDLK_KP_MINUS = 269,
|
||||
SDLK_KP_PLUS = 270,
|
||||
SDLK_KP_ENTER = 271,
|
||||
SDLK_KP_EQUALS = 272,
|
||||
|
||||
/* Arrows + Home/End pad */
|
||||
SDLK_UP = 273,
|
||||
SDLK_DOWN = 274,
|
||||
SDLK_RIGHT = 275,
|
||||
SDLK_LEFT = 276,
|
||||
SDLK_INSERT = 277,
|
||||
SDLK_HOME = 278,
|
||||
SDLK_END = 279,
|
||||
SDLK_PAGEUP = 280,
|
||||
SDLK_PAGEDOWN = 281,
|
||||
|
||||
/* Function keys */
|
||||
SDLK_F1 = 282,
|
||||
SDLK_F2 = 283,
|
||||
SDLK_F3 = 284,
|
||||
SDLK_F4 = 285,
|
||||
SDLK_F5 = 286,
|
||||
SDLK_F6 = 287,
|
||||
SDLK_F7 = 288,
|
||||
SDLK_F8 = 289,
|
||||
SDLK_F9 = 290,
|
||||
SDLK_F10 = 291,
|
||||
SDLK_F11 = 292,
|
||||
SDLK_F12 = 293,
|
||||
SDLK_F13 = 294,
|
||||
SDLK_F14 = 295,
|
||||
SDLK_F15 = 296,
|
||||
|
||||
/* Key state modifier keys */
|
||||
SDLK_NUMLOCK = 300,
|
||||
SDLK_CAPSLOCK = 301,
|
||||
SDLK_SCROLLOCK = 302,
|
||||
SDLK_RSHIFT = 303,
|
||||
SDLK_LSHIFT = 304,
|
||||
SDLK_RCTRL = 305,
|
||||
SDLK_LCTRL = 306,
|
||||
SDLK_RALT = 307,
|
||||
SDLK_LALT = 308,
|
||||
SDLK_RMETA = 309,
|
||||
SDLK_LMETA = 310,
|
||||
SDLK_LSUPER = 311, /* Left "Windows" key */
|
||||
SDLK_RSUPER = 312, /* Right "Windows" key */
|
||||
SDLK_MODE = 313, /* "Alt Gr" key */
|
||||
SDLK_COMPOSE = 314, /* Multi-key compose key */
|
||||
|
||||
/* Miscellaneous function keys */
|
||||
SDLK_HELP = 315,
|
||||
SDLK_PRINT = 316,
|
||||
SDLK_SYSREQ = 317,
|
||||
SDLK_BREAK = 318,
|
||||
SDLK_MENU = 319,
|
||||
SDLK_POWER = 320, /* Power Macintosh power key */
|
||||
SDLK_EURO = 321, /* Some european keyboards */
|
||||
SDLK_UNDO = 322, /* Atari keyboard has Undo */
|
||||
|
||||
/* Add any other keys here */
|
||||
|
||||
SDLK_LAST
|
||||
} SDLKey;
|
||||
|
||||
/* Enumeration of valid key mods (possibly OR'd together) */
|
||||
typedef enum {
|
||||
KMOD_NONE = 0x0000,
|
||||
KMOD_LSHIFT= 0x0001,
|
||||
KMOD_RSHIFT= 0x0002,
|
||||
KMOD_LCTRL = 0x0040,
|
||||
KMOD_RCTRL = 0x0080,
|
||||
KMOD_LALT = 0x0100,
|
||||
KMOD_RALT = 0x0200,
|
||||
KMOD_LMETA = 0x0400,
|
||||
KMOD_RMETA = 0x0800,
|
||||
KMOD_NUM = 0x1000,
|
||||
KMOD_CAPS = 0x2000,
|
||||
KMOD_MODE = 0x4000,
|
||||
KMOD_RESERVED = 0x8000
|
||||
} SDLMod;
|
||||
|
||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
||||
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
|
||||
|
||||
#endif /* _SDL_keysym_h */
|
74
build/linux/libs/sdl-1.2.13/include/SDL_loadso.h
Normal file
74
build/linux/libs/sdl-1.2.13/include/SDL_loadso.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent library loading routines */
|
||||
|
||||
/* Some things to keep in mind:
|
||||
- These functions only work on C function names. Other languages may
|
||||
have name mangling and intrinsic language support that varies from
|
||||
compiler to compiler.
|
||||
- Make sure you declare your function pointers with the same calling
|
||||
convention as the actual library function. Your code will crash
|
||||
mysteriously if you do not do this.
|
||||
- Avoid namespace collisions. If you load a symbol from the library,
|
||||
it is not defined whether or not it goes into the global symbol
|
||||
namespace for the application. If it does and it conflicts with
|
||||
symbols in your code or other shared libraries, you will not get
|
||||
the results you expect. :)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SDL_loadso_h
|
||||
#define _SDL_loadso_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This function dynamically loads a shared object and returns a pointer
|
||||
* to the object handle (or NULL if there was an error).
|
||||
* The 'sofile' parameter is a system dependent name of the object file.
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
|
||||
|
||||
/* Given an object handle, this function looks up the address of the
|
||||
* named function in the shared object and returns it. This address
|
||||
* is no longer valid after calling SDL_UnloadObject().
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
|
||||
|
||||
/* Unload a shared object from memory */
|
||||
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_loadso_h */
|
98
build/linux/libs/sdl-1.2.13/include/SDL_main.h
Normal file
98
build/linux/libs/sdl-1.2.13/include/SDL_main.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_main_h
|
||||
#define _SDL_main_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
|
||||
|
||||
#if defined(__WIN32__) || \
|
||||
(defined(__MWERKS__) && !defined(__BEOS__)) || \
|
||||
defined(__MACOS__) || defined(__MACOSX__) || \
|
||||
defined(__SYMBIAN32__) || defined(QWS)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define C_LINKAGE "C"
|
||||
#else
|
||||
#define C_LINKAGE
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* The application's main() function must be called with C linkage,
|
||||
and should be declared like this:
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
}
|
||||
*/
|
||||
#define main SDL_main
|
||||
|
||||
/* The prototype for the application's main() function */
|
||||
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
/* From the SDL library code -- needed for registering the app on Win32 */
|
||||
#ifdef __WIN32__
|
||||
|
||||
#include "begin_code.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This should be called from your WinMain() function, if any */
|
||||
extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
|
||||
/* This can also be called, but is no longer necessary */
|
||||
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
|
||||
/* This can also be called, but is no longer necessary (SDL_Quit calls it) */
|
||||
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
#endif
|
||||
|
||||
/* From the SDL library code -- needed for registering QuickDraw on MacOS */
|
||||
#if defined(__MACOS__)
|
||||
|
||||
#include "begin_code.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Forward declaration so we don't need to include QuickDraw.h */
|
||||
struct QDGlobals;
|
||||
|
||||
/* This should be called from your main() function, if any */
|
||||
extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
#endif
|
||||
|
||||
#endif /* Need to redefine main()? */
|
||||
|
||||
#endif /* _SDL_main_h */
|
140
build/linux/libs/sdl-1.2.13/include/SDL_mouse.h
Normal file
140
build/linux/libs/sdl-1.2.13/include/SDL_mouse.h
Normal file
@ -0,0 +1,140 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL mouse event handling */
|
||||
|
||||
#ifndef _SDL_mouse_h
|
||||
#define _SDL_mouse_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_video.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct WMcursor WMcursor; /* Implementation dependent */
|
||||
typedef struct SDL_Cursor {
|
||||
SDL_Rect area; /* The area of the mouse cursor */
|
||||
Sint16 hot_x, hot_y; /* The "tip" of the cursor */
|
||||
Uint8 *data; /* B/W cursor data */
|
||||
Uint8 *mask; /* B/W cursor mask */
|
||||
Uint8 *save[2]; /* Place to save cursor area */
|
||||
WMcursor *wm_cursor; /* Window-manager cursor */
|
||||
} SDL_Cursor;
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* Retrieve the current state of the mouse.
|
||||
* The current button state is returned as a button bitmask, which can
|
||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
||||
* current mouse cursor position. You can pass NULL for either x or y.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
|
||||
|
||||
/*
|
||||
* Retrieve the current state of the mouse.
|
||||
* The current button state is returned as a button bitmask, which can
|
||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
||||
* mouse deltas since the last call to SDL_GetRelativeMouseState().
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
||||
|
||||
/*
|
||||
* Set the position of the mouse cursor (generates a mouse motion event)
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
|
||||
|
||||
/*
|
||||
* Create a cursor using the specified data and mask (in MSB format).
|
||||
* The cursor width must be a multiple of 8 bits.
|
||||
*
|
||||
* The cursor is created in black and white according to the following:
|
||||
* data mask resulting pixel on screen
|
||||
* 0 1 White
|
||||
* 1 1 Black
|
||||
* 0 0 Transparent
|
||||
* 1 0 Inverted color if possible, black if not.
|
||||
*
|
||||
* Cursors created with this function must be freed with SDL_FreeCursor().
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
|
||||
(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
|
||||
|
||||
/*
|
||||
* Set the currently active cursor to the specified one.
|
||||
* If the cursor is currently visible, the change will be immediately
|
||||
* represented on the display.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
|
||||
|
||||
/*
|
||||
* Returns the currently active cursor.
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
|
||||
|
||||
/*
|
||||
* Deallocates a cursor created with SDL_CreateCursor().
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
|
||||
|
||||
/*
|
||||
* Toggle whether or not the cursor is shown on the screen.
|
||||
* The cursor start off displayed, but can be turned off.
|
||||
* SDL_ShowCursor() returns 1 if the cursor was being displayed
|
||||
* before the call, or 0 if it was not. You can query the current
|
||||
* state by passing a 'toggle' value of -1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
||||
|
||||
/* Used as a mask when testing buttons in buttonstate
|
||||
Button 1: Left mouse button
|
||||
Button 2: Middle mouse button
|
||||
Button 3: Right mouse button
|
||||
Button 4: Mouse wheel up (may also be a real button)
|
||||
Button 5: Mouse wheel down (may also be a real button)
|
||||
*/
|
||||
#define SDL_BUTTON(X) (1 << ((X)-1))
|
||||
#define SDL_BUTTON_LEFT 1
|
||||
#define SDL_BUTTON_MIDDLE 2
|
||||
#define SDL_BUTTON_RIGHT 3
|
||||
#define SDL_BUTTON_WHEELUP 4
|
||||
#define SDL_BUTTON_WHEELDOWN 5
|
||||
#define SDL_BUTTON_X1 6
|
||||
#define SDL_BUTTON_X2 7
|
||||
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
||||
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
||||
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
||||
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
|
||||
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_mouse_h */
|
162
build/linux/libs/sdl-1.2.13/include/SDL_mutex.h
Normal file
162
build/linux/libs/sdl-1.2.13/include/SDL_mutex.h
Normal file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_mutex_h
|
||||
#define _SDL_mutex_h
|
||||
|
||||
/* Functions to provide thread synchronization primitives
|
||||
|
||||
These are independent of the other SDL routines.
|
||||
*/
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Synchronization functions which can time out return this value
|
||||
if they time out.
|
||||
*/
|
||||
#define SDL_MUTEX_TIMEDOUT 1
|
||||
|
||||
/* This is the timeout value which corresponds to never time out */
|
||||
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* Mutex functions */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* The SDL mutex structure, defined in SDL_mutex.c */
|
||||
struct SDL_mutex;
|
||||
typedef struct SDL_mutex SDL_mutex;
|
||||
|
||||
/* Create a mutex, initialized unlocked */
|
||||
extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
|
||||
|
||||
/* Lock the mutex (Returns 0, or -1 on error) */
|
||||
#define SDL_LockMutex(m) SDL_mutexP(m)
|
||||
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
|
||||
|
||||
/* Unlock the mutex (Returns 0, or -1 on error)
|
||||
It is an error to unlock a mutex that has not been locked by
|
||||
the current thread, and doing so results in undefined behavior.
|
||||
*/
|
||||
#define SDL_UnlockMutex(m) SDL_mutexV(m)
|
||||
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
|
||||
|
||||
/* Destroy a mutex */
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* Semaphore functions */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* The SDL semaphore structure, defined in SDL_sem.c */
|
||||
struct SDL_semaphore;
|
||||
typedef struct SDL_semaphore SDL_sem;
|
||||
|
||||
/* Create a semaphore, initialized with value, returns NULL on failure. */
|
||||
extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
|
||||
|
||||
/* Destroy a semaphore */
|
||||
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
|
||||
|
||||
/* This function suspends the calling thread until the semaphore pointed
|
||||
* to by sem has a positive count. It then atomically decreases the semaphore
|
||||
* count.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
|
||||
|
||||
/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds,
|
||||
SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
|
||||
|
||||
/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
|
||||
the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
|
||||
the allotted time, and -1 on error.
|
||||
On some platforms this function is implemented by looping with a delay
|
||||
of 1 ms, and so should be avoided if possible.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
|
||||
|
||||
/* Atomically increases the semaphore's count (not blocking), returns 0,
|
||||
or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
|
||||
|
||||
/* Returns the current count of the semaphore */
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* Condition variable functions */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* The SDL condition variable structure, defined in SDL_cond.c */
|
||||
struct SDL_cond;
|
||||
typedef struct SDL_cond SDL_cond;
|
||||
|
||||
/* Create a condition variable */
|
||||
extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
|
||||
|
||||
/* Destroy a condition variable */
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
|
||||
|
||||
/* Restart one of the threads that are waiting on the condition variable,
|
||||
returns 0 or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
|
||||
|
||||
/* Restart all threads that are waiting on the condition variable,
|
||||
returns 0 or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
|
||||
|
||||
/* Wait on the condition variable, unlocking the provided mutex.
|
||||
The mutex must be locked before entering this function!
|
||||
The mutex is re-locked once the condition variable is signaled.
|
||||
Returns 0 when it is signaled, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
|
||||
|
||||
/* Waits for at most 'ms' milliseconds, and returns 0 if the condition
|
||||
variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
|
||||
signaled in the allotted time, and -1 on error.
|
||||
On some platforms this function is implemented by looping with a delay
|
||||
of 1 ms, and so should be avoided if possible.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_mutex_h */
|
11
build/linux/libs/sdl-1.2.13/include/SDL_name.h
Normal file
11
build/linux/libs/sdl-1.2.13/include/SDL_name.h
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
#ifndef _SDLname_h_
|
||||
#define _SDLname_h_
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define NeedFunctionPrototypes 1
|
||||
#endif
|
||||
|
||||
#define SDL_NAME(X) SDL_##X
|
||||
|
||||
#endif /* _SDLname_h_ */
|
6551
build/linux/libs/sdl-1.2.13/include/SDL_opengl.h
Normal file
6551
build/linux/libs/sdl-1.2.13/include/SDL_opengl.h
Normal file
File diff suppressed because it is too large
Load Diff
100
build/linux/libs/sdl-1.2.13/include/SDL_platform.h
Normal file
100
build/linux/libs/sdl-1.2.13/include/SDL_platform.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Try to get a standard set of platform defines */
|
||||
|
||||
#ifndef _SDL_platform_h
|
||||
#define _SDL_platform_h
|
||||
|
||||
#if defined(_AIX)
|
||||
#undef __AIX__
|
||||
#define __AIX__ 1
|
||||
#endif
|
||||
#if defined(__BEOS__)
|
||||
#undef __BEOS__
|
||||
#define __BEOS__ 1
|
||||
#endif
|
||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
||||
#undef __BSDI__
|
||||
#define __BSDI__ 1
|
||||
#endif
|
||||
#if defined(_arch_dreamcast)
|
||||
#undef __DREAMCAST__
|
||||
#define __DREAMCAST__ 1
|
||||
#endif
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#undef __FREEBSD__
|
||||
#define __FREEBSD__ 1
|
||||
#endif
|
||||
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
|
||||
#undef __HPUX__
|
||||
#define __HPUX__ 1
|
||||
#endif
|
||||
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
|
||||
#undef __IRIX__
|
||||
#define __IRIX__ 1
|
||||
#endif
|
||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||
#undef __LINUX__
|
||||
#define __LINUX__ 1
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
#undef __MACOSX__
|
||||
#define __MACOSX__ 1
|
||||
#elif defined(macintosh)
|
||||
#undef __MACOS__
|
||||
#define __MACOS__ 1
|
||||
#endif
|
||||
#if defined(__NetBSD__)
|
||||
#undef __NETBSD__
|
||||
#define __NETBSD__ 1
|
||||
#endif
|
||||
#if defined(__OpenBSD__)
|
||||
#undef __OPENBSD__
|
||||
#define __OPENBSD__ 1
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
#undef __OS2__
|
||||
#define __OS2__ 1
|
||||
#endif
|
||||
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
|
||||
#undef __OSF__
|
||||
#define __OSF__ 1
|
||||
#endif
|
||||
#if defined(__QNXNTO__)
|
||||
#undef __QNXNTO__
|
||||
#define __QNXNTO__ 1
|
||||
#endif
|
||||
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
|
||||
#undef __RISCOS__
|
||||
#define __RISCOS__ 1
|
||||
#endif
|
||||
#if defined(__SVR4)
|
||||
#undef __SOLARIS__
|
||||
#define __SOLARIS__ 1
|
||||
#endif
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#undef __WIN32__
|
||||
#define __WIN32__ 1
|
||||
#endif
|
||||
|
||||
#endif /* _SDL_platform_h */
|
50
build/linux/libs/sdl-1.2.13/include/SDL_quit.h
Normal file
50
build/linux/libs/sdl-1.2.13/include/SDL_quit.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL quit event handling */
|
||||
|
||||
#ifndef _SDL_quit_h
|
||||
#define _SDL_quit_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
/*
|
||||
An SDL_QUITEVENT is generated when the user tries to close the application
|
||||
window. If it is ignored or filtered out, the window will remain open.
|
||||
If it is not ignored or filtered, it is queued normally and the window
|
||||
is allowed to close. When the window is closed, screen updates will
|
||||
complete, but have no effect.
|
||||
|
||||
SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
|
||||
and SIGTERM (system termination request), if handlers do not already
|
||||
exist, that generate SDL_QUITEVENT events as well. There is no way
|
||||
to determine the cause of an SDL_QUITEVENT, but setting a signal
|
||||
handler in your application will override the default generation of
|
||||
quit events for that signal.
|
||||
*/
|
||||
|
||||
/* There are no functions directly affecting the quit event */
|
||||
#define SDL_QuitRequested() \
|
||||
(SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
|
||||
|
||||
#endif /* _SDL_quit_h */
|
144
build/linux/libs/sdl-1.2.13/include/SDL_rwops.h
Normal file
144
build/linux/libs/sdl-1.2.13/include/SDL_rwops.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This file provides a general interface for SDL to read and write
|
||||
data sources. It can easily be extended to files, memory, etc.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_rwops_h
|
||||
#define _SDL_rwops_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is the read/write operation structure -- very basic */
|
||||
|
||||
typedef struct SDL_RWops {
|
||||
/* Seek to 'offset' relative to whence, one of stdio's whence values:
|
||||
SEEK_SET, SEEK_CUR, SEEK_END
|
||||
Returns the final offset in the data source.
|
||||
*/
|
||||
int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence);
|
||||
|
||||
/* Read up to 'num' objects each of size 'objsize' from the data
|
||||
source to the area pointed at by 'ptr'.
|
||||
Returns the number of objects read, or -1 if the read failed.
|
||||
*/
|
||||
int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
|
||||
|
||||
/* Write exactly 'num' objects each of size 'objsize' from the area
|
||||
pointed at by 'ptr' to data source.
|
||||
Returns 'num', or -1 if the write failed.
|
||||
*/
|
||||
int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
|
||||
|
||||
/* Close and free an allocated SDL_FSops structure */
|
||||
int (SDLCALL *close)(struct SDL_RWops *context);
|
||||
|
||||
Uint32 type;
|
||||
union {
|
||||
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
|
||||
struct {
|
||||
int append;
|
||||
void *h;
|
||||
struct {
|
||||
void *data;
|
||||
int size;
|
||||
int left;
|
||||
} buffer;
|
||||
} win32io;
|
||||
#endif
|
||||
#ifdef HAVE_STDIO_H
|
||||
struct {
|
||||
int autoclose;
|
||||
FILE *fp;
|
||||
} stdio;
|
||||
#endif
|
||||
struct {
|
||||
Uint8 *base;
|
||||
Uint8 *here;
|
||||
Uint8 *stop;
|
||||
} mem;
|
||||
struct {
|
||||
void *data1;
|
||||
} unknown;
|
||||
} hidden;
|
||||
|
||||
} SDL_RWops;
|
||||
|
||||
|
||||
/* Functions to create SDL_RWops structures from various data sources */
|
||||
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
|
||||
#endif
|
||||
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
|
||||
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
|
||||
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
|
||||
|
||||
#define RW_SEEK_SET 0 /* Seek from the beginning of data */
|
||||
#define RW_SEEK_CUR 1 /* Seek relative to current read point */
|
||||
#define RW_SEEK_END 2 /* Seek relative to the end of data */
|
||||
|
||||
/* Macros to easily read and write from an SDL_RWops structure */
|
||||
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
|
||||
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
|
||||
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
|
||||
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
|
||||
#define SDL_RWclose(ctx) (ctx)->close(ctx)
|
||||
|
||||
|
||||
/* Read an item of the specified endianness and return in native format */
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
|
||||
|
||||
/* Write an item of native format to the specified endianness */
|
||||
extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_rwops_h */
|
596
build/linux/libs/sdl-1.2.13/include/SDL_stdinc.h
Normal file
596
build/linux/libs/sdl-1.2.13/include/SDL_stdinc.h
Normal file
@ -0,0 +1,596 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This is a general header that includes C language support */
|
||||
|
||||
#ifndef _SDL_stdinc_h
|
||||
#define _SDL_stdinc_h
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if defined(STDC_HEADERS)
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# if defined(HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
# elif defined(HAVE_MALLOC_H)
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
# if defined(HAVE_STDDEF_H)
|
||||
# include <stddef.h>
|
||||
# endif
|
||||
# if defined(HAVE_STDARG_H)
|
||||
# include <stdarg.h>
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#if defined(HAVE_INTTYPES_H)
|
||||
# include <inttypes.h>
|
||||
#elif defined(HAVE_STDINT_H)
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_CTYPE_H
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
#ifdef HAVE_ICONV_H
|
||||
# include <iconv.h>
|
||||
#endif
|
||||
|
||||
/* The number of elements in an array */
|
||||
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
|
||||
#define SDL_TABLESIZE(table) SDL_arraysize(table)
|
||||
|
||||
/* Basic data types */
|
||||
typedef enum SDL_bool {
|
||||
SDL_FALSE = 0,
|
||||
SDL_TRUE = 1
|
||||
} SDL_bool;
|
||||
|
||||
typedef int8_t Sint8;
|
||||
typedef uint8_t Uint8;
|
||||
typedef int16_t Sint16;
|
||||
typedef uint16_t Uint16;
|
||||
typedef int32_t Sint32;
|
||||
typedef uint32_t Uint32;
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
typedef int64_t Sint64;
|
||||
#ifndef SYMBIAN32_GCCE
|
||||
typedef uint64_t Uint64;
|
||||
#endif
|
||||
#else
|
||||
/* This is really just a hack to prevent the compiler from complaining */
|
||||
typedef struct {
|
||||
Uint32 hi;
|
||||
Uint32 lo;
|
||||
} Uint64, Sint64;
|
||||
#endif
|
||||
|
||||
/* Make sure the types really have the right sizes */
|
||||
#define SDL_COMPILE_TIME_ASSERT(name, x) \
|
||||
typedef int SDL_dummy_ ## name[(x) * 2 - 1]
|
||||
|
||||
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
|
||||
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
|
||||
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
|
||||
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
|
||||
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
|
||||
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
|
||||
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
|
||||
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
||||
|
||||
/* Check to make sure enums are the size of ints, for structure packing.
|
||||
For both Watcom C/C++ and Borland C/C++ the compiler option that makes
|
||||
enums having the size of an int must be enabled.
|
||||
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
|
||||
*/
|
||||
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
|
||||
#ifdef __MWERKS__
|
||||
#pragma enumsalwaysint on
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
DUMMY_ENUM_VALUE
|
||||
} SDL_DUMMY_ENUM;
|
||||
|
||||
#ifndef __NDS__
|
||||
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
|
||||
#endif
|
||||
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC
|
||||
#define SDL_malloc malloc
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_malloc(size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CALLOC
|
||||
#define SDL_calloc calloc
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REALLOC
|
||||
#define SDL_realloc realloc
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FREE
|
||||
#define SDL_free free
|
||||
#else
|
||||
extern DECLSPEC void SDLCALL SDL_free(void *mem);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ALLOCA) && !defined(alloca)
|
||||
# if defined(HAVE_ALLOCA_H)
|
||||
# include <alloca.h>
|
||||
# elif defined(__GNUC__)
|
||||
# define alloca __builtin_alloca
|
||||
# elif defined(_MSC_VER)
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# elif defined(__WATCOMC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__BORLANDC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__DMC__)
|
||||
# include <stdlib.h>
|
||||
# elif defined(__AIX__)
|
||||
#pragma alloca
|
||||
# elif defined(__MRC__)
|
||||
void *alloca (unsigned);
|
||||
# else
|
||||
char *alloca ();
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_ALLOCA
|
||||
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
|
||||
#define SDL_stack_free(data)
|
||||
#else
|
||||
#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
|
||||
#define SDL_stack_free(data) SDL_free(data)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETENV
|
||||
#define SDL_getenv getenv
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PUTENV
|
||||
#define SDL_putenv putenv
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QSORT
|
||||
#define SDL_qsort qsort
|
||||
#else
|
||||
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
|
||||
int (*compare)(const void *, const void *));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ABS
|
||||
#define SDL_abs abs
|
||||
#else
|
||||
#define SDL_abs(X) ((X) < 0 ? -(X) : (X))
|
||||
#endif
|
||||
|
||||
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#define SDL_isdigit(X) isdigit(X)
|
||||
#define SDL_isspace(X) isspace(X)
|
||||
#define SDL_toupper(X) toupper(X)
|
||||
#define SDL_tolower(X) tolower(X)
|
||||
#else
|
||||
#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
|
||||
#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
|
||||
#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
|
||||
#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMSET
|
||||
#define SDL_memset memset
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memset4(dst, val, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; stosl\n\t" \
|
||||
: "=&D" (u0), "=&a" (u1), "=&c" (u2) \
|
||||
: "0" (dst), "1" (val), "2" ((Uint32)(len)) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memset4
|
||||
#define SDL_memset4(dst, val, len) \
|
||||
do { \
|
||||
unsigned _count = (len); \
|
||||
unsigned _n = (_count + 3) / 4; \
|
||||
Uint32 *_p = (Uint32 *)(dst); \
|
||||
Uint32 _val = (val); \
|
||||
switch (_count % 4) { \
|
||||
case 0: do { *_p++ = _val; \
|
||||
case 3: *_p++ = _val; \
|
||||
case 2: *_p++ = _val; \
|
||||
case 1: *_p++ = _val; \
|
||||
} while ( --_n ); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memcpy(dst, src, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; movsl\n\t" \
|
||||
"testb $2,%b4\n\t" \
|
||||
"je 1f\n\t" \
|
||||
"movsw\n" \
|
||||
"1:\ttestb $1,%b4\n\t" \
|
||||
"je 2f\n\t" \
|
||||
"movsb\n" \
|
||||
"2:" \
|
||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
|
||||
: "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memcpy
|
||||
#ifdef HAVE_MEMCPY
|
||||
#define SDL_memcpy memcpy
|
||||
#elif defined(HAVE_BCOPY)
|
||||
#define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memcpy4(dst, src, len) \
|
||||
do { \
|
||||
int ecx, edi, esi; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; movsl" \
|
||||
: "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
|
||||
: "0" ((unsigned)(len)), "1" (dst), "2" (src) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memcpy4
|
||||
#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
#define SDL_revcpy(dst, src, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
char *dstp = (char *)(dst); \
|
||||
char *srcp = (char *)(src); \
|
||||
int n = (len); \
|
||||
if ( n >= 4 ) { \
|
||||
__asm__ __volatile__ ( \
|
||||
"std\n\t" \
|
||||
"rep ; movsl\n\t" \
|
||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
|
||||
: "0" (n >> 2), \
|
||||
"1" (dstp+(n-4)), "2" (srcp+(n-4)) \
|
||||
: "memory" ); \
|
||||
} \
|
||||
switch (n & 3) { \
|
||||
case 3: dstp[2] = srcp[2]; \
|
||||
case 2: dstp[1] = srcp[1]; \
|
||||
case 1: dstp[0] = srcp[0]; \
|
||||
break; \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_revcpy
|
||||
extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMMOVE
|
||||
#define SDL_memmove memmove
|
||||
#elif defined(HAVE_BCOPY)
|
||||
#define SDL_memmove(d, s, n) bcopy((s), (d), (n))
|
||||
#else
|
||||
#define SDL_memmove(dst, src, len) \
|
||||
do { \
|
||||
if ( dst < src ) { \
|
||||
SDL_memcpy(dst, src, len); \
|
||||
} else { \
|
||||
SDL_revcpy(dst, src, len); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMCMP
|
||||
#define SDL_memcmp memcmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRLEN
|
||||
#define SDL_strlen strlen
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRLCPY
|
||||
#define SDL_strlcpy strlcpy
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRLCAT
|
||||
#define SDL_strlcat strlcat
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRDUP
|
||||
#define SDL_strdup strdup
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strdup(const char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__STRREV
|
||||
#define SDL_strrev _strrev
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strrev(char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__STRUPR
|
||||
#define SDL_strupr _strupr
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strupr(char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__STRLWR
|
||||
#define SDL_strlwr _strlwr
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strlwr(char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCHR
|
||||
#define SDL_strchr strchr
|
||||
#elif defined(HAVE_INDEX)
|
||||
#define SDL_strchr index
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRRCHR
|
||||
#define SDL_strrchr strrchr
|
||||
#elif defined(HAVE_RINDEX)
|
||||
#define SDL_strrchr rindex
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRSTR
|
||||
#define SDL_strstr strstr
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ITOA
|
||||
#define SDL_itoa itoa
|
||||
#else
|
||||
#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__LTOA
|
||||
#define SDL_ltoa _ltoa
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__UITOA
|
||||
#define SDL_uitoa _uitoa
|
||||
#else
|
||||
#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__ULTOA
|
||||
#define SDL_ultoa _ultoa
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRTOL
|
||||
#define SDL_strtol strtol
|
||||
#else
|
||||
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRTOUL
|
||||
#define SDL_strtoul strtoul
|
||||
#else
|
||||
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base);
|
||||
#endif
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
|
||||
#ifdef HAVE__I64TOA
|
||||
#define SDL_lltoa _i64toa
|
||||
#else
|
||||
extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__UI64TOA
|
||||
#define SDL_ulltoa _ui64toa
|
||||
#else
|
||||
extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRTOLL
|
||||
#define SDL_strtoll strtoll
|
||||
#else
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRTOULL
|
||||
#define SDL_strtoull strtoull
|
||||
#else
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
|
||||
#endif
|
||||
|
||||
#endif /* SDL_HAS_64BIT_TYPE */
|
||||
|
||||
#ifdef HAVE_STRTOD
|
||||
#define SDL_strtod strtod
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATOI
|
||||
#define SDL_atoi atoi
|
||||
#else
|
||||
#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATOF
|
||||
#define SDL_atof atof
|
||||
#else
|
||||
#define SDL_atof(X) SDL_strtod(X, NULL)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCMP
|
||||
#define SDL_strcmp strcmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRNCMP
|
||||
#define SDL_strncmp strncmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCASECMP
|
||||
#define SDL_strcasecmp strcasecmp
|
||||
#elif defined(HAVE__STRICMP)
|
||||
#define SDL_strcasecmp _stricmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRNCASECMP
|
||||
#define SDL_strncasecmp strncasecmp
|
||||
#elif defined(HAVE__STRNICMP)
|
||||
#define SDL_strncasecmp _strnicmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSCANF
|
||||
#define SDL_sscanf sscanf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SNPRINTF
|
||||
#define SDL_snprintf snprintf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
#define SDL_vsnprintf vsnprintf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
|
||||
#endif
|
||||
|
||||
/* The SDL implementation of iconv() returns these error codes */
|
||||
#define SDL_ICONV_ERROR (size_t)-1
|
||||
#define SDL_ICONV_E2BIG (size_t)-2
|
||||
#define SDL_ICONV_EILSEQ (size_t)-3
|
||||
#define SDL_ICONV_EINVAL (size_t)-4
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#define SDL_iconv_t iconv_t
|
||||
#define SDL_iconv_open iconv_open
|
||||
#define SDL_iconv_close iconv_close
|
||||
#else
|
||||
typedef struct _SDL_iconv_t *SDL_iconv_t;
|
||||
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
|
||||
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
|
||||
#endif
|
||||
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
|
||||
/* This function converts a string between encodings in one pass, returning a
|
||||
string that must be freed with SDL_free() or NULL on error.
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);
|
||||
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_stdinc_h */
|
214
build/linux/libs/sdl-1.2.13/include/SDL_syswm.h
Normal file
214
build/linux/libs/sdl-1.2.13/include/SDL_syswm.h
Normal file
@ -0,0 +1,214 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL custom system window manager hooks */
|
||||
|
||||
#ifndef _SDL_syswm_h
|
||||
#define _SDL_syswm_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
|
||||
which contains window-manager specific information and arrives whenever
|
||||
an unhandled window event occurs. This event is ignored by default, but
|
||||
you can enable it with SDL_EventState()
|
||||
*/
|
||||
#ifdef SDL_PROTOTYPES_ONLY
|
||||
struct SDL_SysWMinfo;
|
||||
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
||||
#else
|
||||
|
||||
/* This is the structure for custom window manager events */
|
||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* conflicts with Quickdraw.h */
|
||||
#define Cursor X11Cursor
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* matches the re-define above */
|
||||
#undef Cursor
|
||||
#endif
|
||||
|
||||
/* These are the various supported subsystems under UNIX */
|
||||
typedef enum {
|
||||
SDL_SYSWM_X11
|
||||
} SDL_SYSWM_TYPE;
|
||||
|
||||
/* The UNIX custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
SDL_SYSWM_TYPE subsystem;
|
||||
union {
|
||||
XEvent xevent;
|
||||
} event;
|
||||
};
|
||||
|
||||
/* The UNIX custom window manager information structure.
|
||||
When this structure is returned, it holds information about which
|
||||
low level system it is using, and will be one of SDL_SYSWM_TYPE.
|
||||
*/
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
SDL_SYSWM_TYPE subsystem;
|
||||
union {
|
||||
struct {
|
||||
Display *display; /* The X11 display */
|
||||
Window window; /* The X11 display window */
|
||||
/* These locking functions should be called around
|
||||
any X11 functions using the display variable,
|
||||
but not the gfxdisplay variable.
|
||||
They lock the event thread, so should not be
|
||||
called around event functions or from event filters.
|
||||
*/
|
||||
void (*lock_func)(void);
|
||||
void (*unlock_func)(void);
|
||||
|
||||
/* Introduced in SDL 1.0.2 */
|
||||
Window fswindow; /* The X11 fullscreen window */
|
||||
Window wmwindow; /* The X11 managed input window */
|
||||
|
||||
/* Introduced in SDL 1.2.12 */
|
||||
Display *gfxdisplay; /* The X11 display to which rendering is done */
|
||||
} x11;
|
||||
} info;
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#elif defined(SDL_VIDEO_DRIVER_NANOX)
|
||||
#include <microwin/nano-X.h>
|
||||
|
||||
/* The generic custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
int data;
|
||||
};
|
||||
|
||||
/* The windows custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version ;
|
||||
GR_WINDOW_ID window ; /* The display window */
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
/* The windows custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
HWND hwnd; /* The window for the message */
|
||||
UINT msg; /* The type of message */
|
||||
WPARAM wParam; /* WORD message parameter */
|
||||
LPARAM lParam; /* LONG message parameter */
|
||||
};
|
||||
|
||||
/* The windows custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
HWND window; /* The Win32 display window */
|
||||
HGLRC hglrc; /* The OpenGL context, if any */
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
|
||||
|
||||
/* RISC OS custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
int eventCode; /* The window for the message */
|
||||
int pollBlock[64];
|
||||
};
|
||||
|
||||
/* The RISC OS custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
int wimpVersion; /* Wimp version running under */
|
||||
int taskHandle; /* The RISC OS task handle */
|
||||
int window; /* The RISC OS display window */
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
|
||||
#include <sys/neutrino.h>
|
||||
#include <Ph.h>
|
||||
|
||||
/* The QNX custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
int data;
|
||||
};
|
||||
|
||||
/* The QNX custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
int data;
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#else
|
||||
|
||||
/* The generic custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
int data;
|
||||
};
|
||||
|
||||
/* The generic custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
int data;
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#endif /* video driver type */
|
||||
|
||||
#endif /* SDL_PROTOTYPES_ONLY */
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* This function gives you custom hooks into the window manager information.
|
||||
* It fills the structure pointed to by 'info' with custom information and
|
||||
* returns 1 if the function is implemented. If it's not implemented, or
|
||||
* the version member of the 'info' structure is invalid, it returns 0.
|
||||
*
|
||||
* You typically use this function like this:
|
||||
* SDL_SysWMInfo info;
|
||||
* SDL_VERSION(&info.version);
|
||||
* if ( SDL_GetWMInfo(&info) ) { ... }
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_syswm_h */
|
119
build/linux/libs/sdl-1.2.13/include/SDL_thread.h
Normal file
119
build/linux/libs/sdl-1.2.13/include/SDL_thread.h
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_thread_h
|
||||
#define _SDL_thread_h
|
||||
|
||||
/* Header for the SDL thread management routines
|
||||
|
||||
These are independent of the other SDL routines.
|
||||
*/
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
/* Thread synchronization primitives */
|
||||
#include "SDL_mutex.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The SDL thread structure, defined in SDL_thread.c */
|
||||
struct SDL_Thread;
|
||||
typedef struct SDL_Thread SDL_Thread;
|
||||
|
||||
/* Create a thread */
|
||||
#if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__)
|
||||
/*
|
||||
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
|
||||
creates a new thread for the calling process with the SDL_CreateThread()
|
||||
API. There is a problem with this, that only the RTL of the SDL.DLL will
|
||||
be initialized for those threads, and not the RTL of the calling application!
|
||||
To solve this, we make a little hack here.
|
||||
We'll always use the caller's _beginthread() and _endthread() APIs to
|
||||
start a new thread. This way, if it's the SDL.DLL which uses this API,
|
||||
then the RTL of SDL.DLL will be used to create the new thread, and if it's
|
||||
the application, then the RTL of the application will be used.
|
||||
So, in short:
|
||||
Always use the _beginthread() and _endthread() of the calling runtime library!
|
||||
*/
|
||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
#ifndef _WIN32_WCE
|
||||
#include <process.h> /* This has _beginthread() and _endthread() defined! */
|
||||
#endif
|
||||
|
||||
#ifdef __OS2__
|
||||
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
|
||||
typedef void (*pfnSDL_CurrentEndThread)(void);
|
||||
#elif __GNUC__
|
||||
typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||
unsigned (__stdcall *func)(void *), void *arg,
|
||||
unsigned, unsigned *threadID);
|
||||
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
||||
#else
|
||||
typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||
unsigned (__stdcall *func)(void *), void *arg,
|
||||
unsigned, unsigned *threadID);
|
||||
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
||||
#endif
|
||||
|
||||
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
|
||||
|
||||
#ifdef __OS2__
|
||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
|
||||
#elif defined(_WIN32_WCE)
|
||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
|
||||
#else
|
||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
|
||||
#endif
|
||||
#else
|
||||
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
|
||||
#endif
|
||||
|
||||
/* Get the 32-bit thread identifier for the current thread */
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
|
||||
|
||||
/* Get the 32-bit thread identifier for the specified thread,
|
||||
equivalent to SDL_ThreadID() if the specified thread is NULL.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
|
||||
|
||||
/* Wait for a thread to finish.
|
||||
The return code for the thread function is placed in the area
|
||||
pointed to by 'status', if 'status' is not NULL.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
|
||||
|
||||
/* Forcefully kill a thread without worrying about its state */
|
||||
extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_thread_h */
|
115
build/linux/libs/sdl-1.2.13/include/SDL_timer.h
Normal file
115
build/linux/libs/sdl-1.2.13/include/SDL_timer.h
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_timer_h
|
||||
#define _SDL_timer_h
|
||||
|
||||
/* Header for the SDL time management routines */
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is the OS scheduler timeslice, in milliseconds */
|
||||
#define SDL_TIMESLICE 10
|
||||
|
||||
/* This is the maximum resolution of the SDL timer on all platforms */
|
||||
#define TIMER_RESOLUTION 10 /* Experimentally determined */
|
||||
|
||||
/* Get the number of milliseconds since the SDL library initialization.
|
||||
* Note that this value wraps if the program runs for more than ~49 days.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
||||
|
||||
/* Wait a specified number of milliseconds before returning */
|
||||
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
||||
|
||||
/* Function prototype for the timer callback function */
|
||||
typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
|
||||
|
||||
/* Set a callback to run after the specified number of milliseconds has
|
||||
* elapsed. The callback function is passed the current timer interval
|
||||
* and returns the next timer interval. If the returned value is the
|
||||
* same as the one passed in, the periodic alarm continues, otherwise a
|
||||
* new alarm is scheduled. If the callback returns 0, the periodic alarm
|
||||
* is cancelled.
|
||||
*
|
||||
* To cancel a currently running timer, call SDL_SetTimer(0, NULL);
|
||||
*
|
||||
* The timer callback function may run in a different thread than your
|
||||
* main code, and so shouldn't call any functions from within itself.
|
||||
*
|
||||
* The maximum resolution of this timer is 10 ms, which means that if
|
||||
* you request a 16 ms timer, your callback will run approximately 20 ms
|
||||
* later on an unloaded system. If you wanted to set a flag signaling
|
||||
* a frame update at 30 frames per second (every 33 ms), you might set a
|
||||
* timer for 30 ms:
|
||||
* SDL_SetTimer((33/10)*10, flag_update);
|
||||
*
|
||||
* If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
|
||||
*
|
||||
* Under UNIX, you should not use raise or use SIGALRM and this function
|
||||
* in the same program, as it is implemented using setitimer(). You also
|
||||
* should not use this function in multi-threaded applications as signals
|
||||
* to multi-threaded apps have undefined behavior in some implementations.
|
||||
*
|
||||
* This function returns 0 if successful, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
|
||||
|
||||
/* New timer API, supports multiple timers
|
||||
* Written by Stephane Peter <megastep@lokigames.com>
|
||||
*/
|
||||
|
||||
/* Function prototype for the new timer callback function.
|
||||
* The callback function is passed the current timer interval and returns
|
||||
* the next timer interval. If the returned value is the same as the one
|
||||
* passed in, the periodic alarm continues, otherwise a new alarm is
|
||||
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
|
||||
*/
|
||||
typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
|
||||
|
||||
/* Definition of the timer ID type */
|
||||
typedef struct _SDL_TimerID *SDL_TimerID;
|
||||
|
||||
/* Add a new timer to the pool of timers already running.
|
||||
Returns a timer ID, or NULL when an error occurs.
|
||||
*/
|
||||
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
|
||||
|
||||
/* Remove one of the multiple timers knowing its ID.
|
||||
* Returns a boolean value indicating success.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_timer_h */
|
24
build/linux/libs/sdl-1.2.13/include/SDL_types.h
Normal file
24
build/linux/libs/sdl-1.2.13/include/SDL_types.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* DEPRECATED */
|
||||
#include "SDL_stdinc.h"
|
85
build/linux/libs/sdl-1.2.13/include/SDL_version.h
Normal file
85
build/linux/libs/sdl-1.2.13/include/SDL_version.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This header defines the current SDL version */
|
||||
|
||||
#ifndef _SDL_version_h
|
||||
#define _SDL_version_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 1
|
||||
#define SDL_MINOR_VERSION 2
|
||||
#define SDL_PATCHLEVEL 13
|
||||
|
||||
typedef struct SDL_version {
|
||||
Uint8 major;
|
||||
Uint8 minor;
|
||||
Uint8 patch;
|
||||
} SDL_version;
|
||||
|
||||
/* This macro can be used to fill a version structure with the compile-time
|
||||
* version of the SDL library.
|
||||
*/
|
||||
#define SDL_VERSION(X) \
|
||||
{ \
|
||||
(X)->major = SDL_MAJOR_VERSION; \
|
||||
(X)->minor = SDL_MINOR_VERSION; \
|
||||
(X)->patch = SDL_PATCHLEVEL; \
|
||||
}
|
||||
|
||||
/* This macro turns the version numbers into a numeric value:
|
||||
(1,2,3) -> (1203)
|
||||
This assumes that there will never be more than 100 patchlevels
|
||||
*/
|
||||
#define SDL_VERSIONNUM(X, Y, Z) \
|
||||
((X)*1000 + (Y)*100 + (Z))
|
||||
|
||||
/* This is the version number macro for the current SDL version */
|
||||
#define SDL_COMPILEDVERSION \
|
||||
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
|
||||
|
||||
/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
|
||||
#define SDL_VERSION_ATLEAST(X, Y, Z) \
|
||||
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
|
||||
|
||||
/* This function gets the version of the dynamically linked SDL library.
|
||||
it should NOT be used to fill a version structure, instead you should
|
||||
use the SDL_Version() macro.
|
||||
*/
|
||||
extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_version_h */
|
891
build/linux/libs/sdl-1.2.13/include/SDL_video.h
Normal file
891
build/linux/libs/sdl-1.2.13/include/SDL_video.h
Normal file
@ -0,0 +1,891 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Header file for access to the SDL raw framebuffer window */
|
||||
|
||||
#ifndef _SDL_video_h
|
||||
#define _SDL_video_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_rwops.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Transparency definitions: These define alpha as the opacity of a surface */
|
||||
#define SDL_ALPHA_OPAQUE 255
|
||||
#define SDL_ALPHA_TRANSPARENT 0
|
||||
|
||||
/* Useful data types */
|
||||
typedef struct SDL_Rect {
|
||||
Sint16 x, y;
|
||||
Uint16 w, h;
|
||||
} SDL_Rect;
|
||||
|
||||
typedef struct SDL_Color {
|
||||
Uint8 r;
|
||||
Uint8 g;
|
||||
Uint8 b;
|
||||
Uint8 unused;
|
||||
} SDL_Color;
|
||||
#define SDL_Colour SDL_Color
|
||||
|
||||
typedef struct SDL_Palette {
|
||||
int ncolors;
|
||||
SDL_Color *colors;
|
||||
} SDL_Palette;
|
||||
|
||||
/* Everything in the pixel format structure is read-only */
|
||||
typedef struct SDL_PixelFormat {
|
||||
SDL_Palette *palette;
|
||||
Uint8 BitsPerPixel;
|
||||
Uint8 BytesPerPixel;
|
||||
Uint8 Rloss;
|
||||
Uint8 Gloss;
|
||||
Uint8 Bloss;
|
||||
Uint8 Aloss;
|
||||
Uint8 Rshift;
|
||||
Uint8 Gshift;
|
||||
Uint8 Bshift;
|
||||
Uint8 Ashift;
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
|
||||
/* RGB color key information */
|
||||
Uint32 colorkey;
|
||||
/* Alpha value information (per-surface alpha) */
|
||||
Uint8 alpha;
|
||||
} SDL_PixelFormat;
|
||||
|
||||
/* This structure should be treated as read-only, except for 'pixels',
|
||||
which, if not NULL, contains the raw pixel data for the surface.
|
||||
*/
|
||||
typedef struct SDL_Surface {
|
||||
Uint32 flags; /* Read-only */
|
||||
SDL_PixelFormat *format; /* Read-only */
|
||||
int w, h; /* Read-only */
|
||||
Uint16 pitch; /* Read-only */
|
||||
void *pixels; /* Read-write */
|
||||
int offset; /* Private */
|
||||
|
||||
/* Hardware-specific surface info */
|
||||
struct private_hwdata *hwdata;
|
||||
|
||||
/* clipping information */
|
||||
SDL_Rect clip_rect; /* Read-only */
|
||||
Uint32 unused1; /* for binary compatibility */
|
||||
|
||||
/* Allow recursive locks */
|
||||
Uint32 locked; /* Private */
|
||||
|
||||
/* info for fast blit mapping to other surfaces */
|
||||
struct SDL_BlitMap *map; /* Private */
|
||||
|
||||
/* format version, bumped at every change to invalidate blit maps */
|
||||
unsigned int format_version; /* Private */
|
||||
|
||||
/* Reference count -- used when freeing surface */
|
||||
int refcount; /* Read-mostly */
|
||||
} SDL_Surface;
|
||||
|
||||
/* These are the currently supported flags for the SDL_surface */
|
||||
/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */
|
||||
#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */
|
||||
#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */
|
||||
#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */
|
||||
/* Available for SDL_SetVideoMode() */
|
||||
#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
|
||||
#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */
|
||||
#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */
|
||||
#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */
|
||||
#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */
|
||||
#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */
|
||||
#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */
|
||||
#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */
|
||||
/* Used internally (read-only) */
|
||||
#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */
|
||||
#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */
|
||||
#define SDL_RLEACCELOK 0x00002000 /* Private flag */
|
||||
#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */
|
||||
#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */
|
||||
#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
|
||||
|
||||
/* Evaluates to true if the surface needs to be locked before access */
|
||||
#define SDL_MUSTLOCK(surface) \
|
||||
(surface->offset || \
|
||||
((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
|
||||
|
||||
/* typedef for private surface blitting functions */
|
||||
typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect,
|
||||
struct SDL_Surface *dst, SDL_Rect *dstrect);
|
||||
|
||||
|
||||
/* Useful for determining the video hardware capabilities */
|
||||
typedef struct SDL_VideoInfo {
|
||||
Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */
|
||||
Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */
|
||||
Uint32 UnusedBits1 :6;
|
||||
Uint32 UnusedBits2 :1;
|
||||
Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */
|
||||
Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */
|
||||
Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */
|
||||
Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */
|
||||
Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */
|
||||
Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */
|
||||
Uint32 blit_fill :1; /* Flag: Accelerated color fill */
|
||||
Uint32 UnusedBits3 :16;
|
||||
Uint32 video_mem; /* The total amount of video memory (in K) */
|
||||
SDL_PixelFormat *vfmt; /* Value: The format of the video surface */
|
||||
int current_w; /* Value: The current video mode width */
|
||||
int current_h; /* Value: The current video mode height */
|
||||
} SDL_VideoInfo;
|
||||
|
||||
|
||||
/* The most common video overlay formats.
|
||||
For an explanation of these pixel formats, see:
|
||||
http://www.webartz.com/fourcc/indexyuv.htm
|
||||
|
||||
For information on the relationship between color spaces, see:
|
||||
http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
|
||||
*/
|
||||
#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */
|
||||
#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */
|
||||
#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
|
||||
#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
|
||||
#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
|
||||
|
||||
/* The YUV hardware video overlay */
|
||||
typedef struct SDL_Overlay {
|
||||
Uint32 format; /* Read-only */
|
||||
int w, h; /* Read-only */
|
||||
int planes; /* Read-only */
|
||||
Uint16 *pitches; /* Read-only */
|
||||
Uint8 **pixels; /* Read-write */
|
||||
|
||||
/* Hardware-specific surface info */
|
||||
struct private_yuvhwfuncs *hwfuncs;
|
||||
struct private_yuvhwdata *hwdata;
|
||||
|
||||
/* Special flags */
|
||||
Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */
|
||||
Uint32 UnusedBits :31;
|
||||
} SDL_Overlay;
|
||||
|
||||
|
||||
/* Public enumeration for setting the OpenGL window attributes. */
|
||||
typedef enum {
|
||||
SDL_GL_RED_SIZE,
|
||||
SDL_GL_GREEN_SIZE,
|
||||
SDL_GL_BLUE_SIZE,
|
||||
SDL_GL_ALPHA_SIZE,
|
||||
SDL_GL_BUFFER_SIZE,
|
||||
SDL_GL_DOUBLEBUFFER,
|
||||
SDL_GL_DEPTH_SIZE,
|
||||
SDL_GL_STENCIL_SIZE,
|
||||
SDL_GL_ACCUM_RED_SIZE,
|
||||
SDL_GL_ACCUM_GREEN_SIZE,
|
||||
SDL_GL_ACCUM_BLUE_SIZE,
|
||||
SDL_GL_ACCUM_ALPHA_SIZE,
|
||||
SDL_GL_STEREO,
|
||||
SDL_GL_MULTISAMPLEBUFFERS,
|
||||
SDL_GL_MULTISAMPLESAMPLES,
|
||||
SDL_GL_ACCELERATED_VISUAL,
|
||||
SDL_GL_SWAP_CONTROL
|
||||
} SDL_GLattr;
|
||||
|
||||
/* flags for SDL_SetPalette() */
|
||||
#define SDL_LOGPAL 0x01
|
||||
#define SDL_PHYSPAL 0x02
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* These functions are used internally, and should not be used unless you
|
||||
* have a specific need to specify the video driver you want to use.
|
||||
* You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||
*
|
||||
* SDL_VideoInit() initializes the video subsystem -- sets up a connection
|
||||
* to the window manager, etc, and determines the current video mode and
|
||||
* pixel format, but does not initialize a window or graphics mode.
|
||||
* Note that event handling is activated by this routine.
|
||||
*
|
||||
* If you use both sound and video in your application, you need to call
|
||||
* SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
|
||||
* you won't be able to set full-screen display modes.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags);
|
||||
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
|
||||
|
||||
/* This function fills the given character buffer with the name of the
|
||||
* video driver, and returns a pointer to it if the video driver has
|
||||
* been initialized. It returns NULL if no driver has been initialized.
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
|
||||
|
||||
/*
|
||||
* This function returns a pointer to the current display surface.
|
||||
* If SDL is doing format conversion on the display surface, this
|
||||
* function returns the publicly visible surface, not the real video
|
||||
* surface.
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void);
|
||||
|
||||
/*
|
||||
* This function returns a read-only pointer to information about the
|
||||
* video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt'
|
||||
* member of the returned structure will contain the pixel format of the
|
||||
* "best" video mode.
|
||||
*/
|
||||
extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void);
|
||||
|
||||
/*
|
||||
* Check to see if a particular video mode is supported.
|
||||
* It returns 0 if the requested mode is not supported under any bit depth,
|
||||
* or returns the bits-per-pixel of the closest available mode with the
|
||||
* given width and height. If this bits-per-pixel is different from the
|
||||
* one used when setting the video mode, SDL_SetVideoMode() will succeed,
|
||||
* but will emulate the requested bits-per-pixel with a shadow surface.
|
||||
*
|
||||
* The arguments to SDL_VideoModeOK() are the same ones you would pass to
|
||||
* SDL_SetVideoMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
|
||||
|
||||
/*
|
||||
* Return a pointer to an array of available screen dimensions for the
|
||||
* given format and video flags, sorted largest to smallest. Returns
|
||||
* NULL if there are no dimensions available for a particular format,
|
||||
* or (SDL_Rect **)-1 if any dimension is okay for the given format.
|
||||
*
|
||||
* If 'format' is NULL, the mode list will be for the format given
|
||||
* by SDL_GetVideoInfo()->vfmt
|
||||
*/
|
||||
extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
|
||||
|
||||
/*
|
||||
* Set up a video mode with the specified width, height and bits-per-pixel.
|
||||
*
|
||||
* If 'bpp' is 0, it is treated as the current display bits per pixel.
|
||||
*
|
||||
* If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the
|
||||
* requested bits-per-pixel, but will return whatever video pixel format is
|
||||
* available. The default is to emulate the requested pixel format if it
|
||||
* is not natively available.
|
||||
*
|
||||
* If SDL_HWSURFACE is set in 'flags', the video surface will be placed in
|
||||
* video memory, if possible, and you may have to call SDL_LockSurface()
|
||||
* in order to access the raw framebuffer. Otherwise, the video surface
|
||||
* will be created in system memory.
|
||||
*
|
||||
* If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle
|
||||
* updates asynchronously, but you must always lock before accessing pixels.
|
||||
* SDL will wait for updates to complete before returning from the lock.
|
||||
*
|
||||
* If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee
|
||||
* that the colors set by SDL_SetColors() will be the colors you get.
|
||||
* Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all
|
||||
* of the colors exactly the way they are requested, and you should look
|
||||
* at the video surface structure to determine the actual palette.
|
||||
* If SDL cannot guarantee that the colors you request can be set,
|
||||
* i.e. if the colormap is shared, then the video surface may be created
|
||||
* under emulation in system memory, overriding the SDL_HWSURFACE flag.
|
||||
*
|
||||
* If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set
|
||||
* a fullscreen video mode. The default is to create a windowed mode
|
||||
* if the current graphics system has a window manager.
|
||||
* If the SDL library is able to set a fullscreen video mode, this flag
|
||||
* will be set in the surface that is returned.
|
||||
*
|
||||
* If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up
|
||||
* two surfaces in video memory and swap between them when you call
|
||||
* SDL_Flip(). This is usually slower than the normal single-buffering
|
||||
* scheme, but prevents "tearing" artifacts caused by modifying video
|
||||
* memory while the monitor is refreshing. It should only be used by
|
||||
* applications that redraw the entire screen on every update.
|
||||
*
|
||||
* If SDL_RESIZABLE is set in 'flags', the SDL library will allow the
|
||||
* window manager, if any, to resize the window at runtime. When this
|
||||
* occurs, SDL will send a SDL_VIDEORESIZE event to you application,
|
||||
* and you must respond to the event by re-calling SDL_SetVideoMode()
|
||||
* with the requested size (or another size that suits the application).
|
||||
*
|
||||
* If SDL_NOFRAME is set in 'flags', the SDL library will create a window
|
||||
* without any title bar or frame decoration. Fullscreen video modes have
|
||||
* this flag set automatically.
|
||||
*
|
||||
* This function returns the video framebuffer surface, or NULL if it fails.
|
||||
*
|
||||
* If you rely on functionality provided by certain video flags, check the
|
||||
* flags of the returned surface to make sure that functionality is available.
|
||||
* SDL will fall back to reduced functionality if the exact flags you wanted
|
||||
* are not available.
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode
|
||||
(int width, int height, int bpp, Uint32 flags);
|
||||
|
||||
/*
|
||||
* Makes sure the given list of rectangles is updated on the given screen.
|
||||
* If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
|
||||
* screen.
|
||||
* These functions should not be called while 'screen' is locked.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UpdateRects
|
||||
(SDL_Surface *screen, int numrects, SDL_Rect *rects);
|
||||
extern DECLSPEC void SDLCALL SDL_UpdateRect
|
||||
(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
|
||||
|
||||
/*
|
||||
* On hardware that supports double-buffering, this function sets up a flip
|
||||
* and returns. The hardware will wait for vertical retrace, and then swap
|
||||
* video buffers before the next video surface blit or lock will return.
|
||||
* On hardware that doesn not support double-buffering, this is equivalent
|
||||
* to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
|
||||
* The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
|
||||
* setting the video mode for this function to perform hardware flipping.
|
||||
* This function returns 0 if successful, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen);
|
||||
|
||||
/*
|
||||
* Set the gamma correction for each of the color channels.
|
||||
* The gamma values range (approximately) between 0.1 and 10.0
|
||||
*
|
||||
* If this function isn't supported directly by the hardware, it will
|
||||
* be emulated using gamma ramps, if available. If successful, this
|
||||
* function returns 0, otherwise it returns -1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
|
||||
|
||||
/*
|
||||
* Set the gamma translation table for the red, green, and blue channels
|
||||
* of the video hardware. Each table is an array of 256 16-bit quantities,
|
||||
* representing a mapping between the input and output for that channel.
|
||||
* The input is the index into the array, and the output is the 16-bit
|
||||
* gamma value at that index, scaled to the output color precision.
|
||||
*
|
||||
* You may pass NULL for any of the channels to leave it unchanged.
|
||||
* If the call succeeds, it will return 0. If the display driver or
|
||||
* hardware does not support gamma translation, or otherwise fails,
|
||||
* this function will return -1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue);
|
||||
|
||||
/*
|
||||
* Retrieve the current values of the gamma translation tables.
|
||||
*
|
||||
* You must pass in valid pointers to arrays of 256 16-bit quantities.
|
||||
* Any of the pointers may be NULL to ignore that channel.
|
||||
* If the call succeeds, it will return 0. If the display driver or
|
||||
* hardware does not support gamma translation, or otherwise fails,
|
||||
* this function will return -1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
|
||||
|
||||
/*
|
||||
* Sets a portion of the colormap for the given 8-bit surface. If 'surface'
|
||||
* is not a palettized surface, this function does nothing, returning 0.
|
||||
* If all of the colors were set as passed to SDL_SetColors(), it will
|
||||
* return 1. If not all the color entries were set exactly as given,
|
||||
* it will return 0, and you should look at the surface palette to
|
||||
* determine the actual color palette.
|
||||
*
|
||||
* When 'surface' is the surface associated with the current display, the
|
||||
* display colormap will be updated with the requested colors. If
|
||||
* SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
|
||||
* will always return 1, and the palette is guaranteed to be set the way
|
||||
* you desire, even if the window colormap has to be warped or run under
|
||||
* emulation.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface,
|
||||
SDL_Color *colors, int firstcolor, int ncolors);
|
||||
|
||||
/*
|
||||
* Sets a portion of the colormap for a given 8-bit surface.
|
||||
* 'flags' is one or both of:
|
||||
* SDL_LOGPAL -- set logical palette, which controls how blits are mapped
|
||||
* to/from the surface,
|
||||
* SDL_PHYSPAL -- set physical palette, which controls how pixels look on
|
||||
* the screen
|
||||
* Only screens have physical palettes. Separate change of physical/logical
|
||||
* palettes is only possible if the screen has SDL_HWPALETTE set.
|
||||
*
|
||||
* The return value is 1 if all colours could be set as requested, and 0
|
||||
* otherwise.
|
||||
*
|
||||
* SDL_SetColors() is equivalent to calling this function with
|
||||
* flags = (SDL_LOGPAL|SDL_PHYSPAL).
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
|
||||
SDL_Color *colors, int firstcolor,
|
||||
int ncolors);
|
||||
|
||||
/*
|
||||
* Maps an RGB triple to an opaque pixel value for a given pixel format
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
|
||||
(const SDL_PixelFormat * const format,
|
||||
const Uint8 r, const Uint8 g, const Uint8 b);
|
||||
|
||||
/*
|
||||
* Maps an RGBA quadruple to a pixel value for a given pixel format
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA
|
||||
(const SDL_PixelFormat * const format,
|
||||
const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a);
|
||||
|
||||
/*
|
||||
* Maps a pixel value into the RGB components for a given pixel format
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt,
|
||||
Uint8 *r, Uint8 *g, Uint8 *b);
|
||||
|
||||
/*
|
||||
* Maps a pixel value into the RGBA components for a given pixel format
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
|
||||
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
|
||||
|
||||
/*
|
||||
* Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
|
||||
* If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
|
||||
* If the depth is greater than 8 bits, the pixel format is set using the
|
||||
* flags '[RGB]mask'.
|
||||
* If the function runs out of memory, it will return NULL.
|
||||
*
|
||||
* The 'flags' tell what kind of surface to create.
|
||||
* SDL_SWSURFACE means that the surface should be created in system memory.
|
||||
* SDL_HWSURFACE means that the surface should be created in video memory,
|
||||
* with the same format as the display surface. This is useful for surfaces
|
||||
* that will not change much, to take advantage of hardware acceleration
|
||||
* when being blitted to the display surface.
|
||||
* SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
|
||||
* this surface, but you must always lock it before accessing the pixels.
|
||||
* SDL will wait for current blits to finish before returning from the lock.
|
||||
* SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
|
||||
* If the hardware supports acceleration of colorkey blits between
|
||||
* two surfaces in video memory, SDL will try to place the surface in
|
||||
* video memory. If this isn't possible or if there is no hardware
|
||||
* acceleration available, the surface will be placed in system memory.
|
||||
* SDL_SRCALPHA means that the surface will be used for alpha blits and
|
||||
* if the hardware supports hardware acceleration of alpha blits between
|
||||
* two surfaces in video memory, to place the surface in video memory
|
||||
* if possible, otherwise it will be placed in system memory.
|
||||
* If the surface is created in video memory, blits will be _much_ faster,
|
||||
* but the surface format must be identical to the video surface format,
|
||||
* and the only way to access the pixels member of the surface is to use
|
||||
* the SDL_LockSurface() and SDL_UnlockSurface() calls.
|
||||
* If the requested surface actually resides in video memory, SDL_HWSURFACE
|
||||
* will be set in the flags member of the returned surface. If for some
|
||||
* reason the surface could not be placed in video memory, it will not have
|
||||
* the SDL_HWSURFACE flag set, and will be created in system memory instead.
|
||||
*/
|
||||
#define SDL_AllocSurface SDL_CreateRGBSurface
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface
|
||||
(Uint32 flags, int width, int height, int depth,
|
||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
|
||||
int width, int height, int depth, int pitch,
|
||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface);
|
||||
|
||||
/*
|
||||
* SDL_LockSurface() sets up a surface for directly accessing the pixels.
|
||||
* Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
|
||||
* to and read from 'surface->pixels', using the pixel format stored in
|
||||
* 'surface->format'. Once you are done accessing the surface, you should
|
||||
* use SDL_UnlockSurface() to release it.
|
||||
*
|
||||
* Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
|
||||
* to 0, then you can read and write to the surface at any time, and the
|
||||
* pixel format of the surface will not change. In particular, if the
|
||||
* SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
|
||||
* will not need to lock the display surface before accessing it.
|
||||
*
|
||||
* No operating system or library calls should be made between lock/unlock
|
||||
* pairs, as critical system locks may be held during this time.
|
||||
*
|
||||
* SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
|
||||
|
||||
/*
|
||||
* Load a surface from a seekable SDL data source (memory or file.)
|
||||
* If 'freesrc' is non-zero, the source will be closed after being read.
|
||||
* Returns the new surface, or NULL if there was an error.
|
||||
* The new surface should be freed with SDL_FreeSurface().
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
|
||||
|
||||
/* Convenience macro -- load a surface from a file */
|
||||
#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
|
||||
|
||||
/*
|
||||
* Save a surface to a seekable SDL data source (memory or file.)
|
||||
* If 'freedst' is non-zero, the source will be closed after being written.
|
||||
* Returns 0 if successful or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
||||
(SDL_Surface *surface, SDL_RWops *dst, int freedst);
|
||||
|
||||
/* Convenience macro -- save a surface to a file */
|
||||
#define SDL_SaveBMP(surface, file) \
|
||||
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
|
||||
|
||||
/*
|
||||
* Sets the color key (transparent pixel) in a blittable surface.
|
||||
* If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
|
||||
* 'key' will be the transparent pixel in the source image of a blit.
|
||||
* SDL_RLEACCEL requests RLE acceleration for the surface if present,
|
||||
* and removes RLE acceleration if absent.
|
||||
* If 'flag' is 0, this function clears any current color key.
|
||||
* This function returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetColorKey
|
||||
(SDL_Surface *surface, Uint32 flag, Uint32 key);
|
||||
|
||||
/*
|
||||
* This function sets the alpha value for the entire surface, as opposed to
|
||||
* using the alpha component of each pixel. This value measures the range
|
||||
* of transparency of the surface, 0 being completely transparent to 255
|
||||
* being completely opaque. An 'alpha' value of 255 causes blits to be
|
||||
* opaque, the source pixels copied to the destination (the default). Note
|
||||
* that per-surface alpha can be combined with colorkey transparency.
|
||||
*
|
||||
* If 'flag' is 0, alpha blending is disabled for the surface.
|
||||
* If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
|
||||
* OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
|
||||
* surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
|
||||
*
|
||||
* The 'alpha' parameter is ignored for surfaces that have an alpha channel.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
|
||||
|
||||
/*
|
||||
* Sets the clipping rectangle for the destination surface in a blit.
|
||||
*
|
||||
* If the clip rectangle is NULL, clipping will be disabled.
|
||||
* If the clip rectangle doesn't intersect the surface, the function will
|
||||
* return SDL_FALSE and blits will be completely clipped. Otherwise the
|
||||
* function returns SDL_TRUE and blits to the surface will be clipped to
|
||||
* the intersection of the surface area and the clipping rectangle.
|
||||
*
|
||||
* Note that blits are automatically clipped to the edges of the source
|
||||
* and destination surfaces.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect);
|
||||
|
||||
/*
|
||||
* Gets the clipping rectangle for the destination surface in a blit.
|
||||
* 'rect' must be a pointer to a valid rectangle which will be filled
|
||||
* with the correct values.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
|
||||
|
||||
/*
|
||||
* Creates a new surface of the specified format, and then copies and maps
|
||||
* the given surface to it so the blit of the converted surface will be as
|
||||
* fast as possible. If this function fails, it returns NULL.
|
||||
*
|
||||
* The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
|
||||
* semantics. You can also pass SDL_RLEACCEL in the flags parameter and
|
||||
* SDL will try to RLE accelerate colorkey and alpha blits in the resulting
|
||||
* surface.
|
||||
*
|
||||
* This function is used internally by SDL_DisplayFormat().
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface
|
||||
(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
|
||||
|
||||
/*
|
||||
* This performs a fast blit from the source surface to the destination
|
||||
* surface. It assumes that the source and destination rectangles are
|
||||
* the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
|
||||
* surface (src or dst) is copied. The final blit rectangles are saved
|
||||
* in 'srcrect' and 'dstrect' after all clipping is performed.
|
||||
* If the blit is successful, it returns 0, otherwise it returns -1.
|
||||
*
|
||||
* The blit function should not be called on a locked surface.
|
||||
*
|
||||
* The blit semantics for surfaces with and without alpha and colorkey
|
||||
* are defined as follows:
|
||||
*
|
||||
* RGBA->RGB:
|
||||
* SDL_SRCALPHA set:
|
||||
* alpha-blend (using alpha-channel).
|
||||
* SDL_SRCCOLORKEY ignored.
|
||||
* SDL_SRCALPHA not set:
|
||||
* copy RGB.
|
||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
* RGB values of the source colour key, ignoring alpha in the
|
||||
* comparison.
|
||||
*
|
||||
* RGB->RGBA:
|
||||
* SDL_SRCALPHA set:
|
||||
* alpha-blend (using the source per-surface alpha value);
|
||||
* set destination alpha to opaque.
|
||||
* SDL_SRCALPHA not set:
|
||||
* copy RGB, set destination alpha to source per-surface alpha value.
|
||||
* both:
|
||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
* source colour key.
|
||||
*
|
||||
* RGBA->RGBA:
|
||||
* SDL_SRCALPHA set:
|
||||
* alpha-blend (using the source alpha channel) the RGB values;
|
||||
* leave destination alpha untouched. [Note: is this correct?]
|
||||
* SDL_SRCCOLORKEY ignored.
|
||||
* SDL_SRCALPHA not set:
|
||||
* copy all of RGBA to the destination.
|
||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
* RGB values of the source colour key, ignoring alpha in the
|
||||
* comparison.
|
||||
*
|
||||
* RGB->RGB:
|
||||
* SDL_SRCALPHA set:
|
||||
* alpha-blend (using the source per-surface alpha value).
|
||||
* SDL_SRCALPHA not set:
|
||||
* copy RGB.
|
||||
* both:
|
||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
* source colour key.
|
||||
*
|
||||
* If either of the surfaces were in video memory, and the blit returns -2,
|
||||
* the video memory was lost, so it should be reloaded with artwork and
|
||||
* re-blitted:
|
||||
while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
|
||||
while ( SDL_LockSurface(image) < 0 )
|
||||
Sleep(10);
|
||||
-- Write image pixels to image->pixels --
|
||||
SDL_UnlockSurface(image);
|
||||
}
|
||||
* This happens under DirectX 5.0 when the system switches away from your
|
||||
* fullscreen application. The lock will also fail until you have access
|
||||
* to the video memory again.
|
||||
*/
|
||||
/* You should call SDL_BlitSurface() unless you know exactly how SDL
|
||||
blitting works internally and how to use the other blit functions.
|
||||
*/
|
||||
#define SDL_BlitSurface SDL_UpperBlit
|
||||
|
||||
/* This is the public blit function, SDL_BlitSurface(), and it performs
|
||||
rectangle validation and clipping before passing it to SDL_LowerBlit()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_UpperBlit
|
||||
(SDL_Surface *src, SDL_Rect *srcrect,
|
||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
||||
/* This is a semi-private blit function and it performs low-level surface
|
||||
blitting only.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LowerBlit
|
||||
(SDL_Surface *src, SDL_Rect *srcrect,
|
||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
||||
|
||||
/*
|
||||
* This function performs a fast fill of the given rectangle with 'color'
|
||||
* The given rectangle is clipped to the destination surface clip area
|
||||
* and the final fill rectangle is saved in the passed in pointer.
|
||||
* If 'dstrect' is NULL, the whole surface will be filled with 'color'
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
* This function returns 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_FillRect
|
||||
(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
|
||||
|
||||
/*
|
||||
* This function takes a surface and copies it to a new surface of the
|
||||
* pixel format and colors of the video framebuffer, suitable for fast
|
||||
* blitting onto the display surface. It calls SDL_ConvertSurface()
|
||||
*
|
||||
* If you want to take advantage of hardware colorkey or alpha blit
|
||||
* acceleration, you should set the colorkey and alpha value before
|
||||
* calling this function.
|
||||
*
|
||||
* If the conversion fails or runs out of memory, it returns NULL
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface);
|
||||
|
||||
/*
|
||||
* This function takes a surface and copies it to a new surface of the
|
||||
* pixel format and colors of the video framebuffer (if possible),
|
||||
* suitable for fast alpha blitting onto the display surface.
|
||||
* The new surface will always have an alpha channel.
|
||||
*
|
||||
* If you want to take advantage of hardware colorkey or alpha blit
|
||||
* acceleration, you should set the colorkey and alpha value before
|
||||
* calling this function.
|
||||
*
|
||||
* If the conversion fails or runs out of memory, it returns NULL
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* YUV video surface overlay functions */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This function creates a video output overlay
|
||||
Calling the returned surface an overlay is something of a misnomer because
|
||||
the contents of the display surface underneath the area where the overlay
|
||||
is shown is undefined - it may be overwritten with the converted YUV data.
|
||||
*/
|
||||
extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height,
|
||||
Uint32 format, SDL_Surface *display);
|
||||
|
||||
/* Lock an overlay for direct access, and unlock it when you are done */
|
||||
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
|
||||
|
||||
/* Blit a video overlay to the display surface.
|
||||
The contents of the video surface underneath the blit destination are
|
||||
not defined.
|
||||
The width and height of the destination rectangle may be different from
|
||||
that of the overlay, but currently only 2x scaling is supported.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
|
||||
|
||||
/* Free a video overlay */
|
||||
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* OpenGL support functions. */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Dynamically load an OpenGL library, or the default one if path is NULL
|
||||
*
|
||||
* If you do this, you need to retrieve all of the GL functions used in
|
||||
* your program from the dynamic library using SDL_GL_GetProcAddress().
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
|
||||
|
||||
/*
|
||||
* Get the address of a GL function
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc);
|
||||
|
||||
/*
|
||||
* Set an attribute of the OpenGL subsystem before intialization.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
|
||||
|
||||
/*
|
||||
* Get an attribute of the OpenGL subsystem from the windowing
|
||||
* interface, such as glX. This is of course different from getting
|
||||
* the values from SDL's internal OpenGL subsystem, which only
|
||||
* stores the values you request before initialization.
|
||||
*
|
||||
* Developers should track the values they pass into SDL_GL_SetAttribute
|
||||
* themselves if they want to retrieve these values.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
|
||||
|
||||
/*
|
||||
* Swap the OpenGL buffers, if double-buffering is supported.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
|
||||
|
||||
/*
|
||||
* Internal functions that should not be called unless you have read
|
||||
* and understood the source code for these functions.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
|
||||
extern DECLSPEC void SDLCALL SDL_GL_Lock(void);
|
||||
extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* These functions allow interaction with the window manager, if any. */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Sets/Gets the title and icon text of the display window (UTF-8 encoded)
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
|
||||
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
|
||||
|
||||
/*
|
||||
* Sets the icon for the display window.
|
||||
* This function must be called before the first call to SDL_SetVideoMode().
|
||||
* It takes an icon surface, and a mask in MSB format.
|
||||
* If 'mask' is NULL, the entire icon surface will be used as the icon.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
|
||||
|
||||
/*
|
||||
* This function iconifies the window, and returns 1 if it succeeded.
|
||||
* If the function succeeds, it generates an SDL_APPACTIVE loss event.
|
||||
* This function is a noop and returns 0 in non-windowed environments.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
|
||||
|
||||
/*
|
||||
* Toggle fullscreen mode without changing the contents of the screen.
|
||||
* If the display surface does not require locking before accessing
|
||||
* the pixel information, then the memory pointers will not change.
|
||||
*
|
||||
* If this function was able to toggle fullscreen mode (change from
|
||||
* running in a window to fullscreen, or vice-versa), it will return 1.
|
||||
* If it is not implemented, or fails, it returns 0.
|
||||
*
|
||||
* The next call to SDL_SetVideoMode() will set the mode fullscreen
|
||||
* attribute based on the flags parameter - if SDL_FULLSCREEN is not
|
||||
* set, then the display will be windowed by default where supported.
|
||||
*
|
||||
* This is currently only implemented in the X11 video driver.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface);
|
||||
|
||||
/*
|
||||
* This function allows you to set and query the input grab state of
|
||||
* the application. It returns the new input grab state.
|
||||
*/
|
||||
typedef enum {
|
||||
SDL_GRAB_QUERY = -1,
|
||||
SDL_GRAB_OFF = 0,
|
||||
SDL_GRAB_ON = 1,
|
||||
SDL_GRAB_FULLSCREEN /* Used internally */
|
||||
} SDL_GrabMode;
|
||||
/*
|
||||
* Grabbing means that the mouse is confined to the application window,
|
||||
* and nearly all keyboard input is passed directly to the application,
|
||||
* and not interpreted by a window manager, if any.
|
||||
*/
|
||||
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
|
||||
|
||||
/* Not in public API at the moment - do not use! */
|
||||
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
|
||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_video_h */
|
156
build/linux/libs/sdl-1.2.13/include/begin_code.h
Normal file
156
build/linux/libs/sdl-1.2.13/include/begin_code.h
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2004 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This file sets things up for C dynamic library function definitions,
|
||||
static inlined functions, and structures aligned at 4-byte alignment.
|
||||
If you don't like ugly C preprocessor code, don't look at this file. :)
|
||||
*/
|
||||
|
||||
/* This shouldn't be nested -- included it around code only. */
|
||||
#ifdef _begin_code_h
|
||||
#error Nested inclusion of begin_code.h
|
||||
#endif
|
||||
#define _begin_code_h
|
||||
|
||||
/* Some compilers use a special export keyword */
|
||||
#ifndef DECLSPEC
|
||||
# if defined(__BEOS__)
|
||||
# if defined(__GNUC__)
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# else
|
||||
# define DECLSPEC __declspec(export)
|
||||
# endif
|
||||
# elif defined(__WIN32__)
|
||||
# ifdef __BORLANDC__
|
||||
# ifdef BUILD_SDL
|
||||
# define DECLSPEC
|
||||
# else
|
||||
# define DECLSPEC __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# endif
|
||||
# elif defined(__OS2__)
|
||||
# ifdef __WATCOMC__
|
||||
# ifdef BUILD_SDL
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# else
|
||||
# define DECLSPEC
|
||||
# endif
|
||||
# else
|
||||
# define DECLSPEC
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define DECLSPEC __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define DECLSPEC
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* By default SDL uses the C calling convention */
|
||||
#ifndef SDLCALL
|
||||
#if defined(__WIN32__) && !defined(__GNUC__)
|
||||
#define SDLCALL __cdecl
|
||||
#else
|
||||
#ifdef __OS2__
|
||||
/* But on OS/2, we use the _System calling convention */
|
||||
/* to be compatible with every compiler */
|
||||
#define SDLCALL _System
|
||||
#else
|
||||
#define SDLCALL
|
||||
#endif
|
||||
#endif
|
||||
#endif /* SDLCALL */
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#ifndef EKA2
|
||||
#undef DECLSPEC
|
||||
#define DECLSPEC
|
||||
#elif !defined(__WINS__)
|
||||
#undef DECLSPEC
|
||||
#define DECLSPEC __declspec(dllexport)
|
||||
#endif /* !EKA2 */
|
||||
#endif /* __SYMBIAN32__ */
|
||||
|
||||
/* Force structure packing at 4 byte alignment.
|
||||
This is necessary if the header is included in code which has structure
|
||||
packing set to an alternate value, say for loading structures from disk.
|
||||
The packing is reset to the previous value in close_code.h
|
||||
*/
|
||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef __BORLANDC__
|
||||
#pragma nopackwarning
|
||||
#endif
|
||||
#pragma pack(push,4)
|
||||
#elif (defined(__MWERKS__) && defined(__MACOS__))
|
||||
#pragma options align=mac68k4byte
|
||||
#pragma enumsalwaysint on
|
||||
#endif /* Compiler needs structure packing set */
|
||||
|
||||
/* Set up compiler-specific options for inlining functions */
|
||||
#ifndef SDL_INLINE_OKAY
|
||||
#ifdef __GNUC__
|
||||
#define SDL_INLINE_OKAY
|
||||
#else
|
||||
/* Add any special compiler-specific cases here */
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
|
||||
defined(__DMC__) || defined(__SC__) || \
|
||||
defined(__WATCOMC__) || defined(__LCC__) || \
|
||||
defined(__DECC) || defined(__EABI__)
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
#define SDL_INLINE_OKAY
|
||||
#else
|
||||
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
|
||||
#ifndef __inline__
|
||||
#define __inline__ inline
|
||||
#endif
|
||||
#define SDL_INLINE_OKAY
|
||||
#endif /* Not a funky compiler */
|
||||
#endif /* Visual C++ */
|
||||
#endif /* GNU C */
|
||||
#endif /* SDL_INLINE_OKAY */
|
||||
|
||||
/* If inlining isn't supported, remove "__inline__", turning static
|
||||
inlined functions into static functions (resulting in code bloat
|
||||
in all files which include the offending header files)
|
||||
*/
|
||||
#ifndef SDL_INLINE_OKAY
|
||||
#define __inline__
|
||||
#endif
|
||||
|
||||
/* Apparently this is needed by several Windows compilers */
|
||||
#if !defined(__MACH__)
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif /* NULL */
|
||||
#endif /* ! Mac OS X - breaks precompiled headers */
|
41
build/linux/libs/sdl-1.2.13/include/close_code.h
Normal file
41
build/linux/libs/sdl-1.2.13/include/close_code.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2004 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This file reverses the effects of begin_code.h and should be included
|
||||
after you finish any function and structure declarations in your headers
|
||||
*/
|
||||
|
||||
#undef _begin_code_h
|
||||
|
||||
/* Reset structure packing at previous byte alignment */
|
||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
|
||||
#ifdef __BORLANDC__
|
||||
#pragma nopackwarning
|
||||
#endif
|
||||
#if (defined(__MWERKS__) && defined(__MACOS__))
|
||||
#pragma options align=reset
|
||||
#pragma enumsalwaysint reset
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* Compiler needs structure packing set */
|
||||
|
116
build/linux/libs/sdl_image-1.2.6/include/SDL_image.h
Normal file
116
build/linux/libs/sdl_image-1.2.6/include/SDL_image.h
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* A simple library to load images of various formats as SDL surfaces */
|
||||
|
||||
#ifndef _SDL_IMAGE_H
|
||||
#define _SDL_IMAGE_H
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_version.h"
|
||||
#include "begin_code.h"
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||
*/
|
||||
#define SDL_IMAGE_MAJOR_VERSION 1
|
||||
#define SDL_IMAGE_MINOR_VERSION 2
|
||||
#define SDL_IMAGE_PATCHLEVEL 6
|
||||
|
||||
/* This macro can be used to fill a version structure with the compile-time
|
||||
* version of the SDL_image library.
|
||||
*/
|
||||
#define SDL_IMAGE_VERSION(X) \
|
||||
{ \
|
||||
(X)->major = SDL_IMAGE_MAJOR_VERSION; \
|
||||
(X)->minor = SDL_IMAGE_MINOR_VERSION; \
|
||||
(X)->patch = SDL_IMAGE_PATCHLEVEL; \
|
||||
}
|
||||
|
||||
/* This function gets the version of the dynamically linked SDL_image library.
|
||||
it should NOT be used to fill a version structure, instead you should
|
||||
use the SDL_IMAGE_VERSION() macro.
|
||||
*/
|
||||
extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);
|
||||
|
||||
/* Load an image from an SDL data source.
|
||||
The 'type' may be one of: "BMP", "GIF", "PNG", etc.
|
||||
|
||||
If the image format supports a transparent pixel, SDL will set the
|
||||
colorkey for the surface. You can enable RLE acceleration on the
|
||||
surface afterwards by calling:
|
||||
SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);
|
||||
/* Convenience functions */
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
|
||||
|
||||
/* Invert the alpha of a surface for use with OpenGL
|
||||
This function is now a no-op, and only provided for backwards compatibility.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL IMG_InvertAlpha(int on);
|
||||
|
||||
/* Functions to detect a file type, given a seekable source */
|
||||
extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
|
||||
|
||||
/* Individual loading functions */
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
|
||||
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
|
||||
|
||||
/* We'll use SDL for reporting errors */
|
||||
#define IMG_SetError SDL_SetError
|
||||
#define IMG_GetError SDL_GetError
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_IMAGE_H */
|
319
build/linux/libs/tinyxml-2.5.3/include/tinystr.h
Normal file
319
build/linux/libs/tinyxml-2.5.3/include/tinystr.h
Normal file
@ -0,0 +1,319 @@
|
||||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original file by Yves Berquin.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005.
|
||||
*
|
||||
* - completely rewritten. compact, clean, and fast implementation.
|
||||
* - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems)
|
||||
* - fixed reserve() to work as per specification.
|
||||
* - fixed buggy compares operator==(), operator<(), and operator>()
|
||||
* - fixed operator+=() to take a const ref argument, following spec.
|
||||
* - added "copy" constructor with length, and most compare operators.
|
||||
* - added swap(), clear(), size(), capacity(), operator+().
|
||||
*/
|
||||
|
||||
#ifndef TIXML_USE_STL
|
||||
|
||||
#ifndef TIXML_STRING_INCLUDED
|
||||
#define TIXML_STRING_INCLUDED
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
/* The support for explicit isn't that universal, and it isn't really
|
||||
required - it is used to check that the TiXmlString class isn't incorrectly
|
||||
used. Be nice to old compilers and macro it here:
|
||||
*/
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
|
||||
// Microsoft visual studio, version 6 and higher.
|
||||
#define TIXML_EXPLICIT explicit
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
|
||||
// GCC version 3 and higher.s
|
||||
#define TIXML_EXPLICIT explicit
|
||||
#else
|
||||
#define TIXML_EXPLICIT
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TiXmlString is an emulation of a subset of the std::string template.
|
||||
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
|
||||
Only the member functions relevant to the TinyXML project have been implemented.
|
||||
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
|
||||
a string and there's no more room, we allocate a buffer twice as big as we need.
|
||||
*/
|
||||
class TiXmlString
|
||||
{
|
||||
public :
|
||||
// The size type used
|
||||
typedef size_t size_type;
|
||||
|
||||
// Error value for find primitive
|
||||
static const size_type npos; // = -1;
|
||||
|
||||
|
||||
// TiXmlString empty constructor
|
||||
TiXmlString () : rep_(&nullrep_)
|
||||
{
|
||||
}
|
||||
|
||||
// TiXmlString copy constructor
|
||||
TiXmlString ( const TiXmlString & copy) : rep_(0)
|
||||
{
|
||||
init(copy.length());
|
||||
memcpy(start(), copy.data(), length());
|
||||
}
|
||||
|
||||
// TiXmlString constructor, based on a string
|
||||
TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
|
||||
{
|
||||
init( static_cast<size_type>( strlen(copy) ));
|
||||
memcpy(start(), copy, length());
|
||||
}
|
||||
|
||||
// TiXmlString constructor, based on a string
|
||||
TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
|
||||
{
|
||||
init(len);
|
||||
memcpy(start(), str, len);
|
||||
}
|
||||
|
||||
// TiXmlString destructor
|
||||
~TiXmlString ()
|
||||
{
|
||||
quit();
|
||||
}
|
||||
|
||||
// = operator
|
||||
TiXmlString& operator = (const char * copy)
|
||||
{
|
||||
return assign( copy, (size_type)strlen(copy));
|
||||
}
|
||||
|
||||
// = operator
|
||||
TiXmlString& operator = (const TiXmlString & copy)
|
||||
{
|
||||
return assign(copy.start(), copy.length());
|
||||
}
|
||||
|
||||
|
||||
// += operator. Maps to append
|
||||
TiXmlString& operator += (const char * suffix)
|
||||
{
|
||||
return append(suffix, static_cast<size_type>( strlen(suffix) ));
|
||||
}
|
||||
|
||||
// += operator. Maps to append
|
||||
TiXmlString& operator += (char single)
|
||||
{
|
||||
return append(&single, 1);
|
||||
}
|
||||
|
||||
// += operator. Maps to append
|
||||
TiXmlString& operator += (const TiXmlString & suffix)
|
||||
{
|
||||
return append(suffix.data(), suffix.length());
|
||||
}
|
||||
|
||||
|
||||
// Convert a TiXmlString into a null-terminated char *
|
||||
const char * c_str () const { return rep_->str; }
|
||||
|
||||
// Convert a TiXmlString into a char * (need not be null terminated).
|
||||
const char * data () const { return rep_->str; }
|
||||
|
||||
// Return the length of a TiXmlString
|
||||
size_type length () const { return rep_->size; }
|
||||
|
||||
// Alias for length()
|
||||
size_type size () const { return rep_->size; }
|
||||
|
||||
// Checks if a TiXmlString is empty
|
||||
bool empty () const { return rep_->size == 0; }
|
||||
|
||||
// Return capacity of string
|
||||
size_type capacity () const { return rep_->capacity; }
|
||||
|
||||
|
||||
// single char extraction
|
||||
const char& at (size_type index) const
|
||||
{
|
||||
assert( index < length() );
|
||||
return rep_->str[ index ];
|
||||
}
|
||||
|
||||
// [] operator
|
||||
char& operator [] (size_type index) const
|
||||
{
|
||||
assert( index < length() );
|
||||
return rep_->str[ index ];
|
||||
}
|
||||
|
||||
// find a char in a string. Return TiXmlString::npos if not found
|
||||
size_type find (char lookup) const
|
||||
{
|
||||
return find(lookup, 0);
|
||||
}
|
||||
|
||||
// find a char in a string from an offset. Return TiXmlString::npos if not found
|
||||
size_type find (char tofind, size_type offset) const
|
||||
{
|
||||
if (offset >= length()) return npos;
|
||||
|
||||
for (const char* p = c_str() + offset; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == tofind) return static_cast< size_type >( p - c_str() );
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
void clear ()
|
||||
{
|
||||
//Lee:
|
||||
//The original was just too strange, though correct:
|
||||
// TiXmlString().swap(*this);
|
||||
//Instead use the quit & re-init:
|
||||
quit();
|
||||
init(0,0);
|
||||
}
|
||||
|
||||
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this
|
||||
function DOES NOT clear the content of the TiXmlString if any exists.
|
||||
*/
|
||||
void reserve (size_type cap);
|
||||
|
||||
TiXmlString& assign (const char* str, size_type len);
|
||||
|
||||
TiXmlString& append (const char* str, size_type len);
|
||||
|
||||
void swap (TiXmlString& other)
|
||||
{
|
||||
Rep* r = rep_;
|
||||
rep_ = other.rep_;
|
||||
other.rep_ = r;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void init(size_type sz) { init(sz, sz); }
|
||||
void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
|
||||
char* start() const { return rep_->str; }
|
||||
char* finish() const { return rep_->str + rep_->size; }
|
||||
|
||||
struct Rep
|
||||
{
|
||||
size_type size, capacity;
|
||||
char str[1];
|
||||
};
|
||||
|
||||
void init(size_type sz, size_type cap)
|
||||
{
|
||||
if (cap)
|
||||
{
|
||||
// Lee: the original form:
|
||||
// rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
|
||||
// doesn't work in some cases of new being overloaded. Switching
|
||||
// to the normal allocation, although use an 'int' for systems
|
||||
// that are overly picky about structure alignment.
|
||||
const size_type bytesNeeded = sizeof(Rep) + cap;
|
||||
const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
|
||||
rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
|
||||
|
||||
rep_->str[ rep_->size = sz ] = '\0';
|
||||
rep_->capacity = cap;
|
||||
}
|
||||
else
|
||||
{
|
||||
rep_ = &nullrep_;
|
||||
}
|
||||
}
|
||||
|
||||
void quit()
|
||||
{
|
||||
if (rep_ != &nullrep_)
|
||||
{
|
||||
// The rep_ is really an array of ints. (see the allocator, above).
|
||||
// Cast it back before delete, so the compiler won't incorrectly call destructors.
|
||||
delete [] ( reinterpret_cast<int*>( rep_ ) );
|
||||
}
|
||||
}
|
||||
|
||||
Rep * rep_;
|
||||
static Rep nullrep_;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
inline bool operator == (const TiXmlString & a, const TiXmlString & b)
|
||||
{
|
||||
return ( a.length() == b.length() ) // optimization on some platforms
|
||||
&& ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
|
||||
}
|
||||
inline bool operator < (const TiXmlString & a, const TiXmlString & b)
|
||||
{
|
||||
return strcmp(a.c_str(), b.c_str()) < 0;
|
||||
}
|
||||
|
||||
inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
|
||||
inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
|
||||
inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
|
||||
inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
|
||||
|
||||
inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
|
||||
inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
|
||||
inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
|
||||
inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
|
||||
|
||||
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
|
||||
TiXmlString operator + (const TiXmlString & a, const char* b);
|
||||
TiXmlString operator + (const char* a, const TiXmlString & b);
|
||||
|
||||
|
||||
/*
|
||||
TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
|
||||
Only the operators that we need for TinyXML have been developped.
|
||||
*/
|
||||
class TiXmlOutStream : public TiXmlString
|
||||
{
|
||||
public :
|
||||
|
||||
// TiXmlOutStream << operator.
|
||||
TiXmlOutStream & operator << (const TiXmlString & in)
|
||||
{
|
||||
*this += in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// TiXmlOutStream << operator.
|
||||
TiXmlOutStream & operator << (const char * in)
|
||||
{
|
||||
*this += in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#endif // TIXML_STRING_INCLUDED
|
||||
#endif // TIXML_USE_STL
|
1802
build/linux/libs/tinyxml-2.5.3/include/tinyxml.h
Normal file
1802
build/linux/libs/tinyxml-2.5.3/include/tinyxml.h
Normal file
File diff suppressed because it is too large
Load Diff
241
build/linux/libs/vorbis-1.2.0/include/vorbis/codec.h
Normal file
241
build/linux/libs/vorbis-1.2.0/include/vorbis/codec.h
Normal file
@ -0,0 +1,241 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
|
||||
********************************************************************
|
||||
|
||||
function: libvorbis codec headers
|
||||
last mod: $Id: codec.h 13293 2007-07-24 00:09:47Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _vorbis_codec_h_
|
||||
#define _vorbis_codec_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
typedef struct vorbis_info{
|
||||
int version;
|
||||
int channels;
|
||||
long rate;
|
||||
|
||||
/* The below bitrate declarations are *hints*.
|
||||
Combinations of the three values carry the following implications:
|
||||
|
||||
all three set to the same value:
|
||||
implies a fixed rate bitstream
|
||||
only nominal set:
|
||||
implies a VBR stream that averages the nominal bitrate. No hard
|
||||
upper/lower limit
|
||||
upper and or lower set:
|
||||
implies a VBR bitstream that obeys the bitrate limits. nominal
|
||||
may also be set to give a nominal rate.
|
||||
none set:
|
||||
the coder does not care to speculate.
|
||||
*/
|
||||
|
||||
long bitrate_upper;
|
||||
long bitrate_nominal;
|
||||
long bitrate_lower;
|
||||
long bitrate_window;
|
||||
|
||||
void *codec_setup;
|
||||
} vorbis_info;
|
||||
|
||||
/* vorbis_dsp_state buffers the current vorbis audio
|
||||
analysis/synthesis state. The DSP state belongs to a specific
|
||||
logical bitstream ****************************************************/
|
||||
typedef struct vorbis_dsp_state{
|
||||
int analysisp;
|
||||
vorbis_info *vi;
|
||||
|
||||
float **pcm;
|
||||
float **pcmret;
|
||||
int pcm_storage;
|
||||
int pcm_current;
|
||||
int pcm_returned;
|
||||
|
||||
int preextrapolate;
|
||||
int eofflag;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
long centerW;
|
||||
|
||||
ogg_int64_t granulepos;
|
||||
ogg_int64_t sequence;
|
||||
|
||||
ogg_int64_t glue_bits;
|
||||
ogg_int64_t time_bits;
|
||||
ogg_int64_t floor_bits;
|
||||
ogg_int64_t res_bits;
|
||||
|
||||
void *backend_state;
|
||||
} vorbis_dsp_state;
|
||||
|
||||
typedef struct vorbis_block{
|
||||
/* necessary stream state for linking to the framing abstraction */
|
||||
float **pcm; /* this is a pointer into local storage */
|
||||
oggpack_buffer opb;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
int pcmend;
|
||||
int mode;
|
||||
|
||||
int eofflag;
|
||||
ogg_int64_t granulepos;
|
||||
ogg_int64_t sequence;
|
||||
vorbis_dsp_state *vd; /* For read-only access of configuration */
|
||||
|
||||
/* local storage to avoid remallocing; it's up to the mapping to
|
||||
structure it */
|
||||
void *localstore;
|
||||
long localtop;
|
||||
long localalloc;
|
||||
long totaluse;
|
||||
struct alloc_chain *reap;
|
||||
|
||||
/* bitmetrics for the frame */
|
||||
long glue_bits;
|
||||
long time_bits;
|
||||
long floor_bits;
|
||||
long res_bits;
|
||||
|
||||
void *internal;
|
||||
|
||||
} vorbis_block;
|
||||
|
||||
/* vorbis_block is a single block of data to be processed as part of
|
||||
the analysis/synthesis stream; it belongs to a specific logical
|
||||
bitstream, but is independant from other vorbis_blocks belonging to
|
||||
that logical bitstream. *************************************************/
|
||||
|
||||
struct alloc_chain{
|
||||
void *ptr;
|
||||
struct alloc_chain *next;
|
||||
};
|
||||
|
||||
/* vorbis_info contains all the setup information specific to the
|
||||
specific compression/decompression mode in progress (eg,
|
||||
psychoacoustic settings, channel setup, options, codebook
|
||||
etc). vorbis_info and substructures are in backends.h.
|
||||
*********************************************************************/
|
||||
|
||||
/* the comments are not part of vorbis_info so that vorbis_info can be
|
||||
static storage */
|
||||
typedef struct vorbis_comment{
|
||||
/* unlimited user comment fields. libvorbis writes 'libvorbis'
|
||||
whatever vendor is set to in encode */
|
||||
char **user_comments;
|
||||
int *comment_lengths;
|
||||
int comments;
|
||||
char *vendor;
|
||||
|
||||
} vorbis_comment;
|
||||
|
||||
|
||||
/* libvorbis encodes in two abstraction layers; first we perform DSP
|
||||
and produce a packet (see docs/analysis.txt). The packet is then
|
||||
coded into a framed OggSquish bitstream by the second layer (see
|
||||
docs/framing.txt). Decode is the reverse process; we sync/frame
|
||||
the bitstream and extract individual packets, then decode the
|
||||
packet back into PCM audio.
|
||||
|
||||
The extra framing/packetizing is used in streaming formats, such as
|
||||
files. Over the net (such as with UDP), the framing and
|
||||
packetization aren't necessary as they're provided by the transport
|
||||
and the streaming layer is not used */
|
||||
|
||||
/* Vorbis PRIMITIVES: general ***************************************/
|
||||
|
||||
extern void vorbis_info_init(vorbis_info *vi);
|
||||
extern void vorbis_info_clear(vorbis_info *vi);
|
||||
extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
|
||||
extern void vorbis_comment_init(vorbis_comment *vc);
|
||||
extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
|
||||
extern void vorbis_comment_add_tag(vorbis_comment *vc,
|
||||
char *tag, char *contents);
|
||||
extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
|
||||
extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
|
||||
extern void vorbis_comment_clear(vorbis_comment *vc);
|
||||
|
||||
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
|
||||
extern int vorbis_block_clear(vorbis_block *vb);
|
||||
extern void vorbis_dsp_clear(vorbis_dsp_state *v);
|
||||
extern double vorbis_granule_time(vorbis_dsp_state *v,
|
||||
ogg_int64_t granulepos);
|
||||
|
||||
/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
|
||||
|
||||
extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||
extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
|
||||
extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
||||
vorbis_comment *vc,
|
||||
ogg_packet *op,
|
||||
ogg_packet *op_comm,
|
||||
ogg_packet *op_code);
|
||||
extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
|
||||
extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
|
||||
extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
|
||||
extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
|
||||
|
||||
extern int vorbis_bitrate_addblock(vorbis_block *vb);
|
||||
extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
|
||||
ogg_packet *op);
|
||||
|
||||
/* Vorbis PRIMITIVES: synthesis layer *******************************/
|
||||
extern int vorbis_synthesis_idheader(ogg_packet *op);
|
||||
extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
|
||||
ogg_packet *op);
|
||||
|
||||
extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||
extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
|
||||
extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
|
||||
extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
|
||||
extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
|
||||
extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
|
||||
extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm);
|
||||
extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
|
||||
extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
|
||||
|
||||
extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag);
|
||||
extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
|
||||
|
||||
/* Vorbis ERRORS and return codes ***********************************/
|
||||
|
||||
#define OV_FALSE -1
|
||||
#define OV_EOF -2
|
||||
#define OV_HOLE -3
|
||||
|
||||
#define OV_EREAD -128
|
||||
#define OV_EFAULT -129
|
||||
#define OV_EIMPL -130
|
||||
#define OV_EINVAL -131
|
||||
#define OV_ENOTVORBIS -132
|
||||
#define OV_EBADHEADER -133
|
||||
#define OV_EVERSION -134
|
||||
#define OV_ENOTAUDIO -135
|
||||
#define OV_EBADPACKET -136
|
||||
#define OV_EBADLINK -137
|
||||
#define OV_ENOSEEK -138
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
112
build/linux/libs/vorbis-1.2.0/include/vorbis/vorbisenc.h
Normal file
112
build/linux/libs/vorbis-1.2.0/include/vorbis/vorbisenc.h
Normal file
@ -0,0 +1,112 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: vorbis encode-engine setup
|
||||
last mod: $Id: vorbisenc.h 13293 2007-07-24 00:09:47Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _OV_ENC_H_
|
||||
#define _OV_ENC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "codec.h"
|
||||
|
||||
extern int vorbis_encode_init(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
long max_bitrate,
|
||||
long nominal_bitrate,
|
||||
long min_bitrate);
|
||||
|
||||
extern int vorbis_encode_setup_managed(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
long max_bitrate,
|
||||
long nominal_bitrate,
|
||||
long min_bitrate);
|
||||
|
||||
extern int vorbis_encode_setup_vbr(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
float quality /* quality level from 0. (lo) to 1. (hi) */
|
||||
);
|
||||
|
||||
extern int vorbis_encode_init_vbr(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
float base_quality /* quality level from 0. (lo) to 1. (hi) */
|
||||
);
|
||||
|
||||
extern int vorbis_encode_setup_init(vorbis_info *vi);
|
||||
|
||||
extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
|
||||
|
||||
/* deprecated rate management supported only for compatability */
|
||||
#define OV_ECTL_RATEMANAGE_GET 0x10
|
||||
#define OV_ECTL_RATEMANAGE_SET 0x11
|
||||
#define OV_ECTL_RATEMANAGE_AVG 0x12
|
||||
#define OV_ECTL_RATEMANAGE_HARD 0x13
|
||||
|
||||
struct ovectl_ratemanage_arg {
|
||||
int management_active;
|
||||
|
||||
long bitrate_hard_min;
|
||||
long bitrate_hard_max;
|
||||
double bitrate_hard_window;
|
||||
|
||||
long bitrate_av_lo;
|
||||
long bitrate_av_hi;
|
||||
double bitrate_av_window;
|
||||
double bitrate_av_window_center;
|
||||
};
|
||||
|
||||
|
||||
/* new rate setup */
|
||||
#define OV_ECTL_RATEMANAGE2_GET 0x14
|
||||
#define OV_ECTL_RATEMANAGE2_SET 0x15
|
||||
|
||||
struct ovectl_ratemanage2_arg {
|
||||
int management_active;
|
||||
|
||||
long bitrate_limit_min_kbps;
|
||||
long bitrate_limit_max_kbps;
|
||||
long bitrate_limit_reservoir_bits;
|
||||
double bitrate_limit_reservoir_bias;
|
||||
|
||||
long bitrate_average_kbps;
|
||||
double bitrate_average_damping;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define OV_ECTL_LOWPASS_GET 0x20
|
||||
#define OV_ECTL_LOWPASS_SET 0x21
|
||||
|
||||
#define OV_ECTL_IBLOCK_GET 0x30
|
||||
#define OV_ECTL_IBLOCK_SET 0x31
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
183
build/linux/libs/vorbis-1.2.0/include/vorbis/vorbisfile.h
Normal file
183
build/linux/libs/vorbis-1.2.0/include/vorbis/vorbisfile.h
Normal file
@ -0,0 +1,183 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: stdio-based convenience library for opening/seeking/decoding
|
||||
last mod: $Id: vorbisfile.h 13293 2007-07-24 00:09:47Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _OV_FILE_H_
|
||||
#define _OV_FILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "codec.h"
|
||||
|
||||
/* The function prototypes for the callbacks are basically the same as for
|
||||
* the stdio functions fread, fseek, fclose, ftell.
|
||||
* The one difference is that the FILE * arguments have been replaced with
|
||||
* a void * - this is to be used as a pointer to whatever internal data these
|
||||
* functions might need. In the stdio case, it's just a FILE * cast to a void *
|
||||
*
|
||||
* If you use other functions, check the docs for these functions and return
|
||||
* the right values. For seek_func(), you *MUST* return -1 if the stream is
|
||||
* unseekable
|
||||
*/
|
||||
typedef struct {
|
||||
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
|
||||
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
|
||||
int (*close_func) (void *datasource);
|
||||
long (*tell_func) (void *datasource);
|
||||
} ov_callbacks;
|
||||
|
||||
/* a few sets of convenient callbacks, especially for use under
|
||||
* Windows where ov_open_callbacks() should always be used instead of
|
||||
* ov_open() to avoid problems with incompatable crt.o version linking
|
||||
* issues. */
|
||||
|
||||
static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
||||
if(f==NULL)return(-1);
|
||||
return fseek(f,off,whence);
|
||||
}
|
||||
|
||||
static ov_callbacks OV_CALLBACKS_DEFAULT = {
|
||||
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
||||
(int (*)(void *)) fclose,
|
||||
(long (*)(void *)) ftell
|
||||
};
|
||||
|
||||
static ov_callbacks OV_CALLBACKS_NOCLOSE = {
|
||||
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
||||
(int (*)(void *)) NULL,
|
||||
(long (*)(void *)) ftell
|
||||
};
|
||||
|
||||
static ov_callbacks OV_CALLBACKS_STREAMONLY = {
|
||||
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||
(int (*)(void *, ogg_int64_t, int)) NULL,
|
||||
(int (*)(void *)) fclose,
|
||||
(long (*)(void *)) NULL
|
||||
};
|
||||
|
||||
static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
|
||||
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||
(int (*)(void *, ogg_int64_t, int)) NULL,
|
||||
(int (*)(void *)) NULL,
|
||||
(long (*)(void *)) NULL
|
||||
};
|
||||
|
||||
#define NOTOPEN 0
|
||||
#define PARTOPEN 1
|
||||
#define OPENED 2
|
||||
#define STREAMSET 3
|
||||
#define INITSET 4
|
||||
|
||||
typedef struct OggVorbis_File {
|
||||
void *datasource; /* Pointer to a FILE *, etc. */
|
||||
int seekable;
|
||||
ogg_int64_t offset;
|
||||
ogg_int64_t end;
|
||||
ogg_sync_state oy;
|
||||
|
||||
/* If the FILE handle isn't seekable (eg, a pipe), only the current
|
||||
stream appears */
|
||||
int links;
|
||||
ogg_int64_t *offsets;
|
||||
ogg_int64_t *dataoffsets;
|
||||
long *serialnos;
|
||||
ogg_int64_t *pcmlengths; /* overloaded to maintain binary
|
||||
compatability; x2 size, stores both
|
||||
beginning and end values */
|
||||
vorbis_info *vi;
|
||||
vorbis_comment *vc;
|
||||
|
||||
/* Decoding working state local storage */
|
||||
ogg_int64_t pcm_offset;
|
||||
int ready_state;
|
||||
long current_serialno;
|
||||
int current_link;
|
||||
|
||||
double bittrack;
|
||||
double samptrack;
|
||||
|
||||
ogg_stream_state os; /* take physical pages, weld into a logical
|
||||
stream of packets */
|
||||
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
||||
vorbis_block vb; /* local working space for packet->PCM decode */
|
||||
|
||||
ov_callbacks callbacks;
|
||||
|
||||
} OggVorbis_File;
|
||||
|
||||
|
||||
extern int ov_clear(OggVorbis_File *vf);
|
||||
extern int ov_fopen(char *path,OggVorbis_File *vf);
|
||||
extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
|
||||
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
|
||||
char *initial, long ibytes, ov_callbacks callbacks);
|
||||
|
||||
extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
|
||||
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
|
||||
char *initial, long ibytes, ov_callbacks callbacks);
|
||||
extern int ov_test_open(OggVorbis_File *vf);
|
||||
|
||||
extern long ov_bitrate(OggVorbis_File *vf,int i);
|
||||
extern long ov_bitrate_instant(OggVorbis_File *vf);
|
||||
extern long ov_streams(OggVorbis_File *vf);
|
||||
extern long ov_seekable(OggVorbis_File *vf);
|
||||
extern long ov_serialnumber(OggVorbis_File *vf,int i);
|
||||
|
||||
extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
|
||||
extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
|
||||
extern double ov_time_total(OggVorbis_File *vf,int i);
|
||||
|
||||
extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_time_seek(OggVorbis_File *vf,double pos);
|
||||
extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
|
||||
|
||||
extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_time_seek_lap(OggVorbis_File *vf,double pos);
|
||||
extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos);
|
||||
|
||||
extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
|
||||
extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
|
||||
extern double ov_time_tell(OggVorbis_File *vf);
|
||||
|
||||
extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
|
||||
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
|
||||
|
||||
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
|
||||
int *bitstream);
|
||||
extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
|
||||
int bigendianp,int word,int sgned,int *bitstream);
|
||||
extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
|
||||
|
||||
extern int ov_halfrate(OggVorbis_File *vf,int flag);
|
||||
extern int ov_halfrate_p(OggVorbis_File *vf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
145
build/linux/rollmorad.cbp
Normal file
145
build/linux/rollmorad.cbp
Normal file
@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="rollmorad" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/rollmorad" prefix_auto="1" extension_auto="1" />
|
||||
<Option working_dir="../.." />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/rollmorad" prefix_auto="1" extension_auto="1" />
|
||||
<Option working_dir="../.." />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add directory="libs/box2d-svn/include/Include" />
|
||||
<Add directory="libs/ogg-1.1.3/include/" />
|
||||
<Add directory="libs/sdl-1.2.13/include" />
|
||||
<Add directory="libs/sdl_image-1.2.6/include" />
|
||||
<Add directory="libs/tinyxml-2.5.3/include" />
|
||||
<Add directory="libs/vorbis-1.2.0/include/" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="libs/sdl_image-1.2.6/lib/libSDL_image.a libs/sdl-1.2.13/lib/libSDL.a libs/sdl-1.2.13/lib/libSDLmain.a libs/sdl_image-1.2.6/lib/libpng.a libs/sdl_image-1.2.6/lib/libtiff.a libs/sdl_image-1.2.6/lib/libjpeg.a libs/sdl_image-1.2.6/lib/libz.a libs/vorbis-1.2.0/lib/libvorbisfile.a libs/vorbis-1.2.0/lib/libvorbis.a libs/ogg-1.1.3/lib/libogg.a libs/box2d-svn/lib/libbox2d.a libs/tinyxml-2.5.3/lib/libtinyxml.a -lGL -lGLU -lopenal" />
|
||||
<Add directory="libs/box2d-svn/lib" />
|
||||
<Add directory="libs/ogg-1.1.3/lib" />
|
||||
<Add directory="libs/sdl-1.2.13/lib" />
|
||||
<Add directory="libs/sdl_image-1.2.6/lib" />
|
||||
<Add directory="libs/tinyxml-2.5.3/lib" />
|
||||
<Add directory="libs/vorbis-1.2.0/lib" />
|
||||
</Linker>
|
||||
<Unit filename="../../src/application.cpp" />
|
||||
<Unit filename="../../src/application.h" />
|
||||
<Unit filename="../../src/basicparameter.h" />
|
||||
<Unit filename="../../src/basicresourcemanager.h" />
|
||||
<Unit filename="../../src/blendtransition.cpp" />
|
||||
<Unit filename="../../src/blendtransition.h" />
|
||||
<Unit filename="../../src/checkpointobject.cpp" />
|
||||
<Unit filename="../../src/checkpointobject.h" />
|
||||
<Unit filename="../../src/creditsstate.cpp" />
|
||||
<Unit filename="../../src/creditsstate.h" />
|
||||
<Unit filename="../../src/cubetransition.cpp" />
|
||||
<Unit filename="../../src/cubetransition.h" />
|
||||
<Unit filename="../../src/dummyobject.cpp" />
|
||||
<Unit filename="../../src/dummyobject.h" />
|
||||
<Unit filename="../../src/filelocator.cpp" />
|
||||
<Unit filename="../../src/filelocator.h" />
|
||||
<Unit filename="../../src/font.cpp" />
|
||||
<Unit filename="../../src/font.h" />
|
||||
<Unit filename="../../src/gamestate.cpp" />
|
||||
<Unit filename="../../src/gamestate.h" />
|
||||
<Unit filename="../../src/guhaselnutobject.cpp" />
|
||||
<Unit filename="../../src/guhaselnutobject.h" />
|
||||
<Unit filename="../../src/handle.h" />
|
||||
<Unit filename="../../src/highscoremanager.cpp" />
|
||||
<Unit filename="../../src/highscoremanager.h" />
|
||||
<Unit filename="../../src/highscorestate.cpp" />
|
||||
<Unit filename="../../src/highscorestate.h" />
|
||||
<Unit filename="../../src/homebaseobject.cpp" />
|
||||
<Unit filename="../../src/homebaseobject.h" />
|
||||
<Unit filename="../../src/imagelayer.cpp" />
|
||||
<Unit filename="../../src/imagelayer.h" />
|
||||
<Unit filename="../../src/kingareaobject.cpp" />
|
||||
<Unit filename="../../src/kingareaobject.h" />
|
||||
<Unit filename="../../src/layer.cpp" />
|
||||
<Unit filename="../../src/layer.h" />
|
||||
<Unit filename="../../src/level.cpp" />
|
||||
<Unit filename="../../src/level.h" />
|
||||
<Unit filename="../../src/main.cpp" />
|
||||
<Unit filename="../../src/mainmenustate.cpp" />
|
||||
<Unit filename="../../src/mainmenustate.h" />
|
||||
<Unit filename="../../src/mtrand.cpp" />
|
||||
<Unit filename="../../src/mtrand.h" />
|
||||
<Unit filename="../../src/noncopyable.h" />
|
||||
<Unit filename="../../src/object.cpp" />
|
||||
<Unit filename="../../src/object.h" />
|
||||
<Unit filename="../../src/parameter.h" />
|
||||
<Unit filename="../../src/parametermap.cpp" />
|
||||
<Unit filename="../../src/parametermap.h" />
|
||||
<Unit filename="../../src/pch.cpp" />
|
||||
<Unit filename="../../src/pch.h" />
|
||||
<Unit filename="../../src/pch.h.gch" />
|
||||
<Unit filename="../../src/physicsstate.cpp" />
|
||||
<Unit filename="../../src/physicsstate.h" />
|
||||
<Unit filename="../../src/playerobject.cpp" />
|
||||
<Unit filename="../../src/playerobject.h" />
|
||||
<Unit filename="../../src/referencecounted.cpp" />
|
||||
<Unit filename="../../src/referencecounted.h" />
|
||||
<Unit filename="../../src/resource.cpp" />
|
||||
<Unit filename="../../src/resource.h" />
|
||||
<Unit filename="../../src/resourcemanager.cpp" />
|
||||
<Unit filename="../../src/resourcemanager.h" />
|
||||
<Unit filename="../../src/rgba.cpp" />
|
||||
<Unit filename="../../src/rgba.h" />
|
||||
<Unit filename="../../src/simpleobject.cpp" />
|
||||
<Unit filename="../../src/simpleobject.h" />
|
||||
<Unit filename="../../src/sound.cpp" />
|
||||
<Unit filename="../../src/sound.h" />
|
||||
<Unit filename="../../src/soundinstance.cpp" />
|
||||
<Unit filename="../../src/soundinstance.h" />
|
||||
<Unit filename="../../src/state.cpp" />
|
||||
<Unit filename="../../src/state.h" />
|
||||
<Unit filename="../../src/textobject.cpp" />
|
||||
<Unit filename="../../src/textobject.h" />
|
||||
<Unit filename="../../src/texture.cpp" />
|
||||
<Unit filename="../../src/texture.h" />
|
||||
<Unit filename="../../src/tile.cpp" />
|
||||
<Unit filename="../../src/tile.h" />
|
||||
<Unit filename="../../src/tilemaplayer.cpp" />
|
||||
<Unit filename="../../src/tilemaplayer.h" />
|
||||
<Unit filename="../../src/tileset.cpp" />
|
||||
<Unit filename="../../src/tileset.h" />
|
||||
<Unit filename="../../src/transition.cpp" />
|
||||
<Unit filename="../../src/transition.h" />
|
||||
<Unit filename="../../src/transitions.h" />
|
||||
<Unit filename="../../src/utils.cpp" />
|
||||
<Unit filename="../../src/utils.h" />
|
||||
<Unit filename="../../src/vec2.h" />
|
||||
<Extensions>
|
||||
<envvars />
|
||||
<code_completion />
|
||||
<debugger />
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
6
build/linux/rollmorad.workspace
Normal file
6
build/linux/rollmorad.workspace
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_workspace_file>
|
||||
<Workspace title="Workspace">
|
||||
<Project filename="rollmorad.cbp" active="1" />
|
||||
</Workspace>
|
||||
</CodeBlocks_workspace_file>
|
5
build/linux/run.sh
Normal file
5
build/linux/run.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ../..
|
||||
build/linux/bin/rollmorad
|
||||
cd build/linux
|
28
build/osx-xcode/Info.plist
Normal file
28
build/osx-xcode/Info.plist
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//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>CFBundleIconFile</key>
|
||||
<string>OSXIcon</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.Rollmorad</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>SDLMain</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
build/osx-xcode/OSXIcon.icns
Normal file
BIN
build/osx-xcode/OSXIcon.icns
Normal file
Binary file not shown.
1356
build/osx-xcode/Rollmorad.xcodeproj/hopka.mode1
Normal file
1356
build/osx-xcode/Rollmorad.xcodeproj/hopka.mode1
Normal file
File diff suppressed because it is too large
Load Diff
2087
build/osx-xcode/Rollmorad.xcodeproj/hopka.pbxuser
Normal file
2087
build/osx-xcode/Rollmorad.xcodeproj/hopka.pbxuser
Normal file
File diff suppressed because it is too large
Load Diff
601
build/osx-xcode/Rollmorad.xcodeproj/project.pbxproj
Normal file
601
build/osx-xcode/Rollmorad.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,601 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 42;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A2C09D0888800EBEB88 /* SDLMain.m */; };
|
||||
FF2341D80E06BE4C003270AD /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF2341D70E06BE4C003270AD /* Ogg.framework */; };
|
||||
FF2341DB0E06BE51003270AD /* Ogg.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF2341D70E06BE4C003270AD /* Ogg.framework */; };
|
||||
FF2342160E06C081003270AD /* Vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF2342150E06C081003270AD /* Vorbis.framework */; };
|
||||
FF2342190E06C086003270AD /* Vorbis.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF2342150E06C081003270AD /* Vorbis.framework */; };
|
||||
FF2342760E06C36A003270AD /* TinyXML.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF2342750E06C36A003270AD /* TinyXML.framework */; };
|
||||
FF2342790E06C36B003270AD /* TinyXML.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF2342750E06C36A003270AD /* TinyXML.framework */; };
|
||||
FF2343B10E06C900003270AD /* SDL.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF5261530DB3E10F00C233B0 /* SDL.framework */; };
|
||||
FF2343BE0E06CA2C003270AD /* SDL_image.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF5261520DB3E10F00C233B0 /* SDL_image.framework */; };
|
||||
FF2344600E06D6E0003270AD /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF23445F0E06D6E0003270AD /* Cocoa.framework */; };
|
||||
FF307BBC0DF6B2B900723DAD /* kingareaobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF307BBA0DF6B2B900723DAD /* kingareaobject.cpp */; };
|
||||
FF3C4C490DC8A1EF008A5EC9 /* gamestate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF3C4C440DC8A1EF008A5EC9 /* gamestate.cpp */; };
|
||||
FF3C4C4B0DC8A1EF008A5EC9 /* resourcemanager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF3C4C460DC8A1EF008A5EC9 /* resourcemanager.cpp */; };
|
||||
FF3C4C4C0DC8A1EF008A5EC9 /* soundinstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF3C4C470DC8A1EF008A5EC9 /* soundinstance.cpp */; };
|
||||
FF44C9410DD0F11A00CF27C2 /* dummyobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF44C93D0DD0F11A00CF27C2 /* dummyobject.cpp */; };
|
||||
FF44C9430DD0F11A00CF27C2 /* object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF44C93F0DD0F11A00CF27C2 /* object.cpp */; };
|
||||
FF52614A0DB3E0F800C233B0 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF5261480DB3E0F800C233B0 /* OpenAL.framework */; };
|
||||
FF52614B0DB3E0F800C233B0 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF5261490DB3E0F800C233B0 /* OpenGL.framework */; };
|
||||
FF5261580DB3E10F00C233B0 /* SDL_image.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF5261520DB3E10F00C233B0 /* SDL_image.framework */; };
|
||||
FF5261590DB3E10F00C233B0 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF5261530DB3E10F00C233B0 /* SDL.framework */; };
|
||||
FF54725A0DBE892B00E7E990 /* application.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF5472420DBE892B00E7E990 /* application.cpp */; };
|
||||
FF54725D0DBE892B00E7E990 /* filelocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF5472450DBE892B00E7E990 /* filelocator.cpp */; };
|
||||
FF5472610DBE892B00E7E990 /* mainmenustate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF5472490DBE892B00E7E990 /* mainmenustate.cpp */; };
|
||||
FF5472630DBE892B00E7E990 /* pch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF54724B0DBE892B00E7E990 /* pch.cpp */; };
|
||||
FF5472650DBE892B00E7E990 /* referencecounted.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF54724D0DBE892B00E7E990 /* referencecounted.cpp */; };
|
||||
FF5472670DBE892B00E7E990 /* resource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF54724F0DBE892B00E7E990 /* resource.cpp */; };
|
||||
FF54726B0DBE892B00E7E990 /* sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF5472530DBE892B00E7E990 /* sound.cpp */; };
|
||||
FF54726D0DBE892B00E7E990 /* state.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF5472550DBE892B00E7E990 /* state.cpp */; };
|
||||
FF5472700DBE892B00E7E990 /* texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF5472580DBE892B00E7E990 /* texture.cpp */; };
|
||||
FF7703910E07B9C7004D2663 /* highscorestate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF77038F0E07B9C7004D2663 /* highscorestate.cpp */; };
|
||||
FF77087D0E07F4BF004D2663 /* checkpointobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF7708790E07F4BF004D2663 /* checkpointobject.cpp */; };
|
||||
FF77087E0E07F4BF004D2663 /* checkpointobject.h in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF77087A0E07F4BF004D2663 /* checkpointobject.h */; };
|
||||
FF77087F0E07F4BF004D2663 /* highscoremanager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF77087B0E07F4BF004D2663 /* highscoremanager.cpp */; };
|
||||
FF7708800E07F4BF004D2663 /* highscoremanager.h in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF77087C0E07F4BF004D2663 /* highscoremanager.h */; };
|
||||
FF7714190E0D0476004D2663 /* blendtransition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF7714120E0D0476004D2663 /* blendtransition.cpp */; };
|
||||
FF77141A0E0D0476004D2663 /* blendtransition.h in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF7714130E0D0476004D2663 /* blendtransition.h */; };
|
||||
FF77141B0E0D0476004D2663 /* cubetransition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF7714140E0D0476004D2663 /* cubetransition.cpp */; };
|
||||
FF77141C0E0D0476004D2663 /* cubetransition.h in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF7714150E0D0476004D2663 /* cubetransition.h */; };
|
||||
FF77141D0E0D0476004D2663 /* transition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF7714160E0D0476004D2663 /* transition.cpp */; };
|
||||
FF77141E0E0D0476004D2663 /* transition.h in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF7714170E0D0476004D2663 /* transition.h */; };
|
||||
FF77141F0E0D0476004D2663 /* transitions.h in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF7714180E0D0476004D2663 /* transitions.h */; };
|
||||
FF7DD1A60DF95DEC001F13B6 /* textobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF7DD1A40DF95DEC001F13B6 /* textobject.cpp */; };
|
||||
FF8100BA0DDB21CA00D2C185 /* Box2D.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF8100B90DDB21CA00D2C185 /* Box2D.framework */; };
|
||||
FF8100BD0DDB21CF00D2C185 /* Box2D.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = FF8100B90DDB21CA00D2C185 /* Box2D.framework */; };
|
||||
FF81F9980DD9C9E900D2C185 /* playerobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81F9940DD9C9E900D2C185 /* playerobject.cpp */; };
|
||||
FF81F99A0DD9C9E900D2C185 /* simpleobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81F9960DD9C9E900D2C185 /* simpleobject.cpp */; };
|
||||
FFC46DDC0E000C73005C71AA /* guhaselnutobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFC46DD80E000C73005C71AA /* guhaselnutobject.cpp */; };
|
||||
FFC46DDE0E000C73005C71AA /* homebaseobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFC46DDA0E000C73005C71AA /* homebaseobject.cpp */; };
|
||||
FFDD4A020E02D15700C03DED /* creditsstate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFDD4A000E02D15700C03DED /* creditsstate.cpp */; };
|
||||
FFE3CDD20DC61D5900B648F2 /* font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFE3CDC50DC61D5900B648F2 /* font.cpp */; };
|
||||
FFE3CDD30DC61D5900B648F2 /* mtrand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFE3CDC60DC61D5900B648F2 /* mtrand.cpp */; };
|
||||
FFE3CDD70DC61D5900B648F2 /* parametermap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFE3CDCA0DC61D5900B648F2 /* parametermap.cpp */; };
|
||||
FFE3CDD90DC61D5900B648F2 /* rgba.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFE3CDCC0DC61D5900B648F2 /* rgba.cpp */; };
|
||||
FFE3CDDB0DC61D5900B648F2 /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFE3CDCE0DC61D5900B648F2 /* utils.cpp */; };
|
||||
FFE3CE0A0DC61FCA00B648F2 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF5472480DBE892B00E7E990 /* main.cpp */; };
|
||||
FFF327430DC8CCD000CA42DF /* physicsstate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFF327410DC8CCD000CA42DF /* physicsstate.cpp */; };
|
||||
FFF32B030DCF4D6D00CA42DF /* imagelayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFF32AF70DCF4D6D00CA42DF /* imagelayer.cpp */; };
|
||||
FFF32B050DCF4D6D00CA42DF /* layer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFF32AF90DCF4D6D00CA42DF /* layer.cpp */; };
|
||||
FFF32B070DCF4D6D00CA42DF /* level.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFF32AFB0DCF4D6D00CA42DF /* level.cpp */; };
|
||||
FFF32B090DCF4D6D00CA42DF /* tile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFF32AFD0DCF4D6D00CA42DF /* tile.cpp */; };
|
||||
FFF32B0B0DCF4D6D00CA42DF /* tilemaplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFF32AFF0DCF4D6D00CA42DF /* tilemaplayer.cpp */; };
|
||||
FFF32B0D0DCF4D6D00CA42DF /* tileset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFF32B010DCF4D6D00CA42DF /* tileset.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
FF8100BD0DDB21CF00D2C185 /* Box2D.framework in Copy Frameworks into .app bundle */,
|
||||
FF2341DB0E06BE51003270AD /* Ogg.framework in Copy Frameworks into .app bundle */,
|
||||
FF2343B10E06C900003270AD /* SDL.framework in Copy Frameworks into .app bundle */,
|
||||
FF2343BE0E06CA2C003270AD /* SDL_image.framework in Copy Frameworks into .app bundle */,
|
||||
FF2342790E06C36B003270AD /* TinyXML.framework in Copy Frameworks into .app bundle */,
|
||||
FF2342190E06C086003270AD /* Vorbis.framework in Copy Frameworks into .app bundle */,
|
||||
FF77087E0E07F4BF004D2663 /* checkpointobject.h in Copy Frameworks into .app bundle */,
|
||||
FF7708800E07F4BF004D2663 /* highscoremanager.h in Copy Frameworks into .app bundle */,
|
||||
FF77141A0E0D0476004D2663 /* blendtransition.h in Copy Frameworks into .app bundle */,
|
||||
FF77141C0E0D0476004D2663 /* cubetransition.h in Copy Frameworks into .app bundle */,
|
||||
FF77141E0E0D0476004D2663 /* transition.h in Copy Frameworks into .app bundle */,
|
||||
FF77141F0E0D0476004D2663 /* transitions.h in Copy Frameworks into .app bundle */,
|
||||
);
|
||||
name = "Copy Frameworks into .app bundle";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
002F3A2B09D0888800EBEB88 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = SOURCE_ROOT; };
|
||||
002F3A2C09D0888800EBEB88 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = SOURCE_ROOT; };
|
||||
8D1107320486CEB800E47090 /* Rollmorad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Rollmorad.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FF2341D70E06BE4C003270AD /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = libs/Ogg.framework; sourceTree = SOURCE_ROOT; };
|
||||
FF2342150E06C081003270AD /* Vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Vorbis.framework; path = libs/Vorbis.framework; sourceTree = SOURCE_ROOT; };
|
||||
FF2342750E06C36A003270AD /* TinyXML.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TinyXML.framework; path = libs/TinyXML.framework; sourceTree = SOURCE_ROOT; };
|
||||
FF23445F0E06D6E0003270AD /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||
FF307BBA0DF6B2B900723DAD /* kingareaobject.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = kingareaobject.cpp; path = ../../src/kingareaobject.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF307BBB0DF6B2B900723DAD /* kingareaobject.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = kingareaobject.h; path = ../../src/kingareaobject.h; sourceTree = SOURCE_ROOT; };
|
||||
FF3C4C440DC8A1EF008A5EC9 /* gamestate.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = gamestate.cpp; path = ../../src/gamestate.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF3C4C450DC8A1EF008A5EC9 /* gamestate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = gamestate.h; path = ../../src/gamestate.h; sourceTree = SOURCE_ROOT; };
|
||||
FF3C4C460DC8A1EF008A5EC9 /* resourcemanager.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = resourcemanager.cpp; path = ../../src/resourcemanager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF3C4C470DC8A1EF008A5EC9 /* soundinstance.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = soundinstance.cpp; path = ../../src/soundinstance.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF3C4C480DC8A1EF008A5EC9 /* soundinstance.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = soundinstance.h; path = ../../src/soundinstance.h; sourceTree = SOURCE_ROOT; };
|
||||
FF44C93D0DD0F11A00CF27C2 /* dummyobject.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = dummyobject.cpp; path = ../../src/dummyobject.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF44C93E0DD0F11A00CF27C2 /* dummyobject.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = dummyobject.h; path = ../../src/dummyobject.h; sourceTree = SOURCE_ROOT; };
|
||||
FF44C93F0DD0F11A00CF27C2 /* object.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = object.cpp; path = ../../src/object.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF44C9400DD0F11A00CF27C2 /* object.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = object.h; path = ../../src/object.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5261480DB3E0F800C233B0 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = /System/Library/Frameworks/OpenAL.framework; sourceTree = "<absolute>"; };
|
||||
FF5261490DB3E0F800C233B0 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
|
||||
FF5261520DB3E10F00C233B0 /* SDL_image.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_image.framework; path = libs/SDL_image.framework; sourceTree = SOURCE_ROOT; };
|
||||
FF5261530DB3E10F00C233B0 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = libs/SDL.framework; sourceTree = SOURCE_ROOT; };
|
||||
FF5472420DBE892B00E7E990 /* application.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = application.cpp; path = ../../src/application.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF5472430DBE892B00E7E990 /* application.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = application.h; path = ../../src/application.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472440DBE892B00E7E990 /* basicresourcemanager.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = basicresourcemanager.h; path = ../../src/basicresourcemanager.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472450DBE892B00E7E990 /* filelocator.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = filelocator.cpp; path = ../../src/filelocator.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF5472460DBE892B00E7E990 /* filelocator.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = filelocator.h; path = ../../src/filelocator.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472470DBE892B00E7E990 /* handle.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = handle.h; path = ../../src/handle.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472480DBE892B00E7E990 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../../src/main.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF5472490DBE892B00E7E990 /* mainmenustate.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = mainmenustate.cpp; path = ../../src/mainmenustate.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF54724A0DBE892B00E7E990 /* mainmenustate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = mainmenustate.h; path = ../../src/mainmenustate.h; sourceTree = SOURCE_ROOT; };
|
||||
FF54724B0DBE892B00E7E990 /* pch.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = pch.cpp; path = ../../src/pch.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF54724C0DBE892B00E7E990 /* pch.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = pch.h; path = ../../src/pch.h; sourceTree = SOURCE_ROOT; };
|
||||
FF54724D0DBE892B00E7E990 /* referencecounted.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = referencecounted.cpp; path = ../../src/referencecounted.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF54724E0DBE892B00E7E990 /* referencecounted.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = referencecounted.h; path = ../../src/referencecounted.h; sourceTree = SOURCE_ROOT; };
|
||||
FF54724F0DBE892B00E7E990 /* resource.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = resource.cpp; path = ../../src/resource.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF5472500DBE892B00E7E990 /* resource.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = resource.h; path = ../../src/resource.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472520DBE892B00E7E990 /* resourcemanager.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = resourcemanager.h; path = ../../src/resourcemanager.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472530DBE892B00E7E990 /* sound.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = sound.cpp; path = ../../src/sound.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF5472540DBE892B00E7E990 /* sound.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = sound.h; path = ../../src/sound.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472550DBE892B00E7E990 /* state.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = state.cpp; path = ../../src/state.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF5472560DBE892B00E7E990 /* state.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = state.h; path = ../../src/state.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472580DBE892B00E7E990 /* texture.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = texture.cpp; path = ../../src/texture.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF5472590DBE892B00E7E990 /* texture.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = texture.h; path = ../../src/texture.h; sourceTree = SOURCE_ROOT; };
|
||||
FF5472980DBE8BC100E7E990 /* font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = font.h; path = ../../src/font.h; sourceTree = SOURCE_ROOT; };
|
||||
FF77038F0E07B9C7004D2663 /* highscorestate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = highscorestate.cpp; path = ../../src/highscorestate.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF7703900E07B9C7004D2663 /* highscorestate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = highscorestate.h; path = ../../src/highscorestate.h; sourceTree = SOURCE_ROOT; };
|
||||
FF7708790E07F4BF004D2663 /* checkpointobject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = checkpointobject.cpp; path = ../../src/checkpointobject.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF77087A0E07F4BF004D2663 /* checkpointobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = checkpointobject.h; path = ../../src/checkpointobject.h; sourceTree = SOURCE_ROOT; };
|
||||
FF77087B0E07F4BF004D2663 /* highscoremanager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = highscoremanager.cpp; path = ../../src/highscoremanager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF77087C0E07F4BF004D2663 /* highscoremanager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = highscoremanager.h; path = ../../src/highscoremanager.h; sourceTree = SOURCE_ROOT; };
|
||||
FF7714120E0D0476004D2663 /* blendtransition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = blendtransition.cpp; path = ../../src/blendtransition.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF7714130E0D0476004D2663 /* blendtransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blendtransition.h; path = ../../src/blendtransition.h; sourceTree = SOURCE_ROOT; };
|
||||
FF7714140E0D0476004D2663 /* cubetransition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cubetransition.cpp; path = ../../src/cubetransition.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF7714150E0D0476004D2663 /* cubetransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cubetransition.h; path = ../../src/cubetransition.h; sourceTree = SOURCE_ROOT; };
|
||||
FF7714160E0D0476004D2663 /* transition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = transition.cpp; path = ../../src/transition.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF7714170E0D0476004D2663 /* transition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = transition.h; path = ../../src/transition.h; sourceTree = SOURCE_ROOT; };
|
||||
FF7714180E0D0476004D2663 /* transitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = transitions.h; path = ../../src/transitions.h; sourceTree = SOURCE_ROOT; };
|
||||
FF7DD1A40DF95DEC001F13B6 /* textobject.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = textobject.cpp; path = ../../src/textobject.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF7DD1A50DF95DEC001F13B6 /* textobject.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = textobject.h; path = ../../src/textobject.h; sourceTree = SOURCE_ROOT; };
|
||||
FF8100B90DDB21CA00D2C185 /* Box2D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Box2D.framework; path = libs/Box2D.framework; sourceTree = SOURCE_ROOT; };
|
||||
FF81F9940DD9C9E900D2C185 /* playerobject.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = playerobject.cpp; path = ../../src/playerobject.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF81F9950DD9C9E900D2C185 /* playerobject.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = playerobject.h; path = ../../src/playerobject.h; sourceTree = SOURCE_ROOT; };
|
||||
FF81F9960DD9C9E900D2C185 /* simpleobject.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = simpleobject.cpp; path = ../../src/simpleobject.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FF81F9970DD9C9E900D2C185 /* simpleobject.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = simpleobject.h; path = ../../src/simpleobject.h; sourceTree = SOURCE_ROOT; };
|
||||
FFC46DD80E000C73005C71AA /* guhaselnutobject.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = guhaselnutobject.cpp; path = ../../src/guhaselnutobject.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFC46DD90E000C73005C71AA /* guhaselnutobject.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = guhaselnutobject.h; path = ../../src/guhaselnutobject.h; sourceTree = SOURCE_ROOT; };
|
||||
FFC46DDA0E000C73005C71AA /* homebaseobject.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = homebaseobject.cpp; path = ../../src/homebaseobject.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFC46DDB0E000C73005C71AA /* homebaseobject.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = homebaseobject.h; path = ../../src/homebaseobject.h; sourceTree = SOURCE_ROOT; };
|
||||
FFDD4A000E02D15700C03DED /* creditsstate.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = creditsstate.cpp; path = ../../src/creditsstate.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFDD4A010E02D15700C03DED /* creditsstate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = creditsstate.h; path = ../../src/creditsstate.h; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDC40DC61D5900B648F2 /* basicparameter.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = basicparameter.h; path = ../../src/basicparameter.h; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDC50DC61D5900B648F2 /* font.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = font.cpp; path = ../../src/font.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDC60DC61D5900B648F2 /* mtrand.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = mtrand.cpp; path = ../../src/mtrand.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDC70DC61D5900B648F2 /* mtrand.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = mtrand.h; path = ../../src/mtrand.h; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDC80DC61D5900B648F2 /* noncopyable.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = noncopyable.h; path = ../../src/noncopyable.h; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDC90DC61D5900B648F2 /* parameter.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = parameter.h; path = ../../src/parameter.h; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDCA0DC61D5900B648F2 /* parametermap.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = parametermap.cpp; path = ../../src/parametermap.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDCB0DC61D5900B648F2 /* parametermap.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = parametermap.h; path = ../../src/parametermap.h; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDCC0DC61D5900B648F2 /* rgba.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = rgba.cpp; path = ../../src/rgba.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDCD0DC61D5900B648F2 /* rgba.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = rgba.h; path = ../../src/rgba.h; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDCE0DC61D5900B648F2 /* utils.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = utils.cpp; path = ../../src/utils.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDCF0DC61D5900B648F2 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../src/utils.h; sourceTree = SOURCE_ROOT; };
|
||||
FFE3CDD00DC61D5900B648F2 /* vec2.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = vec2.h; path = ../../src/vec2.h; sourceTree = SOURCE_ROOT; };
|
||||
FFF327410DC8CCD000CA42DF /* physicsstate.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = physicsstate.cpp; path = ../../src/physicsstate.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFF327420DC8CCD000CA42DF /* physicsstate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = physicsstate.h; path = ../../src/physicsstate.h; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AF70DCF4D6D00CA42DF /* imagelayer.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = imagelayer.cpp; path = ../../src/imagelayer.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AF80DCF4D6D00CA42DF /* imagelayer.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = imagelayer.h; path = ../../src/imagelayer.h; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AF90DCF4D6D00CA42DF /* layer.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = layer.cpp; path = ../../src/layer.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AFA0DCF4D6D00CA42DF /* layer.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = layer.h; path = ../../src/layer.h; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AFB0DCF4D6D00CA42DF /* level.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = level.cpp; path = ../../src/level.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AFC0DCF4D6D00CA42DF /* level.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = level.h; path = ../../src/level.h; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AFD0DCF4D6D00CA42DF /* tile.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = tile.cpp; path = ../../src/tile.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AFE0DCF4D6D00CA42DF /* tile.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = tile.h; path = ../../src/tile.h; sourceTree = SOURCE_ROOT; };
|
||||
FFF32AFF0DCF4D6D00CA42DF /* tilemaplayer.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = tilemaplayer.cpp; path = ../../src/tilemaplayer.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFF32B000DCF4D6D00CA42DF /* tilemaplayer.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = tilemaplayer.h; path = ../../src/tilemaplayer.h; sourceTree = SOURCE_ROOT; };
|
||||
FFF32B010DCF4D6D00CA42DF /* tileset.cpp */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.cpp.cpp; name = tileset.cpp; path = ../../src/tileset.cpp; sourceTree = SOURCE_ROOT; };
|
||||
FFF32B020DCF4D6D00CA42DF /* tileset.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = tileset.h; path = ../../src/tileset.h; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
8D11072E0486CEB800E47090 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FF52614A0DB3E0F800C233B0 /* OpenAL.framework in Frameworks */,
|
||||
FF52614B0DB3E0F800C233B0 /* OpenGL.framework in Frameworks */,
|
||||
FF5261580DB3E10F00C233B0 /* SDL_image.framework in Frameworks */,
|
||||
FF5261590DB3E10F00C233B0 /* SDL.framework in Frameworks */,
|
||||
FF8100BA0DDB21CA00D2C185 /* Box2D.framework in Frameworks */,
|
||||
FF2341D80E06BE4C003270AD /* Ogg.framework in Frameworks */,
|
||||
FF2342160E06C081003270AD /* Vorbis.framework in Frameworks */,
|
||||
FF2342760E06C36A003270AD /* TinyXML.framework in Frameworks */,
|
||||
FF2344600E06D6E0003270AD /* Cocoa.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
080E96DDFE201D6D7F000001 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
002F3A2B09D0888800EBEB88 /* SDLMain.h */,
|
||||
002F3A2C09D0888800EBEB88 /* SDLMain.m */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FF23445F0E06D6E0003270AD /* Cocoa.framework */,
|
||||
FF2342750E06C36A003270AD /* TinyXML.framework */,
|
||||
FF2342150E06C081003270AD /* Vorbis.framework */,
|
||||
FF2341D70E06BE4C003270AD /* Ogg.framework */,
|
||||
FF8100B90DDB21CA00D2C185 /* Box2D.framework */,
|
||||
FF5261520DB3E10F00C233B0 /* SDL_image.framework */,
|
||||
FF5261530DB3E10F00C233B0 /* SDL.framework */,
|
||||
FF5261480DB3E0F800C233B0 /* OpenAL.framework */,
|
||||
FF5261490DB3E0F800C233B0 /* OpenGL.framework */,
|
||||
);
|
||||
name = "Linked Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = "Other Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8D1107320486CEB800E47090 /* Rollmorad.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97314FDCFA39411CA2CEA /* Rollmorad */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
080E96DDFE201D6D7F000001 /* Classes */,
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||
29B97317FDCFA39411CA2CEA /* Resources */,
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */,
|
||||
19C28FACFE9D520D11CA2CBB /* Products */,
|
||||
);
|
||||
name = Rollmorad;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FF7714120E0D0476004D2663 /* blendtransition.cpp */,
|
||||
FF7714130E0D0476004D2663 /* blendtransition.h */,
|
||||
FF7714140E0D0476004D2663 /* cubetransition.cpp */,
|
||||
FF7714150E0D0476004D2663 /* cubetransition.h */,
|
||||
FF7714160E0D0476004D2663 /* transition.cpp */,
|
||||
FF7714170E0D0476004D2663 /* transition.h */,
|
||||
FF7714180E0D0476004D2663 /* transitions.h */,
|
||||
FF7708790E07F4BF004D2663 /* checkpointobject.cpp */,
|
||||
FF77087A0E07F4BF004D2663 /* checkpointobject.h */,
|
||||
FF77087B0E07F4BF004D2663 /* highscoremanager.cpp */,
|
||||
FF77087C0E07F4BF004D2663 /* highscoremanager.h */,
|
||||
FF77038F0E07B9C7004D2663 /* highscorestate.cpp */,
|
||||
FF7703900E07B9C7004D2663 /* highscorestate.h */,
|
||||
FFDD4A000E02D15700C03DED /* creditsstate.cpp */,
|
||||
FFDD4A010E02D15700C03DED /* creditsstate.h */,
|
||||
FFC46DD80E000C73005C71AA /* guhaselnutobject.cpp */,
|
||||
FFC46DD90E000C73005C71AA /* guhaselnutobject.h */,
|
||||
FFC46DDA0E000C73005C71AA /* homebaseobject.cpp */,
|
||||
FFC46DDB0E000C73005C71AA /* homebaseobject.h */,
|
||||
FF7DD1A40DF95DEC001F13B6 /* textobject.cpp */,
|
||||
FF7DD1A50DF95DEC001F13B6 /* textobject.h */,
|
||||
FF307BBA0DF6B2B900723DAD /* kingareaobject.cpp */,
|
||||
FF307BBB0DF6B2B900723DAD /* kingareaobject.h */,
|
||||
FF81F9940DD9C9E900D2C185 /* playerobject.cpp */,
|
||||
FF81F9950DD9C9E900D2C185 /* playerobject.h */,
|
||||
FF81F9960DD9C9E900D2C185 /* simpleobject.cpp */,
|
||||
FF81F9970DD9C9E900D2C185 /* simpleobject.h */,
|
||||
FF44C93D0DD0F11A00CF27C2 /* dummyobject.cpp */,
|
||||
FF44C93E0DD0F11A00CF27C2 /* dummyobject.h */,
|
||||
FF44C93F0DD0F11A00CF27C2 /* object.cpp */,
|
||||
FF44C9400DD0F11A00CF27C2 /* object.h */,
|
||||
FFF32AF70DCF4D6D00CA42DF /* imagelayer.cpp */,
|
||||
FFF32AF80DCF4D6D00CA42DF /* imagelayer.h */,
|
||||
FFF32AF90DCF4D6D00CA42DF /* layer.cpp */,
|
||||
FFF32AFA0DCF4D6D00CA42DF /* layer.h */,
|
||||
FFF32AFB0DCF4D6D00CA42DF /* level.cpp */,
|
||||
FFF32AFC0DCF4D6D00CA42DF /* level.h */,
|
||||
FFF32AFD0DCF4D6D00CA42DF /* tile.cpp */,
|
||||
FFF32AFE0DCF4D6D00CA42DF /* tile.h */,
|
||||
FFF32AFF0DCF4D6D00CA42DF /* tilemaplayer.cpp */,
|
||||
FFF32B000DCF4D6D00CA42DF /* tilemaplayer.h */,
|
||||
FFF32B010DCF4D6D00CA42DF /* tileset.cpp */,
|
||||
FFF32B020DCF4D6D00CA42DF /* tileset.h */,
|
||||
FFF327410DC8CCD000CA42DF /* physicsstate.cpp */,
|
||||
FFF327420DC8CCD000CA42DF /* physicsstate.h */,
|
||||
FF3C4C440DC8A1EF008A5EC9 /* gamestate.cpp */,
|
||||
FF3C4C450DC8A1EF008A5EC9 /* gamestate.h */,
|
||||
FF3C4C460DC8A1EF008A5EC9 /* resourcemanager.cpp */,
|
||||
FF3C4C470DC8A1EF008A5EC9 /* soundinstance.cpp */,
|
||||
FF3C4C480DC8A1EF008A5EC9 /* soundinstance.h */,
|
||||
FFE3CDC40DC61D5900B648F2 /* basicparameter.h */,
|
||||
FFE3CDC50DC61D5900B648F2 /* font.cpp */,
|
||||
FFE3CDC60DC61D5900B648F2 /* mtrand.cpp */,
|
||||
FFE3CDC70DC61D5900B648F2 /* mtrand.h */,
|
||||
FFE3CDC80DC61D5900B648F2 /* noncopyable.h */,
|
||||
FFE3CDC90DC61D5900B648F2 /* parameter.h */,
|
||||
FFE3CDCA0DC61D5900B648F2 /* parametermap.cpp */,
|
||||
FFE3CDCB0DC61D5900B648F2 /* parametermap.h */,
|
||||
FFE3CDCC0DC61D5900B648F2 /* rgba.cpp */,
|
||||
FFE3CDCD0DC61D5900B648F2 /* rgba.h */,
|
||||
FFE3CDCE0DC61D5900B648F2 /* utils.cpp */,
|
||||
FFE3CDCF0DC61D5900B648F2 /* utils.h */,
|
||||
FFE3CDD00DC61D5900B648F2 /* vec2.h */,
|
||||
FF5472980DBE8BC100E7E990 /* font.h */,
|
||||
FF5472420DBE892B00E7E990 /* application.cpp */,
|
||||
FF5472430DBE892B00E7E990 /* application.h */,
|
||||
FF5472440DBE892B00E7E990 /* basicresourcemanager.h */,
|
||||
FF5472450DBE892B00E7E990 /* filelocator.cpp */,
|
||||
FF5472460DBE892B00E7E990 /* filelocator.h */,
|
||||
FF5472470DBE892B00E7E990 /* handle.h */,
|
||||
FF5472480DBE892B00E7E990 /* main.cpp */,
|
||||
FF5472490DBE892B00E7E990 /* mainmenustate.cpp */,
|
||||
FF54724A0DBE892B00E7E990 /* mainmenustate.h */,
|
||||
FF54724B0DBE892B00E7E990 /* pch.cpp */,
|
||||
FF54724C0DBE892B00E7E990 /* pch.h */,
|
||||
FF54724D0DBE892B00E7E990 /* referencecounted.cpp */,
|
||||
FF54724E0DBE892B00E7E990 /* referencecounted.h */,
|
||||
FF54724F0DBE892B00E7E990 /* resource.cpp */,
|
||||
FF5472500DBE892B00E7E990 /* resource.h */,
|
||||
FF5472520DBE892B00E7E990 /* resourcemanager.h */,
|
||||
FF5472530DBE892B00E7E990 /* sound.cpp */,
|
||||
FF5472540DBE892B00E7E990 /* sound.h */,
|
||||
FF5472550DBE892B00E7E990 /* state.cpp */,
|
||||
FF5472560DBE892B00E7E990 /* state.h */,
|
||||
FF5472580DBE892B00E7E990 /* texture.cpp */,
|
||||
FF5472590DBE892B00E7E990 /* texture.h */,
|
||||
);
|
||||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
|
||||
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8D1107260486CEB800E47090 /* Rollmorad */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Rollmorad" */;
|
||||
buildPhases = (
|
||||
FF2343D80E06D119003270AD /* ShellScript */,
|
||||
8D11072C0486CEB800E47090 /* Sources */,
|
||||
8D11072E0486CEB800E47090 /* Frameworks */,
|
||||
002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Rollmorad;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
productName = Rollmorad;
|
||||
productReference = 8D1107320486CEB800E47090 /* Rollmorad.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Rollmorad" */;
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* Rollmorad */;
|
||||
projectDirPath = "";
|
||||
targets = (
|
||||
8D1107260486CEB800E47090 /* Rollmorad */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
FF2343D80E06D119003270AD /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "rm -rf \"$BUILT_PRODUCTS_DIR/Rollmorad.app/Contents/Resources/\"*\ncp -Rf \"$PROJECT_DIR/../../data/\" \"$BUILT_PRODUCTS_DIR/Rollmorad.app/Contents/Resources\"\ncp \"$PROJECT_DIR/OSXIcon.icns\" \"$BUILT_PRODUCTS_DIR/Rollmorad.app/Contents/Resources\"";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8D11072C0486CEB800E47090 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */,
|
||||
FF54725A0DBE892B00E7E990 /* application.cpp in Sources */,
|
||||
FF54725D0DBE892B00E7E990 /* filelocator.cpp in Sources */,
|
||||
FF5472610DBE892B00E7E990 /* mainmenustate.cpp in Sources */,
|
||||
FF5472630DBE892B00E7E990 /* pch.cpp in Sources */,
|
||||
FF5472650DBE892B00E7E990 /* referencecounted.cpp in Sources */,
|
||||
FF5472670DBE892B00E7E990 /* resource.cpp in Sources */,
|
||||
FF54726B0DBE892B00E7E990 /* sound.cpp in Sources */,
|
||||
FF54726D0DBE892B00E7E990 /* state.cpp in Sources */,
|
||||
FF5472700DBE892B00E7E990 /* texture.cpp in Sources */,
|
||||
FFE3CDD20DC61D5900B648F2 /* font.cpp in Sources */,
|
||||
FFE3CDD30DC61D5900B648F2 /* mtrand.cpp in Sources */,
|
||||
FFE3CDD70DC61D5900B648F2 /* parametermap.cpp in Sources */,
|
||||
FFE3CDD90DC61D5900B648F2 /* rgba.cpp in Sources */,
|
||||
FFE3CDDB0DC61D5900B648F2 /* utils.cpp in Sources */,
|
||||
FFE3CE0A0DC61FCA00B648F2 /* main.cpp in Sources */,
|
||||
FF3C4C490DC8A1EF008A5EC9 /* gamestate.cpp in Sources */,
|
||||
FF3C4C4B0DC8A1EF008A5EC9 /* resourcemanager.cpp in Sources */,
|
||||
FF3C4C4C0DC8A1EF008A5EC9 /* soundinstance.cpp in Sources */,
|
||||
FFF327430DC8CCD000CA42DF /* physicsstate.cpp in Sources */,
|
||||
FFF32B030DCF4D6D00CA42DF /* imagelayer.cpp in Sources */,
|
||||
FFF32B050DCF4D6D00CA42DF /* layer.cpp in Sources */,
|
||||
FFF32B070DCF4D6D00CA42DF /* level.cpp in Sources */,
|
||||
FFF32B090DCF4D6D00CA42DF /* tile.cpp in Sources */,
|
||||
FFF32B0B0DCF4D6D00CA42DF /* tilemaplayer.cpp in Sources */,
|
||||
FFF32B0D0DCF4D6D00CA42DF /* tileset.cpp in Sources */,
|
||||
FF44C9410DD0F11A00CF27C2 /* dummyobject.cpp in Sources */,
|
||||
FF44C9430DD0F11A00CF27C2 /* object.cpp in Sources */,
|
||||
FF81F9980DD9C9E900D2C185 /* playerobject.cpp in Sources */,
|
||||
FF81F99A0DD9C9E900D2C185 /* simpleobject.cpp in Sources */,
|
||||
FF307BBC0DF6B2B900723DAD /* kingareaobject.cpp in Sources */,
|
||||
FF7DD1A60DF95DEC001F13B6 /* textobject.cpp in Sources */,
|
||||
FFC46DDC0E000C73005C71AA /* guhaselnutobject.cpp in Sources */,
|
||||
FFC46DDE0E000C73005C71AA /* homebaseobject.cpp in Sources */,
|
||||
FFDD4A020E02D15700C03DED /* creditsstate.cpp in Sources */,
|
||||
FF7703910E07B9C7004D2663 /* highscorestate.cpp in Sources */,
|
||||
FF77087D0E07F4BF004D2663 /* checkpointobject.cpp in Sources */,
|
||||
FF77087F0E07F4BF004D2663 /* highscoremanager.cpp in Sources */,
|
||||
FF7714190E0D0476004D2663 /* blendtransition.cpp in Sources */,
|
||||
FF77141B0E0D0476004D2663 /* cubetransition.cpp in Sources */,
|
||||
FF77141D0E0D0476004D2663 /* transition.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
C01FCF4B08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(inherited)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
PRODUCT_NAME = Rollmorad;
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C01FCF4C08A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(inherited)";
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
PRODUCT_NAME = Rollmorad;
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C01FCF4F08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
./libs,
|
||||
"$(FRAMEWORK_SEARCH_PATHS)",
|
||||
);
|
||||
GCC_AUTO_VECTORIZATION = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
_DEBUG,
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
./libs/SDL.framework/Headers,
|
||||
./libs/SDL_image.framework/Headers,
|
||||
./libs/Ogg.framework/Headers,
|
||||
./libs/Vorbis.framework/Headers,
|
||||
./libs/Box2D.framework/Headers,
|
||||
./libs/TinyXML.framework/Headers,
|
||||
/System/Library/Frameworks/OpenAL.framework/Headers,
|
||||
"$(HEADER_SEARCH_PATHS)",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C01FCF5008A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
./libs,
|
||||
"$(FRAMEWORK_SEARCH_PATHS)",
|
||||
);
|
||||
GCC_AUTO_VECTORIZATION = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
./libs/SDL.framework/Headers,
|
||||
./libs/SDL_image.framework/Headers,
|
||||
./libs/Ogg.framework/Headers,
|
||||
./libs/Vorbis.framework/Headers,
|
||||
./libs/Box2D.framework/Headers,
|
||||
./libs/TinyXML.framework/Headers,
|
||||
/System/Library/Frameworks/OpenAL.framework/Headers,
|
||||
"$(HEADER_SEARCH_PATHS)",
|
||||
);
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Rollmorad" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C01FCF4B08A954540054247B /* Debug */,
|
||||
C01FCF4C08A954540054247B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Rollmorad" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C01FCF4F08A954540054247B /* Debug */,
|
||||
C01FCF5008A954540054247B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
|
||||
}
|
11
build/osx-xcode/SDLMain.h
Normal file
11
build/osx-xcode/SDLMain.h
Normal file
@ -0,0 +1,11 @@
|
||||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
383
build/osx-xcode/SDLMain.m
Normal file
383
build/osx-xcode/SDLMain.m
Normal file
@ -0,0 +1,383 @@
|
||||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#import "SDL.h"
|
||||
#import "SDLMain.h"
|
||||
#import <sys/param.h> /* for MAXPATHLEN */
|
||||
#import <unistd.h>
|
||||
|
||||
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
||||
but the method still is there and works. To avoid warnings, we declare
|
||||
it ourselves here. */
|
||||
@interface NSApplication(SDL_Missing_Methods)
|
||||
- (void)setAppleMenu:(NSMenu *)menu;
|
||||
@end
|
||||
|
||||
/* Use this flag to determine whether we use SDLMain.nib or not */
|
||||
#define SDL_USE_NIB_FILE 0
|
||||
|
||||
/* Use this flag to determine whether we use CPS (docking) or not */
|
||||
#define SDL_USE_CPS 1
|
||||
#ifdef SDL_USE_CPS
|
||||
/* Portions of CPS.h */
|
||||
typedef struct CPSProcessSerNum
|
||||
{
|
||||
UInt32 lo;
|
||||
UInt32 hi;
|
||||
} CPSProcessSerNum;
|
||||
|
||||
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
|
||||
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
|
||||
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
|
||||
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
static int gArgc;
|
||||
static char **gArgv;
|
||||
static BOOL gFinderLaunch;
|
||||
static BOOL gCalledAppMainline = FALSE;
|
||||
|
||||
static NSString *getApplicationName(void)
|
||||
{
|
||||
NSDictionary *dict;
|
||||
NSString *appName = 0;
|
||||
|
||||
/* Determine the application name */
|
||||
dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
|
||||
if (dict)
|
||||
appName = [dict objectForKey: @"CFBundleName"];
|
||||
|
||||
if (![appName length])
|
||||
appName = [[NSProcessInfo processInfo] processName];
|
||||
|
||||
return appName;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* A helper category for NSString */
|
||||
@interface NSString (ReplaceSubString)
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface SDLApplication : NSApplication
|
||||
@end
|
||||
|
||||
@implementation SDLApplication
|
||||
/* Invoked from the Quit menu item */
|
||||
- (void)terminate:(id)sender
|
||||
{
|
||||
/* Post a SDL_QUIT event */
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
@end
|
||||
|
||||
/* The main class of the application, the application's delegate */
|
||||
@implementation SDLMain
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
- (void) setupWorkingDirectory:(BOOL)shouldChdir
|
||||
{
|
||||
if (shouldChdir)
|
||||
{
|
||||
char parentdir[MAXPATHLEN];
|
||||
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
|
||||
if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) {
|
||||
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
|
||||
}
|
||||
CFRelease(url);
|
||||
CFRelease(url2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
|
||||
/* Fix menu to contain the real app name instead of "SDL App" */
|
||||
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
|
||||
{
|
||||
NSRange aRange;
|
||||
NSEnumerator *enumerator;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
aRange = [[aMenu title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
|
||||
|
||||
enumerator = [[aMenu itemArray] objectEnumerator];
|
||||
while ((menuItem = [enumerator nextObject]))
|
||||
{
|
||||
aRange = [[menuItem title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
|
||||
if ([menuItem hasSubmenu])
|
||||
[self fixMenu:[menuItem submenu] withAppName:appName];
|
||||
}
|
||||
[ aMenu sizeToFit ];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void setApplicationMenu(void)
|
||||
{
|
||||
/* warning: this code is very odd */
|
||||
NSMenu *appleMenu;
|
||||
NSMenuItem *menuItem;
|
||||
NSString *title;
|
||||
NSString *appName;
|
||||
|
||||
appName = getApplicationName();
|
||||
appleMenu = [[NSMenu alloc] initWithTitle:@""];
|
||||
|
||||
/* Add menu items */
|
||||
title = [@"About " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Hide " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
|
||||
|
||||
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
||||
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
|
||||
|
||||
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Quit " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
|
||||
|
||||
/* Put menu into the menubar */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
[menuItem setSubmenu:appleMenu];
|
||||
[[NSApp mainMenu] addItem:menuItem];
|
||||
|
||||
/* Tell the application object that this is now the application menu */
|
||||
[NSApp setAppleMenu:appleMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[appleMenu release];
|
||||
[menuItem release];
|
||||
}
|
||||
|
||||
/* Create a window menu */
|
||||
static void setupWindowMenu(void)
|
||||
{
|
||||
NSMenu *windowMenu;
|
||||
NSMenuItem *windowMenuItem;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||
|
||||
/* "Minimize" item */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
|
||||
[windowMenu addItem:menuItem];
|
||||
[menuItem release];
|
||||
|
||||
/* Put menu into the menubar */
|
||||
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
|
||||
[windowMenuItem setSubmenu:windowMenu];
|
||||
[[NSApp mainMenu] addItem:windowMenuItem];
|
||||
|
||||
/* Tell the application object that this is now the window menu */
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[windowMenu release];
|
||||
[windowMenuItem release];
|
||||
}
|
||||
|
||||
/* Replacement for NSApplicationMain */
|
||||
static void CustomApplicationMain (int argc, char **argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
SDLMain *sdlMain;
|
||||
|
||||
/* Ensure the application object is initialised */
|
||||
[SDLApplication sharedApplication];
|
||||
|
||||
#ifdef SDL_USE_CPS
|
||||
{
|
||||
CPSProcessSerNum PSN;
|
||||
/* Tell the dock about us */
|
||||
if (!CPSGetCurrentProcess(&PSN))
|
||||
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
|
||||
if (!CPSSetFrontProcess(&PSN))
|
||||
[SDLApplication sharedApplication];
|
||||
}
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
/* Set up the menubar */
|
||||
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
||||
setApplicationMenu();
|
||||
setupWindowMenu();
|
||||
|
||||
/* Create SDLMain and make it the app delegate */
|
||||
sdlMain = [[SDLMain alloc] init];
|
||||
[NSApp setDelegate:sdlMain];
|
||||
|
||||
/* Start the main event loop */
|
||||
[NSApp run];
|
||||
|
||||
[sdlMain release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Catch document open requests...this lets us notice files when the app
|
||||
* was launched by double-clicking a document, or when a document was
|
||||
* dragged/dropped on the app's icon. You need to have a
|
||||
* CFBundleDocumentsType section in your Info.plist to get this message,
|
||||
* apparently.
|
||||
*
|
||||
* Files are added to gArgv, so to the app, they'll look like command line
|
||||
* arguments. Previously, apps launched from the finder had nothing but
|
||||
* an argv[0].
|
||||
*
|
||||
* This message may be received multiple times to open several docs on launch.
|
||||
*
|
||||
* This message is ignored once the app's mainline has been called.
|
||||
*/
|
||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||
{
|
||||
const char *temparg;
|
||||
size_t arglen;
|
||||
char *arg;
|
||||
char **newargv;
|
||||
|
||||
if (!gFinderLaunch) /* MacOS is passing command line args. */
|
||||
return FALSE;
|
||||
|
||||
if (gCalledAppMainline) /* app has started, ignore this document. */
|
||||
return FALSE;
|
||||
|
||||
temparg = [filename UTF8String];
|
||||
arglen = SDL_strlen(temparg) + 1;
|
||||
arg = (char *) SDL_malloc(arglen);
|
||||
if (arg == NULL)
|
||||
return FALSE;
|
||||
|
||||
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
|
||||
if (newargv == NULL)
|
||||
{
|
||||
SDL_free(arg);
|
||||
return FALSE;
|
||||
}
|
||||
gArgv = newargv;
|
||||
|
||||
SDL_strlcpy(arg, temparg, arglen);
|
||||
gArgv[gArgc++] = arg;
|
||||
gArgv[gArgc] = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Called when the internal event loop has just started running */
|
||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||
{
|
||||
int status;
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
[self setupWorkingDirectory:gFinderLaunch];
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* Set the main menu to contain the real app name instead of "SDL App" */
|
||||
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
|
||||
#endif
|
||||
|
||||
/* Hand off to main application code */
|
||||
gCalledAppMainline = TRUE;
|
||||
status = SDL_main (gArgc, gArgv);
|
||||
|
||||
/* We're done, thank you for playing */
|
||||
exit(status);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSString (ReplaceSubString)
|
||||
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
|
||||
{
|
||||
unsigned int bufferSize;
|
||||
unsigned int selfLen = [self length];
|
||||
unsigned int aStringLen = [aString length];
|
||||
unichar *buffer;
|
||||
NSRange localRange;
|
||||
NSString *result;
|
||||
|
||||
bufferSize = selfLen + aStringLen - aRange.length;
|
||||
buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
|
||||
|
||||
/* Get first part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aRange.location;
|
||||
[self getCharacters:buffer range:localRange];
|
||||
|
||||
/* Get middle part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aStringLen;
|
||||
[aString getCharacters:(buffer+aRange.location) range:localRange];
|
||||
|
||||
/* Get last part into buffer */
|
||||
localRange.location = aRange.location + aRange.length;
|
||||
localRange.length = selfLen - localRange.location;
|
||||
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
|
||||
|
||||
/* Build output string */
|
||||
result = [NSString stringWithCharacters:buffer length:bufferSize];
|
||||
|
||||
NSDeallocateMemoryPages(buffer, bufferSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif
|
||||
|
||||
|
||||
/* Main entry point to executable - should *not* be SDL_main! */
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
/* Copy the arguments into a global variable */
|
||||
/* This is passed if we are launched by double-clicking */
|
||||
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
|
||||
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
|
||||
gArgv[0] = argv[0];
|
||||
gArgv[1] = NULL;
|
||||
gArgc = 1;
|
||||
gFinderLaunch = YES;
|
||||
} else {
|
||||
int i;
|
||||
gArgc = argc;
|
||||
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
|
||||
for (i = 0; i <= argc; i++)
|
||||
gArgv[i] = argv[i];
|
||||
gFinderLaunch = NO;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
[SDLApplication poseAsClass:[NSApplication class]];
|
||||
NSApplicationMain (argc, argv);
|
||||
#else
|
||||
CustomApplicationMain (argc, argv);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
1
build/osx-xcode/libs/Box2D.framework/Box2D
Normal file
1
build/osx-xcode/libs/Box2D.framework/Box2D
Normal file
@ -0,0 +1 @@
|
||||
link Versions/Current/Box2D
|
1
build/osx-xcode/libs/Box2D.framework/Headers
Normal file
1
build/osx-xcode/libs/Box2D.framework/Headers
Normal file
@ -0,0 +1 @@
|
||||
link Versions/Current/Headers
|
1
build/osx-xcode/libs/Box2D.framework/Resources
Normal file
1
build/osx-xcode/libs/Box2D.framework/Resources
Normal file
@ -0,0 +1 @@
|
||||
link Versions/Current/Resources
|
BIN
build/osx-xcode/libs/Box2D.framework/Versions/A/Box2D
Normal file
BIN
build/osx-xcode/libs/Box2D.framework/Versions/A/Box2D
Normal file
Binary file not shown.
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef BOX2D_H
|
||||
#define BOX2D_H
|
||||
|
||||
/**
|
||||
\mainpage Box2D API Documentation
|
||||
|
||||
\section intro_sec Getting Started
|
||||
|
||||
For tutorials please see http://www.box2d.org/manual.html
|
||||
|
||||
For discussion please visit http://www.box2d.org/forum
|
||||
*/
|
||||
|
||||
// These include files constitute the main Box2D API
|
||||
|
||||
#include "../Source/Common/b2Settings.h"
|
||||
|
||||
#include "../Source/Collision/Shapes/b2CircleShape.h"
|
||||
#include "../Source/Collision/Shapes/b2PolygonShape.h"
|
||||
#include "../Source/Collision/b2BroadPhase.h"
|
||||
#include "../Source/Dynamics/b2WorldCallbacks.h"
|
||||
#include "../Source/Dynamics/b2World.h"
|
||||
#include "../Source/Dynamics/b2Body.h"
|
||||
|
||||
#include "../Source/Dynamics/Contacts/b2Contact.h"
|
||||
|
||||
#include "../Source/Dynamics/Joints/b2DistanceJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2MouseJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2PrismaticJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2RevoluteJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2PulleyJoint.h"
|
||||
#include "../Source/Dynamics/Joints/b2GearJoint.h"
|
||||
|
||||
#endif
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//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>Box2D</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.yourcocoaframework</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Box2D</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_CIRCLE_SHAPE_H
|
||||
#define B2_CIRCLE_SHAPE_H
|
||||
|
||||
#include "b2Shape.h"
|
||||
|
||||
/// This structure is used to build circle shapes.
|
||||
struct b2CircleDef : public b2ShapeDef
|
||||
{
|
||||
b2CircleDef()
|
||||
{
|
||||
type = e_circleShape;
|
||||
localPosition.SetZero();
|
||||
radius = 1.0f;
|
||||
}
|
||||
|
||||
b2Vec2 localPosition;
|
||||
float32 radius;
|
||||
};
|
||||
|
||||
/// A circle shape.
|
||||
class b2CircleShape : public b2Shape
|
||||
{
|
||||
public:
|
||||
/// @see b2Shape::TestPoint
|
||||
bool TestPoint(const b2XForm& transform, const b2Vec2& p) const;
|
||||
|
||||
/// @see b2Shape::TestSegment
|
||||
bool TestSegment( const b2XForm& transform,
|
||||
float32* lambda,
|
||||
b2Vec2* normal,
|
||||
const b2Segment& segment,
|
||||
float32 maxLambda) const;
|
||||
|
||||
/// @see b2Shape::ComputeAABB
|
||||
void ComputeAABB(b2AABB* aabb, const b2XForm& transform) const;
|
||||
|
||||
/// @see b2Shape::ComputeSweptAABB
|
||||
void ComputeSweptAABB( b2AABB* aabb,
|
||||
const b2XForm& transform1,
|
||||
const b2XForm& transform2) const;
|
||||
|
||||
/// @see b2Shape::ComputeMass
|
||||
void ComputeMass(b2MassData* massData) const;
|
||||
|
||||
/// Get the local position of this circle in its parent body.
|
||||
const b2Vec2& GetLocalPosition() const;
|
||||
|
||||
/// Get the radius of this circle.
|
||||
float32 GetRadius() const;
|
||||
|
||||
private:
|
||||
|
||||
friend class b2Shape;
|
||||
|
||||
b2CircleShape(const b2ShapeDef* def);
|
||||
|
||||
void UpdateSweepRadius(const b2Vec2& center);
|
||||
|
||||
// Local position in parent body
|
||||
b2Vec2 m_localPosition;
|
||||
float32 m_radius;
|
||||
};
|
||||
|
||||
inline const b2Vec2& b2CircleShape::GetLocalPosition() const
|
||||
{
|
||||
return m_localPosition;
|
||||
}
|
||||
|
||||
inline float32 b2CircleShape::GetRadius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_POLYGON_SHAPE_H
|
||||
#define B2_POLYGON_SHAPE_H
|
||||
|
||||
#include "b2Shape.h"
|
||||
|
||||
/// Convex polygon. The vertices must be in CCW order for a right-handed
|
||||
/// coordinate system with the z-axis coming out of the screen.
|
||||
struct b2PolygonDef : public b2ShapeDef
|
||||
{
|
||||
b2PolygonDef()
|
||||
{
|
||||
type = e_polygonShape;
|
||||
vertexCount = 0;
|
||||
}
|
||||
|
||||
/// Build vertices to represent an axis-aligned box.
|
||||
/// @param hx the half-width.
|
||||
/// @param hy the half-height.
|
||||
void SetAsBox(float32 hx, float32 hy);
|
||||
|
||||
/// Build vertices to represent an oriented box.
|
||||
/// @param hx the half-width.
|
||||
/// @param hy the half-height.
|
||||
/// @param center the center of the box in local coordinates.
|
||||
/// @param angle the rotation of the box in local coordinates.
|
||||
void SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle);
|
||||
|
||||
/// The polygon vertices in local coordinates.
|
||||
b2Vec2 vertices[b2_maxPolygonVertices];
|
||||
|
||||
/// The number of polygon vertices.
|
||||
int32 vertexCount;
|
||||
};
|
||||
|
||||
|
||||
/// A convex polygon.
|
||||
class b2PolygonShape : public b2Shape
|
||||
{
|
||||
public:
|
||||
/// @see b2Shape::TestPoint
|
||||
bool TestPoint(const b2XForm& transform, const b2Vec2& p) const;
|
||||
|
||||
/// @see b2Shape::TestSegment
|
||||
bool TestSegment( const b2XForm& transform,
|
||||
float32* lambda,
|
||||
b2Vec2* normal,
|
||||
const b2Segment& segment,
|
||||
float32 maxLambda) const;
|
||||
|
||||
/// @see b2Shape::ComputeAABB
|
||||
void ComputeAABB(b2AABB* aabb, const b2XForm& transform) const;
|
||||
|
||||
/// @see b2Shape::ComputeSweptAABB
|
||||
void ComputeSweptAABB( b2AABB* aabb,
|
||||
const b2XForm& transform1,
|
||||
const b2XForm& transform2) const;
|
||||
|
||||
/// @see b2Shape::ComputeMass
|
||||
void ComputeMass(b2MassData* massData) const;
|
||||
|
||||
/// Get the oriented bounding box relative to the parent body.
|
||||
const b2OBB& GetOBB() const;
|
||||
|
||||
/// Get local centroid relative to the parent body.
|
||||
const b2Vec2& GetCentroid() const;
|
||||
|
||||
/// Get the vertex count.
|
||||
int32 GetVertexCount() const;
|
||||
|
||||
/// Get the vertices in local coordinates.
|
||||
const b2Vec2* GetVertices() const;
|
||||
|
||||
/// Get the core vertices in local coordinates. These vertices
|
||||
/// represent a smaller polygon that is used for time of impact
|
||||
/// computations.
|
||||
const b2Vec2* GetCoreVertices() const;
|
||||
|
||||
/// Get the edge normal vectors. There is one for each vertex.
|
||||
const b2Vec2* GetNormals() const;
|
||||
|
||||
/// Get the first vertex and apply the supplied transform.
|
||||
b2Vec2 GetFirstVertex(const b2XForm& xf) const;
|
||||
|
||||
/// Get the centroid and apply the supplied transform.
|
||||
b2Vec2 Centroid(const b2XForm& xf) const;
|
||||
|
||||
/// Get the support point in the given world direction.
|
||||
/// Use the supplied transform.
|
||||
b2Vec2 Support(const b2XForm& xf, const b2Vec2& d) const;
|
||||
|
||||
private:
|
||||
|
||||
friend class b2Shape;
|
||||
|
||||
b2PolygonShape(const b2ShapeDef* def);
|
||||
|
||||
void UpdateSweepRadius(const b2Vec2& center);
|
||||
|
||||
// Local position of the polygon centroid.
|
||||
b2Vec2 m_centroid;
|
||||
|
||||
b2OBB m_obb;
|
||||
|
||||
b2Vec2 m_vertices[b2_maxPolygonVertices];
|
||||
b2Vec2 m_normals[b2_maxPolygonVertices];
|
||||
b2Vec2 m_coreVertices[b2_maxPolygonVertices];
|
||||
int32 m_vertexCount;
|
||||
};
|
||||
|
||||
inline b2Vec2 b2PolygonShape::GetFirstVertex(const b2XForm& xf) const
|
||||
{
|
||||
return b2Mul(xf, m_coreVertices[0]);
|
||||
}
|
||||
|
||||
inline const b2OBB& b2PolygonShape::GetOBB() const
|
||||
{
|
||||
return m_obb;
|
||||
}
|
||||
|
||||
inline const b2Vec2& b2PolygonShape::GetCentroid() const
|
||||
{
|
||||
return m_centroid;
|
||||
}
|
||||
|
||||
inline int32 b2PolygonShape::GetVertexCount() const
|
||||
{
|
||||
return m_vertexCount;
|
||||
}
|
||||
|
||||
inline const b2Vec2* b2PolygonShape::GetVertices() const
|
||||
{
|
||||
return m_vertices;
|
||||
}
|
||||
|
||||
inline const b2Vec2* b2PolygonShape::GetCoreVertices() const
|
||||
{
|
||||
return m_coreVertices;
|
||||
}
|
||||
|
||||
inline const b2Vec2* b2PolygonShape::GetNormals() const
|
||||
{
|
||||
return m_normals;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_SHAPE_H
|
||||
#define B2_SHAPE_H
|
||||
|
||||
#include "../../Common/b2Math.h"
|
||||
#include "../b2Collision.h"
|
||||
|
||||
class b2BlockAllocator;
|
||||
class b2Body;
|
||||
class b2BroadPhase;
|
||||
|
||||
/// This holds the mass data computed for a shape.
|
||||
struct b2MassData
|
||||
{
|
||||
/// The mass of the shape, usually in kilograms.
|
||||
float32 mass;
|
||||
|
||||
/// The position of the shape's centroid relative to the shape's origin.
|
||||
b2Vec2 center;
|
||||
|
||||
/// The rotational inertia of the shape.
|
||||
float32 I;
|
||||
};
|
||||
|
||||
/// This holds contact filtering data.
|
||||
struct b2FilterData
|
||||
{
|
||||
/// The collision category bits. Normally you would just set one bit.
|
||||
uint16 categoryBits;
|
||||
|
||||
/// The collision mask bits. This states the categories that this
|
||||
/// shape would accept for collision.
|
||||
uint16 maskBits;
|
||||
|
||||
/// Collision groups allow a certain group of objects to never collide (negative)
|
||||
/// or always collide (positive). Zero means no collision group. Non-zero group
|
||||
/// filtering always wins against the mask bits.
|
||||
int16 groupIndex;
|
||||
};
|
||||
|
||||
/// The various collision shape types supported by Box2D.
|
||||
enum b2ShapeType
|
||||
{
|
||||
e_unknownShape = -1,
|
||||
e_circleShape,
|
||||
e_polygonShape,
|
||||
e_shapeTypeCount,
|
||||
};
|
||||
|
||||
/// A shape definition is used to construct a shape. This class defines an
|
||||
/// abstract shape definition. You can reuse shape definitions safely.
|
||||
struct b2ShapeDef
|
||||
{
|
||||
/// The constructor sets the default shape definition values.
|
||||
b2ShapeDef()
|
||||
{
|
||||
type = e_unknownShape;
|
||||
userData = NULL;
|
||||
friction = 0.2f;
|
||||
restitution = 0.0f;
|
||||
density = 0.0f;
|
||||
filter.categoryBits = 0x0001;
|
||||
filter.maskBits = 0xFFFF;
|
||||
filter.groupIndex = 0;
|
||||
isSensor = false;
|
||||
}
|
||||
|
||||
virtual ~b2ShapeDef() {}
|
||||
|
||||
/// Holds the shape type for down-casting.
|
||||
b2ShapeType type;
|
||||
|
||||
/// Use this to store application specify shape data.
|
||||
void* userData;
|
||||
|
||||
/// The shape's friction coefficient, usually in the range [0,1].
|
||||
float32 friction;
|
||||
|
||||
/// The shape's restitution (elasticity) usually in the range [0,1].
|
||||
float32 restitution;
|
||||
|
||||
/// The shape's density, usually in kg/m^2.
|
||||
float32 density;
|
||||
|
||||
/// A sensor shape collects contact information but never generates a collision
|
||||
/// response.
|
||||
bool isSensor;
|
||||
|
||||
/// Contact filtering data.
|
||||
b2FilterData filter;
|
||||
};
|
||||
|
||||
/// A shape is used for collision detection. Shapes are created in b2World.
|
||||
/// You can use shape for collision detection before they are attached to the world.
|
||||
/// @warning you cannot reuse shapes.
|
||||
class b2Shape
|
||||
{
|
||||
public:
|
||||
/// Get the type of this shape. You can use this to down cast to the concrete shape.
|
||||
/// @return the shape type.
|
||||
b2ShapeType GetType() const;
|
||||
|
||||
/// Is this shape a sensor (non-solid)?
|
||||
/// @return the true if the shape is a sensor.
|
||||
bool IsSensor() const;
|
||||
|
||||
/// Set the contact filtering data. You must call b2World::Refilter to correct
|
||||
/// existing contacts/non-contacts.
|
||||
void SetFilterData(const b2FilterData& filter);
|
||||
|
||||
/// Get the contact filtering data.
|
||||
const b2FilterData& GetFilterData() const;
|
||||
|
||||
/// Get the parent body of this shape. This is NULL if the shape is not attached.
|
||||
/// @return the parent body.
|
||||
b2Body* GetBody();
|
||||
|
||||
/// Get the next shape in the parent body's shape list.
|
||||
/// @return the next shape.
|
||||
b2Shape* GetNext();
|
||||
|
||||
/// Get the user data that was assigned in the shape definition. Use this to
|
||||
/// store your application specific data.
|
||||
void* GetUserData();
|
||||
|
||||
/// Set the user data. Use this to store your application specific data.
|
||||
void SetUserData(void* data);
|
||||
|
||||
/// Test a point for containment in this shape. This only works for convex shapes.
|
||||
/// @param xf the shape world transform.
|
||||
/// @param p a point in world coordinates.
|
||||
virtual bool TestPoint(const b2XForm& xf, const b2Vec2& p) const = 0;
|
||||
|
||||
/// Perform a ray cast against this shape.
|
||||
/// @param xf the shape world transform.
|
||||
/// @param lambda returns the hit fraction. You can use this to compute the contact point
|
||||
/// p = (1 - lambda) * segment.p1 + lambda * segment.p2.
|
||||
/// @param normal returns the normal at the contact point. If there is no intersection, the normal
|
||||
/// is not set.
|
||||
/// @param segment defines the begin and end point of the ray cast.
|
||||
/// @param maxLambda a number typically in the range [0,1].
|
||||
/// @return true if there was an intersection.
|
||||
virtual bool TestSegment( const b2XForm& xf,
|
||||
float32* lambda,
|
||||
b2Vec2* normal,
|
||||
const b2Segment& segment,
|
||||
float32 maxLambda) const = 0;
|
||||
|
||||
/// Given a transform, compute the associated axis aligned bounding box for this shape.
|
||||
/// @param aabb returns the axis aligned box.
|
||||
/// @param xf the world transform of the shape.
|
||||
virtual void ComputeAABB(b2AABB* aabb, const b2XForm& xf) const = 0;
|
||||
|
||||
/// Given two transforms, compute the associated swept axis aligned bounding box for this shape.
|
||||
/// @param aabb returns the axis aligned box.
|
||||
/// @param xf1 the starting shape world transform.
|
||||
/// @param xf2 the ending shape world transform.
|
||||
virtual void ComputeSweptAABB( b2AABB* aabb,
|
||||
const b2XForm& xf1,
|
||||
const b2XForm& xf2) const = 0;
|
||||
|
||||
/// Compute the mass properties of this shape using its dimensions and density.
|
||||
/// The inertia tensor is computed about the local origin, not the centroid.
|
||||
/// @param massData returns the mass data for this shape.
|
||||
virtual void ComputeMass(b2MassData* massData) const = 0;
|
||||
|
||||
/// Get the maximum radius about the parent body's center of mass.
|
||||
float32 GetSweepRadius() const;
|
||||
|
||||
/// Get the coefficient of friction.
|
||||
float32 GetFriction() const;
|
||||
|
||||
/// Get the coefficient of restitution.
|
||||
float32 GetRestitution() const;
|
||||
|
||||
protected:
|
||||
|
||||
friend class b2Body;
|
||||
friend class b2World;
|
||||
|
||||
static b2Shape* Create(const b2ShapeDef* def, b2BlockAllocator* allocator);
|
||||
static void Destroy(b2Shape* shape, b2BlockAllocator* allocator);
|
||||
|
||||
b2Shape(const b2ShapeDef* def);
|
||||
virtual ~b2Shape();
|
||||
|
||||
void CreateProxy(b2BroadPhase* broadPhase, const b2XForm& xf);
|
||||
void DestroyProxy(b2BroadPhase* broadPhase);
|
||||
bool Synchronize(b2BroadPhase* broadPhase, const b2XForm& xf1, const b2XForm& xf2);
|
||||
void RefilterProxy(b2BroadPhase* broadPhase, const b2XForm& xf);
|
||||
|
||||
virtual void UpdateSweepRadius(const b2Vec2& center) = 0;
|
||||
|
||||
b2ShapeType m_type;
|
||||
b2Shape* m_next;
|
||||
b2Body* m_body;
|
||||
|
||||
// Sweep radius relative to the parent body's center of mass.
|
||||
float32 m_sweepRadius;
|
||||
|
||||
float32 m_density;
|
||||
float32 m_friction;
|
||||
float32 m_restitution;
|
||||
|
||||
uint16 m_proxyId;
|
||||
b2FilterData m_filter;
|
||||
|
||||
bool m_isSensor;
|
||||
|
||||
void* m_userData;
|
||||
};
|
||||
|
||||
inline b2ShapeType b2Shape::GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
inline bool b2Shape::IsSensor() const
|
||||
{
|
||||
return m_isSensor;
|
||||
}
|
||||
|
||||
inline void b2Shape::SetFilterData(const b2FilterData& filter)
|
||||
{
|
||||
m_filter = filter;
|
||||
}
|
||||
|
||||
inline const b2FilterData& b2Shape::GetFilterData() const
|
||||
{
|
||||
return m_filter;
|
||||
}
|
||||
|
||||
inline void* b2Shape::GetUserData()
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
|
||||
inline void b2Shape::SetUserData(void* data)
|
||||
{
|
||||
m_userData = data;
|
||||
}
|
||||
|
||||
inline b2Body* b2Shape::GetBody()
|
||||
{
|
||||
return m_body;
|
||||
}
|
||||
|
||||
inline b2Shape* b2Shape::GetNext()
|
||||
{
|
||||
return m_next;
|
||||
}
|
||||
|
||||
inline float32 b2Shape::GetSweepRadius() const
|
||||
{
|
||||
return m_sweepRadius;
|
||||
}
|
||||
|
||||
inline float32 b2Shape::GetFriction() const
|
||||
{
|
||||
return m_friction;
|
||||
}
|
||||
|
||||
inline float32 b2Shape::GetRestitution() const
|
||||
{
|
||||
return m_restitution;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_BROAD_PHASE_H
|
||||
#define B2_BROAD_PHASE_H
|
||||
|
||||
/*
|
||||
This broad phase uses the Sweep and Prune algorithm as described in:
|
||||
Collision Detection in Interactive 3D Environments by Gino van den Bergen
|
||||
Also, some ideas, such as using integral values for fast compares comes from
|
||||
Bullet (http:/www.bulletphysics.com).
|
||||
*/
|
||||
|
||||
#include "../Common/b2Settings.h"
|
||||
#include "b2Collision.h"
|
||||
#include "b2PairManager.h"
|
||||
#include <climits>
|
||||
|
||||
#ifdef TARGET_FLOAT32_IS_FIXED
|
||||
#define B2BROADPHASE_MAX (USHRT_MAX/2)
|
||||
#else
|
||||
#define B2BROADPHASE_MAX USHRT_MAX
|
||||
|
||||
#endif
|
||||
|
||||
const uint16 b2_invalid = B2BROADPHASE_MAX;
|
||||
const uint16 b2_nullEdge = B2BROADPHASE_MAX;
|
||||
struct b2BoundValues;
|
||||
|
||||
struct b2Bound
|
||||
{
|
||||
bool IsLower() const { return (value & 1) == 0; }
|
||||
bool IsUpper() const { return (value & 1) == 1; }
|
||||
|
||||
uint16 value;
|
||||
uint16 proxyId;
|
||||
uint16 stabbingCount;
|
||||
};
|
||||
|
||||
struct b2Proxy
|
||||
{
|
||||
uint16 GetNext() const { return lowerBounds[0]; }
|
||||
void SetNext(uint16 next) { lowerBounds[0] = next; }
|
||||
bool IsValid() const { return overlapCount != b2_invalid; }
|
||||
|
||||
uint16 lowerBounds[2], upperBounds[2];
|
||||
uint16 overlapCount;
|
||||
uint16 timeStamp;
|
||||
void* userData;
|
||||
};
|
||||
|
||||
class b2BroadPhase
|
||||
{
|
||||
public:
|
||||
b2BroadPhase(const b2AABB& worldAABB, b2PairCallback* callback);
|
||||
~b2BroadPhase();
|
||||
|
||||
// Use this to see if your proxy is in range. If it is not in range,
|
||||
// it should be destroyed. Otherwise you may get O(m^2) pairs, where m
|
||||
// is the number of proxies that are out of range.
|
||||
bool InRange(const b2AABB& aabb) const;
|
||||
|
||||
// Create and destroy proxies. These call Flush first.
|
||||
uint16 CreateProxy(const b2AABB& aabb, void* userData);
|
||||
void DestroyProxy(int32 proxyId);
|
||||
|
||||
// Call MoveProxy as many times as you like, then when you are done
|
||||
// call Commit to finalized the proxy pairs (for your time step).
|
||||
void MoveProxy(int32 proxyId, const b2AABB& aabb);
|
||||
void Commit();
|
||||
|
||||
// Get a single proxy. Returns NULL if the id is invalid.
|
||||
b2Proxy* GetProxy(int32 proxyId);
|
||||
|
||||
// Query an AABB for overlapping proxies, returns the user data and
|
||||
// the count, up to the supplied maximum count.
|
||||
int32 Query(const b2AABB& aabb, void** userData, int32 maxCount);
|
||||
|
||||
void Validate();
|
||||
void ValidatePairs();
|
||||
|
||||
private:
|
||||
void ComputeBounds(uint16* lowerValues, uint16* upperValues, const b2AABB& aabb);
|
||||
|
||||
bool TestOverlap(b2Proxy* p1, b2Proxy* p2);
|
||||
bool TestOverlap(const b2BoundValues& b, b2Proxy* p);
|
||||
|
||||
void Query(int32* lowerIndex, int32* upperIndex, uint16 lowerValue, uint16 upperValue,
|
||||
b2Bound* bounds, int32 boundCount, int32 axis);
|
||||
void IncrementOverlapCount(int32 proxyId);
|
||||
void IncrementTimeStamp();
|
||||
|
||||
public:
|
||||
friend class b2PairManager;
|
||||
|
||||
b2PairManager m_pairManager;
|
||||
|
||||
b2Proxy m_proxyPool[b2_maxProxies];
|
||||
uint16 m_freeProxy;
|
||||
|
||||
b2Bound m_bounds[2][2*b2_maxProxies];
|
||||
|
||||
uint16 m_queryResults[b2_maxProxies];
|
||||
int32 m_queryResultCount;
|
||||
|
||||
b2AABB m_worldAABB;
|
||||
b2Vec2 m_quantizationFactor;
|
||||
int32 m_proxyCount;
|
||||
uint16 m_timeStamp;
|
||||
|
||||
static bool s_validate;
|
||||
};
|
||||
|
||||
|
||||
inline bool b2BroadPhase::InRange(const b2AABB& aabb) const
|
||||
{
|
||||
b2Vec2 d = b2Max(aabb.lowerBound - m_worldAABB.upperBound, m_worldAABB.lowerBound - aabb.upperBound);
|
||||
return b2Max(d.x, d.y) < 0.0f;
|
||||
}
|
||||
|
||||
inline b2Proxy* b2BroadPhase::GetProxy(int32 proxyId)
|
||||
{
|
||||
if (proxyId == b2_nullProxy || m_proxyPool[proxyId].IsValid() == false)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return m_proxyPool + proxyId;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef B2_COLLISION_H
|
||||
#define B2_COLLISION_H
|
||||
|
||||
#include "../Common/b2Math.h"
|
||||
#include <climits>
|
||||
|
||||
/// @file
|
||||
/// Structures and functions used for computing contact points, distance
|
||||
/// queries, and TOI queries.
|
||||
|
||||
class b2Shape;
|
||||
class b2CircleShape;
|
||||
class b2PolygonShape;
|
||||
|
||||
const uint8 b2_nullFeature = UCHAR_MAX;
|
||||
|
||||
/// Contact ids to facilitate warm starting.
|
||||
union b2ContactID
|
||||
{
|
||||
/// The features that intersect to form the contact point
|
||||
struct Features
|
||||
{
|
||||
uint8 referenceEdge; ///< The edge that defines the outward contact normal.
|
||||
uint8 incidentEdge; ///< The edge most anti-parallel to the reference edge.
|
||||
uint8 incidentVertex; ///< The vertex (0 or 1) on the incident edge that was clipped.
|
||||
uint8 flip; ///< A value of 1 indicates that the reference edge is on shape2.
|
||||
} features;
|
||||
uint32 key; ///< Used to quickly compare contact ids.
|
||||
};
|
||||
|
||||
/// A manifold point is a contact point belonging to a contact
|
||||
/// manifold. It holds details related to the geometry and dynamics
|
||||
/// of the contact points.
|
||||
/// The point is stored in local coordinates because CCD
|
||||
/// requires sub-stepping in which the separation is stale.
|
||||
struct b2ManifoldPoint
|
||||
{
|
||||
b2Vec2 localPoint1; ///< local position of the contact point in body1
|
||||
b2Vec2 localPoint2; ///< local position of the contact point in body2
|
||||
float32 separation; ///< the separation of the shapes along the normal vector
|
||||
float32 normalImpulse; ///< the non-penetration impulse
|
||||
float32 tangentImpulse; ///< the friction impulse
|
||||
b2ContactID id; ///< uniquely identifies a contact point between two shapes
|
||||
};
|
||||
|
||||
/// A manifold for two touching convex shapes.
|
||||
struct b2Manifold
|
||||
{
|
||||
b2ManifoldPoint points[b2_maxManifoldPoints]; ///< the points of contact
|
||||
b2Vec2 normal; ///< the shared unit normal vector
|
||||
int32 pointCount; ///< the number of manifold points
|
||||
};
|
||||
|
||||
/// A line segment.
|
||||
struct b2Segment
|
||||
{
|
||||
/// Ray cast against this segment with another segment.
|
||||
bool TestSegment(float32* lambda, b2Vec2* normal, const b2Segment& segment, float32 maxLambda) const;
|
||||
|
||||
b2Vec2 p1; ///< the starting point
|
||||
b2Vec2 p2; ///< the ending point
|
||||
};
|
||||
|
||||
/// An axis aligned bounding box.
|
||||
struct b2AABB
|
||||
{
|
||||
/// Verify that the bounds are sorted.
|
||||
bool IsValid() const;
|
||||
|
||||
b2Vec2 lowerBound; ///< the lower vertex
|
||||
b2Vec2 upperBound; ///< the upper vertex
|
||||
};
|
||||
|
||||
/// An oriented bounding box.
|
||||
struct b2OBB
|
||||
{
|
||||
b2Mat22 R; ///< the rotation matrix
|
||||
b2Vec2 center; ///< the local centroid
|
||||
b2Vec2 extents; ///< the half-widths
|
||||
};
|
||||
|
||||
/// Compute the collision manifold between two circles.
|
||||
void b2CollideCircles(b2Manifold* manifold,
|
||||
const b2CircleShape* circle1, const b2XForm& xf1,
|
||||
const b2CircleShape* circle2, const b2XForm& xf2);
|
||||
|
||||
/// Compute the collision manifold between a polygon and a circle.
|
||||
void b2CollidePolygonAndCircle(b2Manifold* manifold,
|
||||
const b2PolygonShape* polygon, const b2XForm& xf1,
|
||||
const b2CircleShape* circle, const b2XForm& xf2);
|
||||
|
||||
/// Compute the collision manifold between two circles.
|
||||
void b2CollidePolygons(b2Manifold* manifold,
|
||||
const b2PolygonShape* polygon1, const b2XForm& xf1,
|
||||
const b2PolygonShape* polygon2, const b2XForm& xf2);
|
||||
|
||||
/// Compute the distance between two shapes and the closest points.
|
||||
/// @return the distance between the shapes or zero if they are overlapped/touching.
|
||||
float32 b2Distance(b2Vec2* x1, b2Vec2* x2,
|
||||
const b2Shape* shape1, const b2XForm& xf1,
|
||||
const b2Shape* shape2, const b2XForm& xf2);
|
||||
|
||||
/// Compute the time when two shapes begin to touch or touch at a closer distance.
|
||||
/// @warning the sweeps must have the same time interval.
|
||||
/// @return the fraction between [0,1] in which the shapes first touch.
|
||||
/// fraction=0 means the shapes begin touching/overlapped, and fraction=1 means the shapes don't touch.
|
||||
float32 b2TimeOfImpact(const b2Shape* shape1, const b2Sweep& sweep1,
|
||||
const b2Shape* shape2, const b2Sweep& sweep2);
|
||||
|
||||
|
||||
// ---------------- Inline Functions ------------------------------------------
|
||||
|
||||
inline bool b2AABB::IsValid() const
|
||||
{
|
||||
b2Vec2 d = upperBound - lowerBound;
|
||||
bool valid = d.x >= 0.0f && d.y >= 0.0f;
|
||||
valid = valid && lowerBound.IsValid() && upperBound.IsValid();
|
||||
return valid;
|
||||
}
|
||||
|
||||
inline bool b2TestOverlap(const b2AABB& a, const b2AABB& b)
|
||||
{
|
||||
b2Vec2 d1, d2;
|
||||
d1 = b.lowerBound - a.upperBound;
|
||||
d2 = a.lowerBound - b.upperBound;
|
||||
|
||||
if (d1.x > 0.0f || d1.y > 0.0f)
|
||||
return false;
|
||||
|
||||
if (d2.x > 0.0f || d2.y > 0.0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
// The pair manager is used by the broad-phase to quickly add/remove/find pairs
|
||||
// of overlapping proxies. It is based closely on code provided by Pierre Terdiman.
|
||||
// http://www.codercorner.com/IncrementalSAP.txt
|
||||
|
||||
#ifndef B2_PAIR_MANAGER_H
|
||||
#define B2_PAIR_MANAGER_H
|
||||
|
||||
#include "../Common/b2Settings.h"
|
||||
#include "../Common/b2Math.h"
|
||||
|
||||
#include <climits>
|
||||
|
||||
class b2BroadPhase;
|
||||
struct b2Proxy;
|
||||
|
||||
const uint16 b2_nullPair = USHRT_MAX;
|
||||
const uint16 b2_nullProxy = USHRT_MAX;
|
||||
const int32 b2_tableCapacity = b2_maxPairs; // must be a power of two
|
||||
const int32 b2_tableMask = b2_tableCapacity - 1;
|
||||
|
||||
struct b2Pair
|
||||
{
|
||||
enum
|
||||
{
|
||||
e_pairBuffered = 0x0001,
|
||||
e_pairRemoved = 0x0002,
|
||||
e_pairFinal = 0x0004,
|
||||
};
|
||||
|
||||
void SetBuffered() { status |= e_pairBuffered; }
|
||||
void ClearBuffered() { status &= ~e_pairBuffered; }
|
||||
bool IsBuffered() { return (status & e_pairBuffered) == e_pairBuffered; }
|
||||
|
||||
void SetRemoved() { status |= e_pairRemoved; }
|
||||
void ClearRemoved() { status &= ~e_pairRemoved; }
|
||||
bool IsRemoved() { return (status & e_pairRemoved) == e_pairRemoved; }
|
||||
|
||||
void SetFinal() { status |= e_pairFinal; }
|
||||
bool IsFinal() { return (status & e_pairFinal) == e_pairFinal; }
|
||||
|
||||
void* userData;
|
||||
uint16 proxyId1;
|
||||
uint16 proxyId2;
|
||||
uint16 next;
|
||||
uint16 status;
|
||||
};
|
||||
|
||||
struct b2BufferedPair
|
||||
{
|
||||
uint16 proxyId1;
|
||||
uint16 proxyId2;
|
||||
};
|
||||
|
||||
class b2PairCallback
|
||||
{
|
||||
public:
|
||||
virtual ~b2PairCallback() {}
|
||||
|
||||
// This should return the new pair user data. It is ok if the
|
||||
// user data is null.
|
||||
virtual void* PairAdded(void* proxyUserData1, void* proxyUserData2) = 0;
|
||||
|
||||
// This should free the pair's user data. In extreme circumstances, it is possible
|
||||
// this will be called with null pairUserData because the pair never existed.
|
||||
virtual void PairRemoved(void* proxyUserData1, void* proxyUserData2, void* pairUserData) = 0;
|
||||
};
|
||||
|
||||
class b2PairManager
|
||||
{
|
||||
public:
|
||||
b2PairManager();
|
||||
|
||||
void Initialize(b2BroadPhase* broadPhase, b2PairCallback* callback);
|
||||
|
||||
void AddBufferedPair(int32 proxyId1, int32 proxyId2);
|
||||
void RemoveBufferedPair(int32 proxyId1, int32 proxyId2);
|
||||
|
||||
void Commit();
|
||||
|
||||
private:
|
||||
b2Pair* Find(int32 proxyId1, int32 proxyId2);
|
||||
b2Pair* Find(int32 proxyId1, int32 proxyId2, uint32 hashValue);
|
||||
|
||||
b2Pair* AddPair(int32 proxyId1, int32 proxyId2);
|
||||
void* RemovePair(int32 proxyId1, int32 proxyId2);
|
||||
|
||||
void ValidateBuffer();
|
||||
void ValidateTable();
|
||||
|
||||
public:
|
||||
b2BroadPhase *m_broadPhase;
|
||||
b2PairCallback *m_callback;
|
||||
b2Pair m_pairs[b2_maxPairs];
|
||||
uint16 m_freePair;
|
||||
int32 m_pairCount;
|
||||
|
||||
b2BufferedPair m_pairBuffer[b2_maxPairs];
|
||||
int32 m_pairBufferCount;
|
||||
|
||||
uint16 m_hashTable[b2_tableCapacity];
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,477 @@
|
||||
/*
|
||||
Copyright (c) 2006 Henry Strickland & Ryan Seto
|
||||
2007-2008 Tobias Weyand (modifications and extensions)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
(* http://www.opensource.org/licenses/mit-license.php *)
|
||||
*/
|
||||
|
||||
#ifndef _FIXED_H_
|
||||
#define _FIXED_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef TARGET_IS_NDS
|
||||
|
||||
#include "nds.h"
|
||||
|
||||
#endif
|
||||
|
||||
#define FIXED_BP 16
|
||||
#define FIXED_MAX ((1<<(32-FIXED_BP-1))-1)
|
||||
#define FIXED_MIN (-(1<<(32-FIXED_BP-1)))
|
||||
#define FIXED_EPSILON (Fixed(0.00007f))
|
||||
|
||||
#define G_1_DIV_PI 20861
|
||||
|
||||
class Fixed {
|
||||
|
||||
private:
|
||||
|
||||
int g; // the guts
|
||||
|
||||
const static int BP= FIXED_BP; // how many low bits are right of Binary Point
|
||||
const static int BP2= BP*2; // how many low bits are right of Binary Point
|
||||
const static int BPhalf= BP/2; // how many low bits are right of Binary Point
|
||||
|
||||
double STEP(); // smallest step we can represent
|
||||
|
||||
// for private construction via guts
|
||||
enum FixedRaw { RAW };
|
||||
Fixed(FixedRaw, int guts);
|
||||
|
||||
public:
|
||||
|
||||
Fixed();
|
||||
Fixed(const Fixed &a);
|
||||
Fixed(float a);
|
||||
Fixed(double a);
|
||||
Fixed(int a);
|
||||
Fixed(long a);
|
||||
|
||||
Fixed& operator =(const Fixed a);
|
||||
Fixed& operator =(float a);
|
||||
Fixed& operator =(double a);
|
||||
Fixed& operator =(int a);
|
||||
Fixed& operator =(long a);
|
||||
|
||||
operator float();
|
||||
operator double();
|
||||
operator int();
|
||||
operator long();
|
||||
operator unsigned short();
|
||||
|
||||
operator float() const;
|
||||
|
||||
Fixed operator +() const;
|
||||
Fixed operator -() const;
|
||||
|
||||
Fixed operator +(const Fixed a) const;
|
||||
Fixed operator -(const Fixed a) const;
|
||||
#if 1
|
||||
// more acurate, using long long
|
||||
Fixed operator *(const Fixed a) const;
|
||||
#else
|
||||
// faster, but with only half as many bits right of binary point
|
||||
Fixed operator *(const Fixed a) const;
|
||||
#endif
|
||||
Fixed operator /(const Fixed a) const;
|
||||
|
||||
Fixed operator *(unsigned short a) const;
|
||||
Fixed operator *(int a) const;
|
||||
|
||||
Fixed operator +(float a) const;
|
||||
Fixed operator -(float a) const;
|
||||
Fixed operator *(float a) const;
|
||||
Fixed operator /(float a) const;
|
||||
|
||||
Fixed operator +(double a) const;
|
||||
Fixed operator -(double a) const;
|
||||
Fixed operator *(double a) const;
|
||||
Fixed operator /(double a) const;
|
||||
|
||||
Fixed operator >>(int a) const;
|
||||
Fixed operator <<(int a) const;
|
||||
|
||||
Fixed& operator +=(Fixed a);
|
||||
Fixed& operator -=(Fixed a);
|
||||
Fixed& operator *=(Fixed a);
|
||||
Fixed& operator /=(Fixed a);
|
||||
|
||||
Fixed& operator +=(int a);
|
||||
Fixed& operator -=(int a);
|
||||
Fixed& operator *=(int a);
|
||||
Fixed& operator /=(int a);
|
||||
|
||||
Fixed& operator +=(long a);
|
||||
Fixed& operator -=(long a);
|
||||
Fixed& operator *=(long a);
|
||||
Fixed& operator /=(long a);
|
||||
|
||||
Fixed& operator +=(float a);
|
||||
Fixed& operator -=(float a);
|
||||
Fixed& operator *=(float a);
|
||||
Fixed& operator /=(float a);
|
||||
|
||||
Fixed& operator +=(double a);
|
||||
Fixed& operator -=(double a);
|
||||
Fixed& operator *=(double a);
|
||||
Fixed& operator /=(double a);
|
||||
|
||||
bool operator ==(const Fixed a) const;
|
||||
bool operator !=(const Fixed a) const;
|
||||
bool operator <=(const Fixed a) const;
|
||||
bool operator >=(const Fixed a) const;
|
||||
bool operator <(const Fixed a) const;
|
||||
bool operator >(const Fixed a) const;
|
||||
|
||||
bool operator ==(float a) const;
|
||||
bool operator !=(float a) const;
|
||||
bool operator <=(float a) const;
|
||||
bool operator >=(float a) const;
|
||||
bool operator <(float a) const;
|
||||
bool operator >(float a) const;
|
||||
|
||||
bool operator ==(double a) const;
|
||||
bool operator !=(double a) const;
|
||||
bool operator <=(double a) const;
|
||||
bool operator >=(double a) const;
|
||||
bool operator <(double a) const;
|
||||
bool operator >(double a) const;
|
||||
|
||||
bool operator >(int a) const;
|
||||
bool operator <(int a) const;
|
||||
bool operator >=(int a) const;
|
||||
bool operator <=(int a) const;
|
||||
|
||||
Fixed abs();
|
||||
Fixed sqrt();
|
||||
#ifdef TARGET_IS_NDS
|
||||
Fixed cosf();
|
||||
Fixed sinf();
|
||||
Fixed tanf();
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// Implementation
|
||||
//
|
||||
|
||||
inline double Fixed::STEP() { return 1.0 / (1<<BP); } // smallest step we can represent
|
||||
|
||||
// for private construction via guts
|
||||
inline Fixed::Fixed(FixedRaw, int guts) : g(guts) {}
|
||||
|
||||
inline Fixed::Fixed() : g(0) {}
|
||||
inline Fixed::Fixed(const Fixed &a) : g( a.g ) {}
|
||||
inline Fixed::Fixed(float a) : g( int(a * (float)(1<<BP)) ) {}
|
||||
inline Fixed::Fixed(double a) : g( int(a * (double)(1<<BP) ) ) {}
|
||||
inline Fixed::Fixed(int a) : g( a << BP ) {}
|
||||
inline Fixed::Fixed(long a) : g( a << BP ) {}
|
||||
|
||||
inline Fixed& Fixed::operator =(const Fixed a) { g= a.g; return *this; }
|
||||
inline Fixed& Fixed::operator =(float a) { g= Fixed(a).g; return *this; }
|
||||
inline Fixed& Fixed::operator =(double a) { g= Fixed(a).g; return *this; }
|
||||
inline Fixed& Fixed::operator =(int a) { g= Fixed(a).g; return *this; }
|
||||
inline Fixed& Fixed::operator =(long a) { g= Fixed(a).g; return *this; }
|
||||
|
||||
inline Fixed::operator float() { return g * (float)STEP(); }
|
||||
inline Fixed::operator double() { return g * (double)STEP(); }
|
||||
inline Fixed::operator int() { return g>>BP; }
|
||||
inline Fixed::operator long() { return g>>BP; }
|
||||
//#pragma warning(disable: 4244) //HARDWIRE added pragma to prevent VS2005 compilation error
|
||||
inline Fixed::operator unsigned short() { return g>>BP; }
|
||||
inline Fixed::operator float() const { return g / (float)(1<<BP); }
|
||||
|
||||
inline Fixed Fixed::operator +() const { return Fixed(RAW,g); }
|
||||
inline Fixed Fixed::operator -() const { return Fixed(RAW,-g); }
|
||||
|
||||
inline Fixed Fixed::operator +(const Fixed a) const { return Fixed(RAW, g + a.g); }
|
||||
inline Fixed Fixed::operator -(const Fixed a) const { return Fixed(RAW, g - a.g); }
|
||||
|
||||
#if 1
|
||||
// more acurate, using long long
|
||||
inline Fixed Fixed::operator *(const Fixed a) const { return Fixed(RAW, (int)( ((long long)g * (long long)a.g ) >> BP)); }
|
||||
|
||||
#elif 0
|
||||
|
||||
// check for overflow and figure out where. Must specify -rdynamic in linker
|
||||
#include <execinfo.h>
|
||||
#include <signal.h>
|
||||
#include <exception>
|
||||
|
||||
inline Fixed Fixed::operator *(const Fixed a) const {
|
||||
long long x = ((long long)g * (long long)a.g );
|
||||
if(x > 0x7fffffffffffLL || x < -0x7fffffffffffLL) {
|
||||
printf("overflow");
|
||||
void *array[2];
|
||||
int nSize = backtrace(array, 2);
|
||||
char **symbols = backtrace_symbols(array, nSize);
|
||||
for(int i=0; i<nSize; i++) {
|
||||
printf(" %s", symbols[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return Fixed(RAW, (int)(x>>BP));
|
||||
}
|
||||
|
||||
#else
|
||||
// faster, but with only half as many bits right of binary point
|
||||
inline Fixed Fixed::operator *(const Fixed a) const { return Fixed(RAW, (g>>BPhalf) * (a.g>>BPhalf) ); }
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TARGET_IS_NDS
|
||||
// Division using the DS's maths coprocessor
|
||||
inline Fixed Fixed::operator /(const Fixed a) const
|
||||
{
|
||||
//printf("%d %d\n", (long long)g << BP, a.g);
|
||||
return Fixed(RAW, int( div64((long long)g << BP, a.g) ) );
|
||||
}
|
||||
#else
|
||||
inline Fixed Fixed::operator /(const Fixed a) const
|
||||
{
|
||||
return Fixed(RAW, int( (((long long)g << BP2) / (long long)(a.g)) >> BP) );
|
||||
//return Fixed(RAW, int( (((long long)g << BP) / (long long)(a.g)) ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
inline Fixed Fixed::operator *(unsigned short a) const { return operator*(Fixed(a)); }
|
||||
inline Fixed Fixed::operator *(int a) const { return operator*(Fixed(a)); }
|
||||
|
||||
inline Fixed Fixed::operator +(float a) const { return Fixed(RAW, g + Fixed(a).g); }
|
||||
inline Fixed Fixed::operator -(float a) const { return Fixed(RAW, g - Fixed(a).g); }
|
||||
inline Fixed Fixed::operator *(float a) const { return Fixed(RAW, (g>>BPhalf) * (Fixed(a).g>>BPhalf) ); }
|
||||
//inline Fixed Fixed::operator /(float a) const { return Fixed(RAW, int( (((long long)g << BP2) / (long long)(Fixed(a).g)) >> BP) ); }
|
||||
inline Fixed Fixed::operator /(float a) const { return operator/(Fixed(a)); }
|
||||
|
||||
inline Fixed Fixed::operator +(double a) const { return Fixed(RAW, g + Fixed(a).g); }
|
||||
inline Fixed Fixed::operator -(double a) const { return Fixed(RAW, g - Fixed(a).g); }
|
||||
inline Fixed Fixed::operator *(double a) const { return Fixed(RAW, (g>>BPhalf) * (Fixed(a).g>>BPhalf) ); }
|
||||
//inline Fixed Fixed::operator /(double a) const { return Fixed(RAW, int( (((long long)g << BP2) / (long long)(Fixed(a).g)) >> BP) ); }
|
||||
inline Fixed Fixed::operator /(double a) const { return operator/(Fixed(a)); }
|
||||
|
||||
inline Fixed Fixed::operator >>(int a) const { return Fixed(RAW, g >> a); }
|
||||
inline Fixed Fixed::operator <<(int a) const { return Fixed(RAW, g << a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(Fixed a) { return *this = *this + a; }
|
||||
inline Fixed& Fixed::operator -=(Fixed a) { return *this = *this - a; }
|
||||
inline Fixed& Fixed::operator *=(Fixed a) { return *this = *this * a; }
|
||||
//inline Fixed& Fixed::operator /=(Fixed a) { return *this = *this / a; }
|
||||
inline Fixed& Fixed::operator /=(Fixed a) { return *this = operator/(a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(int a) { return *this = *this + (Fixed)a; }
|
||||
inline Fixed& Fixed::operator -=(int a) { return *this = *this - (Fixed)a; }
|
||||
inline Fixed& Fixed::operator *=(int a) { return *this = *this * (Fixed)a; }
|
||||
//inline Fixed& Fixed::operator /=(int a) { return *this = *this / (Fixed)a; }
|
||||
inline Fixed& Fixed::operator /=(int a) { return *this = operator/((Fixed)a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(long a) { return *this = *this + (Fixed)a; }
|
||||
inline Fixed& Fixed::operator -=(long a) { return *this = *this - (Fixed)a; }
|
||||
inline Fixed& Fixed::operator *=(long a) { return *this = *this * (Fixed)a; }
|
||||
//inline Fixed& Fixed::operator /=(long a) { return *this = *this / (Fixed)a; }
|
||||
inline Fixed& Fixed::operator /=(long a) { return *this = operator/((Fixed)a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(float a) { return *this = *this + a; }
|
||||
inline Fixed& Fixed::operator -=(float a) { return *this = *this - a; }
|
||||
inline Fixed& Fixed::operator *=(float a) { return *this = *this * a; }
|
||||
//inline Fixed& Fixed::operator /=(float a) { return *this = *this / a; }
|
||||
inline Fixed& Fixed::operator /=(float a) { return *this = operator/(a); }
|
||||
|
||||
inline Fixed& Fixed::operator +=(double a) { return *this = *this + a; }
|
||||
inline Fixed& Fixed::operator -=(double a) { return *this = *this - a; }
|
||||
inline Fixed& Fixed::operator *=(double a) { return *this = *this * a; }
|
||||
//inline Fixed& Fixed::operator /=(double a) { return *this = *this / a; }
|
||||
inline Fixed& Fixed::operator /=(double a) { return *this = operator/(a); }
|
||||
|
||||
inline Fixed operator +(int a, const Fixed b) { return Fixed(a)+b; }
|
||||
inline Fixed operator -(int a, const Fixed b) { return Fixed(a)-b; }
|
||||
inline Fixed operator *(int a, const Fixed b) { return Fixed(a)*b; }
|
||||
inline Fixed operator /(int a, const Fixed b) { return Fixed(a)/b; };
|
||||
|
||||
inline Fixed operator +(float a, const Fixed b) { return Fixed(a)+b; }
|
||||
inline Fixed operator -(float a, const Fixed b) { return Fixed(a)-b; }
|
||||
inline Fixed operator *(float a, const Fixed b) { return Fixed(a)*b; }
|
||||
inline Fixed operator /(float a, const Fixed b) { return Fixed(a)/b; }
|
||||
|
||||
inline bool Fixed::operator ==(const Fixed a) const { return g == a.g; }
|
||||
inline bool Fixed::operator !=(const Fixed a) const { return g != a.g; }
|
||||
inline bool Fixed::operator <=(const Fixed a) const { return g <= a.g; }
|
||||
inline bool Fixed::operator >=(const Fixed a) const { return g >= a.g; }
|
||||
inline bool Fixed::operator <(const Fixed a) const { return g < a.g; }
|
||||
inline bool Fixed::operator >(const Fixed a) const { return g > a.g; }
|
||||
|
||||
inline bool Fixed::operator ==(float a) const { return g == Fixed(a).g; }
|
||||
inline bool Fixed::operator !=(float a) const { return g != Fixed(a).g; }
|
||||
inline bool Fixed::operator <=(float a) const { return g <= Fixed(a).g; }
|
||||
inline bool Fixed::operator >=(float a) const { return g >= Fixed(a).g; }
|
||||
inline bool Fixed::operator <(float a) const { return g < Fixed(a).g; }
|
||||
inline bool Fixed::operator >(float a) const { return g > Fixed(a).g; }
|
||||
|
||||
inline bool Fixed::operator ==(double a) const { return g == Fixed(a).g; }
|
||||
inline bool Fixed::operator !=(double a) const { return g != Fixed(a).g; }
|
||||
inline bool Fixed::operator <=(double a) const { return g <= Fixed(a).g; }
|
||||
inline bool Fixed::operator >=(double a) const { return g >= Fixed(a).g; }
|
||||
inline bool Fixed::operator <(double a) const { return g < Fixed(a).g; }
|
||||
inline bool Fixed::operator >(double a) const { return g > Fixed(a).g; }
|
||||
|
||||
inline bool Fixed::operator >(int a) const { return g > Fixed(a).g; }
|
||||
inline bool Fixed::operator <(int a) const { return g < Fixed(a).g; }
|
||||
inline bool Fixed::operator >=(int a) const{ return g >= Fixed(a).g; };
|
||||
inline bool Fixed::operator <=(int a) const{ return g <= Fixed(a).g; };
|
||||
|
||||
inline bool operator ==(float a, const Fixed b) { return Fixed(a) == b; }
|
||||
inline bool operator !=(float a, const Fixed b) { return Fixed(a) != b; }
|
||||
inline bool operator <=(float a, const Fixed b) { return Fixed(a) <= b; }
|
||||
inline bool operator >=(float a, const Fixed b) { return Fixed(a) >= b; }
|
||||
inline bool operator <(float a, const Fixed b) { return Fixed(a) < b; }
|
||||
inline bool operator >(float a, const Fixed b) { return Fixed(a) > b; }
|
||||
|
||||
inline Fixed operator +(double a, const Fixed b) { return Fixed(a)+b; }
|
||||
inline Fixed operator -(double a, const Fixed b) { return Fixed(a)-b; }
|
||||
inline Fixed operator *(double a, const Fixed b) { return Fixed(a)*b; }
|
||||
inline Fixed operator /(double a, const Fixed b) { return Fixed(a)/b; }
|
||||
|
||||
inline bool operator ==(double a, const Fixed b) { return Fixed(a) == b; }
|
||||
inline bool operator !=(double a, const Fixed b) { return Fixed(a) != b; }
|
||||
inline bool operator <=(double a, const Fixed b) { return Fixed(a) <= b; }
|
||||
inline bool operator >=(double a, const Fixed b) { return Fixed(a) >= b; }
|
||||
inline bool operator <(double a, const Fixed b) { return Fixed(a) < b; }
|
||||
inline bool operator >(double a, const Fixed b) { return Fixed(a) > b; }
|
||||
|
||||
inline bool operator ==(int a, const Fixed b) { return Fixed(a) == b; }
|
||||
inline bool operator !=(int a, const Fixed b) { return Fixed(a) != b; }
|
||||
inline bool operator <=(int a, const Fixed b) { return Fixed(a) <= b; }
|
||||
inline bool operator >=(int a, const Fixed b) { return Fixed(a) >= b; }
|
||||
inline bool operator <(int a, const Fixed b) { return Fixed(a) < b; }
|
||||
inline bool operator >(int a, const Fixed b) { return Fixed(a) > b; }
|
||||
|
||||
inline int& operator +=(int& a, const Fixed b) { a = (Fixed)a + b; return a; }
|
||||
inline int& operator -=(int& a, const Fixed b) { a = (Fixed)a - b; return a; }
|
||||
inline int& operator *=(int& a, const Fixed b) { a = (Fixed)a * b; return a; }
|
||||
inline int& operator /=(int& a, const Fixed b) { a = (Fixed)a / b; return a; }
|
||||
|
||||
inline long& operator +=(long& a, const Fixed b) { a = (Fixed)a + b; return a; }
|
||||
inline long& operator -=(long& a, const Fixed b) { a = (Fixed)a - b; return a; }
|
||||
inline long& operator *=(long& a, const Fixed b) { a = (Fixed)a * b; return a; }
|
||||
inline long& operator /=(long& a, const Fixed b) { a = (Fixed)a / b; return a; }
|
||||
|
||||
inline float& operator +=(float& a, const Fixed b) { a = a + b; return a; }
|
||||
inline float& operator -=(float& a, const Fixed b) { a = a - b; return a; }
|
||||
inline float& operator *=(float& a, const Fixed b) { a = a * b; return a; }
|
||||
inline float& operator /=(float& a, const Fixed b) { a = a / b; return a; }
|
||||
|
||||
inline double& operator +=(double& a, const Fixed b) { a = a + b; return a; }
|
||||
inline double& operator -=(double& a, const Fixed b) { a = a - b; return a; }
|
||||
inline double& operator *=(double& a, const Fixed b) { a = a * b; return a; }
|
||||
inline double& operator /=(double& a, const Fixed b) { a = a / b; return a; }
|
||||
|
||||
inline Fixed Fixed::abs() { return (g>0) ? Fixed(RAW, g) : Fixed(RAW, -g); }
|
||||
inline Fixed abs(Fixed f) { return f.abs(); }
|
||||
|
||||
//inline Fixed atan2(Fixed a, Fixed b) { return atan2f((float) a, (float) b); }
|
||||
inline Fixed atan2(Fixed y, Fixed x)
|
||||
{
|
||||
Fixed abs_y = y.abs() + FIXED_EPSILON; // avoid 0/0
|
||||
Fixed r, angle;
|
||||
|
||||
if(x >= 0.0f) {
|
||||
r = (x - abs_y) / (x + abs_y);
|
||||
angle = 3.1415926/4.0;
|
||||
} else {
|
||||
r = (x + abs_y) / (abs_y - x);
|
||||
angle = 3.0*3.1415926/4.0;
|
||||
}
|
||||
angle += Fixed(0.1963) * (r * r * r) - Fixed(0.9817) * r;
|
||||
return (y < 0) ? -angle : angle;
|
||||
}
|
||||
|
||||
#if TARGET_IS_NDS
|
||||
|
||||
static inline long nds_sqrt64(long long a)
|
||||
{
|
||||
SQRT_CR = SQRT_64;
|
||||
while(SQRT_CR & SQRT_BUSY);
|
||||
SQRT_PARAM64 = a;
|
||||
while(SQRT_CR & SQRT_BUSY);
|
||||
|
||||
return SQRT_RESULT32;
|
||||
}
|
||||
|
||||
static inline int32 div6464(int64 num, int64 den)
|
||||
{
|
||||
DIV_CR = DIV_64_64;
|
||||
while(DIV_CR & DIV_BUSY);
|
||||
DIV_NUMERATOR64 = num;
|
||||
DIV_DENOMINATOR64 = den;
|
||||
while(DIV_CR & DIV_BUSY);
|
||||
|
||||
return (DIV_RESULT32);
|
||||
}
|
||||
|
||||
inline Fixed Fixed::sqrt()
|
||||
{
|
||||
return Fixed(RAW, nds_sqrt64(((long long)(g))<<BP));
|
||||
}
|
||||
#else
|
||||
inline Fixed Fixed::sqrt()
|
||||
{
|
||||
long long m, root = 0, left = (long long)g<<FIXED_BP;
|
||||
for ( m = (long long)1<<( (sizeof(long long)<<3) - 2); m; m >>= 2 )
|
||||
{
|
||||
if ( ( left & -m ) > root )
|
||||
left -= ( root += m ), root += m;
|
||||
root >>= 1;
|
||||
}
|
||||
return Fixed(RAW, root);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline Fixed sqrt(Fixed a) { return a.sqrt(); }
|
||||
inline Fixed sqrtf(Fixed a) { return a.sqrt(); }
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_IS_NDS
|
||||
// Use the libnds lookup tables for trigonometry functions
|
||||
inline Fixed Fixed::cosf() {
|
||||
int idx = (((long long)g*(long long)G_1_DIV_PI)>>24)%512;
|
||||
if(idx < 0)
|
||||
idx += 512;
|
||||
return Fixed(RAW, COS_bin[idx] << 4);
|
||||
}
|
||||
inline Fixed cosf(Fixed x) { return x.cosf(); }
|
||||
inline Fixed Fixed::sinf() {
|
||||
int idx = (((long long)g*(long long)G_1_DIV_PI)>>24)%512;
|
||||
if(idx < 0)
|
||||
idx += 512;
|
||||
return Fixed(RAW, SIN_bin[idx] << 4);
|
||||
}
|
||||
inline Fixed sinf(Fixed x) { return x.sinf(); }
|
||||
inline Fixed Fixed::tanf() {
|
||||
int idx = (((long long)g*(long long)G_1_DIV_PI)>>24)%512;
|
||||
if(idx < 0)
|
||||
idx += 512;
|
||||
return Fixed(RAW, TAN_bin[idx] << 4);
|
||||
}
|
||||
inline Fixed tanf(Fixed x) { return x.tanf(); }
|
||||
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user