1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-05-11 03:23:50 +00:00

Eliminating obsolete #ifdefs and friends (#26)

The following options have been applied globally, using unifdef(1):
```c
 #undef BBGE_BUILD_DIRECTX

 #define BBGE_BUILD_OPENGL 1
 #define GL_GLEXT_LEGACY   1
 #define HAVE_PUTENV       1
 #define TIXML_USE_STL     1
 #define BBGE_BUILD_SDL    1
```
This commit is contained in:
Nicolas Braud-Santoni 2016-05-05 03:49:41 +02:00 committed by False.Genesis
parent dff33b0530
commit 276265be1d
54 changed files with 1 additions and 2248 deletions

View file

@ -37,7 +37,6 @@ class TimelineRender : public RenderObject
{ {
void onRender() void onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
glLineWidth(1); glLineWidth(1);
glBegin(GL_LINES); glBegin(GL_LINES);
glColor4f(1, 1, 1, 1); glColor4f(1, 1, 1, 1);
@ -47,7 +46,6 @@ class TimelineRender : public RenderObject
glVertex3f(x, 5, 0); glVertex3f(x, 5, 0);
} }
glEnd(); glEnd();
#endif
} }
}; };

View file

@ -278,7 +278,6 @@ void AutoMap::onRender()
// if (!doRender) return; // if (!doRender) return;
if (alpha.x == 0) return; if (alpha.x == 0) return;
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
RenderObject::lastTextureApplied = 0; RenderObject::lastTextureApplied = 0;
float alphaValue = alpha.x; float alphaValue = alpha.x;
@ -399,7 +398,6 @@ void AutoMap::onRender()
glColor4f(0.5,0.75,1, alphaValue*0.5f); glColor4f(0.5,0.75,1, alphaValue*0.5f);
drawCircle(blip.x*16, 8); drawCircle(blip.x*16, 8);
#endif
} }

View file

@ -141,7 +141,6 @@ void Beam::render()
void Beam::onRender() void Beam::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE); //glDisable(GL_CULL_FACE);
Vector diff = endPos - position; Vector diff = endPos - position;
Vector side = diff; Vector side = diff;
@ -160,7 +159,6 @@ void Beam::onRender()
glTexCoord2f(0, 1); glTexCoord2f(0, 1);
glVertex2f(sideRight.x, sideRight.y); glVertex2f(sideRight.x, sideRight.y);
glEnd(); glEnd();
#endif
} }
void Beam::onUpdate(float dt) void Beam::onUpdate(float dt)

View file

@ -60,7 +60,6 @@ void CurrentRender::onUpdate(float dt)
void CurrentRender::onRender() void CurrentRender::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
// note: Leave cull_face disabled!? // note: Leave cull_face disabled!?
//glDisable(GL_CULL_FACE); //glDisable(GL_CULL_FACE);
//int qs = 0; //int qs = 0;
@ -316,7 +315,6 @@ void CurrentRender::onRender()
debugLog(os.str()); debugLog(os.str());
*/ */
#endif
} }

View file

@ -41,9 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Network.h" #include "Network.h"
#ifdef BBGE_BUILD_OPENGL
#include <sys/stat.h> #include <sys/stat.h>
#endif
#ifdef BBGE_BUILD_VFS #ifdef BBGE_BUILD_VFS
#include "ttvfs.h" #include "ttvfs.h"
@ -281,9 +279,7 @@ void DSQ::forceInputGrabOff()
{ {
toggleInputGrabPlat(false); toggleInputGrabPlat(false);
setInpGrab = 0; setInpGrab = 0;
#ifdef BBGE_BUILD_SDL
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
#endif
} }
void DSQ::rumble(float leftMotor, float rightMotor, float time) void DSQ::rumble(float leftMotor, float rightMotor, float time)
@ -857,7 +853,6 @@ void DSQ::setVersionLabelText()
versionLabel->setText(os.str()); versionLabel->setText(os.str());
} }
#ifdef BBGE_BUILD_SDL
static bool sdlVideoModeOK(const int w, const int h, const int bpp) static bool sdlVideoModeOK(const int w, const int h, const int bpp)
{ {
#ifdef BBGE_BUILD_SDL2 #ifdef BBGE_BUILD_SDL2
@ -874,7 +869,6 @@ static bool sdlVideoModeOK(const int w, const int h, const int bpp)
return SDL_VideoModeOK(w, h, bpp, SDL_OPENGL | SDL_FULLSCREEN); return SDL_VideoModeOK(w, h, bpp, SDL_OPENGL | SDL_FULLSCREEN);
#endif #endif
} }
#endif
void DSQ::init() void DSQ::init()
{ {
@ -1035,7 +1029,6 @@ This build is not yet final, and as such there are a couple things lacking. They
debugLog("OK"); debugLog("OK");
*/ */
#ifdef BBGE_BUILD_SDL
SDL_Init(SDL_INIT_VIDEO); SDL_Init(SDL_INIT_VIDEO);
if (fullscreen && !sdlVideoModeOK(user.video.resx, user.video.resy, user.video.bits)) if (fullscreen && !sdlVideoModeOK(user.video.resx, user.video.resy, user.video.bits))
{ {
@ -1045,7 +1038,6 @@ This build is not yet final, and as such there are a couple things lacking. They
if (!sdlVideoModeOK(user.video.resx, user.video.resy, user.video.bits)) if (!sdlVideoModeOK(user.video.resx, user.video.resy, user.video.bits))
fullscreen = false; // last chance. fullscreen = false; // last chance.
} }
#endif
debugLog("Init Graphics Library..."); debugLog("Init Graphics Library...");
initGraphicsLibrary(user.video.resx, user.video.resy, fullscreen, user.video.vsync, user.video.bits); initGraphicsLibrary(user.video.resx, user.video.resy, fullscreen, user.video.vsync, user.video.bits);
@ -4158,19 +4150,15 @@ void DSQ::bindInput()
addAction(MakeFunctionEvent(DSQ, toggleRenderCollisionShapes), KEY_RETURN, 0); addAction(MakeFunctionEvent(DSQ, toggleRenderCollisionShapes), KEY_RETURN, 0);
} }
addAction(MakeFunctionEvent(DSQ, debugMenu), KEY_BACKSPACE, 0); addAction(MakeFunctionEvent(DSQ, debugMenu), KEY_BACKSPACE, 0);
#if BBGE_BUILD_SDL
addAction(MakeFunctionEvent(DSQ, takeScreenshot ), KEY_PRINTSCREEN, 0); addAction(MakeFunctionEvent(DSQ, takeScreenshot ), KEY_PRINTSCREEN, 0);
#endif
addAction(MakeFunctionEvent(DSQ, takeScreenshotKey ), KEY_P, 0); addAction(MakeFunctionEvent(DSQ, takeScreenshotKey ), KEY_P, 0);
} }
void DSQ::jiggleCursor() void DSQ::jiggleCursor()
{ {
#ifdef BBGE_BUILD_SDL
// hacky // hacky
SDL_ShowCursor(SDL_ENABLE); SDL_ShowCursor(SDL_ENABLE);
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
#endif
} }
float skipSfxVol = 1.0; float skipSfxVol = 1.0;
@ -4209,9 +4197,7 @@ void DSQ::onUpdate(float dt)
{ {
pollEvents(); pollEvents();
ActionMapper::onUpdate(sec); ActionMapper::onUpdate(sec);
#ifdef BBGE_BUILD_SDL
SDL_Delay(int(sec*1000)); SDL_Delay(int(sec*1000));
#endif
render(); render();
showBuffer(); showBuffer();
resetTimer(); resetTimer();
@ -4965,10 +4951,8 @@ void AquariaScreenTransition::capture()
width = core->getWindowWidth(); width = core->getWindowWidth();
height = core->getWindowHeight(); height = core->getWindowHeight();
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D,screen_texture); glBindTexture(GL_TEXTURE_2D,screen_texture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, width, height); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, width, height);
#endif
dsq->cursor->alpha = oldAlpha; dsq->cursor->alpha = oldAlpha;

View file

@ -1949,7 +1949,6 @@ void Game::clearObsRows()
void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim) void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
{ {
#ifdef BBGE_BUILD_OPENGL
if (q->texture) if (q->texture)
{ {
std::vector<TileVector> obs; std::vector<TileVector> obs;
@ -2079,7 +2078,6 @@ void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
} }
glPopMatrix(); glPopMatrix();
} }
#endif
} }
std::string Game::getNoteName(int n, const std::string &pre) std::string Game::getNoteName(int n, const std::string &pre)
@ -2764,7 +2762,6 @@ void Game::setTimerText(float time)
void Game::generateCollisionMask(Quad *q, float overrideCollideRadius /* = 0 */) void Game::generateCollisionMask(Quad *q, float overrideCollideRadius /* = 0 */)
{ {
#ifdef BBGE_BUILD_OPENGL
if (q->texture) if (q->texture)
{ {
q->collidePosition = Vector(0,0,0); q->collidePosition = Vector(0,0,0);
@ -2869,7 +2866,6 @@ void Game::generateCollisionMask(Quad *q, float overrideCollideRadius /* = 0 */)
rot += 360; rot += 360;
*/ */
} }
#endif
} }
void Game::addPath(Path *p) void Game::addPath(Path *p)

View file

@ -46,22 +46,13 @@ inline static void doRenderGrid(int x, int startCol, int endCol)
const int drawy1 = startCol*TILE_SIZE; const int drawy1 = startCol*TILE_SIZE;
const int drawy2 = (endCol+1)*TILE_SIZE; const int drawy2 = (endCol+1)*TILE_SIZE;
#ifdef BBGE_BUILD_OPENGL
glBegin(GL_QUADS); glBegin(GL_QUADS);
glVertex3i(drawx1, drawy2, 0.0f); glVertex3i(drawx1, drawy2, 0.0f);
glVertex3i(drawx2, drawy2, 0.0f); glVertex3i(drawx2, drawy2, 0.0f);
glVertex3i(drawx2, drawy1, 0.0f); glVertex3i(drawx2, drawy1, 0.0f);
glVertex3i(drawx1, drawy1, 0.0f); glVertex3i(drawx1, drawy1, 0.0f);
glEnd(); glEnd();
#endif
#ifdef BBGE_BUILD_DIRECTX
core->blitD3DVerts(0,
drawx1, drawy1,
drawx2, drawy1,
drawx2, drawy2,
drawx1, drawy2);
#endif
} }
void GridRender::onRender() void GridRender::onRender()
@ -163,7 +154,6 @@ void SongLineRender::onRender()
int ls = (4*w)/1024.0f; int ls = (4*w)/1024.0f;
if (ls < 0) if (ls < 0)
ls = 1; ls = 1;
#ifdef BBGE_BUILD_OPENGL
glLineWidth(ls); glLineWidth(ls);
const int alphaLine = pts.size()*(0.9f); const int alphaLine = pts.size()*(0.9f);
float a = 1; float a = 1;
@ -178,6 +168,5 @@ void SongLineRender::onRender()
glVertex2f(pts[i].pt.x, pts[i].pt.y); glVertex2f(pts[i].pt.x, pts[i].pt.y);
} }
glEnd(); glEnd();
#endif
} }

View file

@ -125,7 +125,6 @@ HairNode *Hair::getHairNode(int idx)
void Hair::onRender() void Hair::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE); //glDisable(GL_CULL_FACE);
glBegin(GL_QUAD_STRIP); glBegin(GL_QUAD_STRIP);
@ -189,7 +188,6 @@ void Hair::onRender()
*/ */
//glEnable(GL_CULL_FACE); //glEnable(GL_CULL_FACE);
#endif
} }
void Hair::onUpdate(float dt) void Hair::onUpdate(float dt)

View file

@ -66,20 +66,6 @@ static void CheckConfig(void)
} }
#if defined(BBGE_BUILD_WINDOWS) && !defined(BBGE_BUILD_SDL)
int WINAPI WinMain( HINSTANCE hInstance, // Instance
HINSTANCE hPrevInstance, // Previous Instance
LPSTR lpCmdLine, // Command Line Parameters
int nCmdShow) // Window Show State
{
#ifdef _DEBUG
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
_CrtSetReportMode ( _CRT_ERROR, _CRTDBG_MODE_DEBUG);
#endif
std::string dsqParam = GetCommandLine();
#else
extern "C" int main(int argc,char *argv[]) extern "C" int main(int argc,char *argv[])
{ {
@ -102,7 +88,6 @@ static void CheckConfig(void)
extraDataDir = AQUARIA_EXTRA_DATA_DIR; extraDataDir = AQUARIA_EXTRA_DATA_DIR;
#endif #endif
#endif
CheckConfig(); CheckConfig();

View file

@ -475,7 +475,6 @@ void MiniMapRender::onUpdate(float dt)
void MiniMapRender::onRender() void MiniMapRender::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
RenderObject::lastTextureApplied = 0; RenderObject::lastTextureApplied = 0;
@ -760,7 +759,6 @@ void MiniMapRender::onRender()
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
#endif
} }
void MiniMapRender::renderIcon(MinimapIcon *ico, const Vector& pos) void MiniMapRender::renderIcon(MinimapIcon *ico, const Vector& pos)

View file

@ -30,7 +30,6 @@ PathRender::PathRender() : RenderObject()
void PathRender::onRender() void PathRender::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
const int pathcount = dsq->game->getNumPaths(); const int pathcount = dsq->game->getNumPaths();
if (pathcount <= 0) if (pathcount <= 0)
return; return;
@ -109,5 +108,4 @@ void PathRender::onRender()
glPopMatrix(); glPopMatrix();
} }
} }
#endif
} }

View file

@ -93,7 +93,6 @@ std::string getMapTemplateFilename()
void WarpAreaRender::onRender() void WarpAreaRender::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
for (int i = 0; i < dsq->game->warpAreas.size(); i++) for (int i = 0; i < dsq->game->warpAreas.size(); i++)
{ {
WarpArea *a = &dsq->game->warpAreas[i]; WarpArea *a = &dsq->game->warpAreas[i];
@ -141,53 +140,6 @@ void WarpAreaRender::onRender()
} }
glTranslatef(-a->position.x, -a->position.y,0); glTranslatef(-a->position.x, -a->position.y,0);
} }
#endif
#ifdef BBGE_BUILD_DIRECTX
for (int i = 0; i < dsq->game->warpAreas.size(); i++)
{
WarpArea *a = &dsq->game->warpAreas[i];
core->translateMatrixStack(a->position.x, a->position.y);
switch (a->warpAreaType[0])
{
case 'B':
core->setColor(0, 0, 1, alpha.x);
break;
case 'R':
core->setColor(1,0,0,alpha.x);
break;
case 'G':
core->setColor(0,1,0,alpha.x);
break;
case 'Y':
core->setColor(1,1,0,alpha.x);
break;
case 'P':
core->setColor(1,0,1,alpha.x);
break;
}
if (a->radius)
{
// drawCircle(a->radius);
}
else
{
core->applyMatrixStackToWorld();
core->blitD3D(0, a->w*2, a->h*2);
/*
glBegin(GL_QUADS);
{
glVertex2f(-a->w,-a->h);
glVertex2f(-a->w,a->h);
glVertex2f(a->w,a->h);
glVertex2f(a->w,-a->h);
}
glEnd();
*/
}
core->translateMatrixStack(-a->position.x, -a->position.y);
//glTranslatef(-a->position.x, -a->position.y,0);
}
#endif
} }
SceneEditor::SceneEditor() : ActionMapper(), on(false) SceneEditor::SceneEditor() : ActionMapper(), on(false)

View file

@ -34,7 +34,6 @@ StarRenderer::StarRenderer(int num, int range) : RenderObject()
void StarRenderer::render() void StarRenderer::render()
{ {
#ifdef BBGE_BUILD_OPENGL
core->enable3D(); core->enable3D();
glLoadIdentity(); glLoadIdentity();
glTranslatef(position.x, position.y, position.z); glTranslatef(position.x, position.y, position.z);
@ -60,7 +59,6 @@ void StarRenderer::render()
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPopMatrix(); glPopMatrix();
*/ */
#endif
} }
void StarRenderer::onRender() void StarRenderer::onRender()

View file

@ -40,7 +40,6 @@ void SteamRender::onUpdate(float dt)
void SteamRender::onRender() void SteamRender::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE); //glDisable(GL_CULL_FACE);
//int qs = 0; //int qs = 0;
@ -122,6 +121,5 @@ void SteamRender::onRender()
} }
//glEnable(GL_CULL_FACE); //glEnable(GL_CULL_FACE);
#endif
} }

View file

@ -50,7 +50,6 @@ void Strand::onUpdate(float dt)
void Strand::onRender() void Strand::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
const int numSegments = segments.size(); const int numSegments = segments.size();
if (numSegments == 0) return; if (numSegments == 0) return;
@ -90,5 +89,4 @@ void Strand::onRender()
glVertex2f(segments[i]->position.x, segments[i]->position.y); glVertex2f(segments[i]->position.x, segments[i]->position.y);
} }
glEnd(); glEnd();
#endif
} }

View file

@ -188,7 +188,6 @@ void WaterSurfaceRender::render()
void WaterSurfaceRender::onRender() void WaterSurfaceRender::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
if (dsq->game->waterLevel == 0) return; if (dsq->game->waterLevel == 0) return;
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited()) if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
{ {
@ -256,5 +255,4 @@ void WaterSurfaceRender::onRender()
//glDisable(GL_SCISSOR_TEST); //glDisable(GL_SCISSOR_TEST);
#endif
} }

View file

@ -153,7 +153,6 @@ void Web::onUpdate(float dt)
void Web::onRender() void Web::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
//glDisable(GL_BLEND); //glDisable(GL_BLEND);
@ -172,5 +171,4 @@ void Web::onRender()
} }
glEnd(); glEnd();
#endif
} }

View file

@ -177,7 +177,6 @@ void AfterEffectManager::render()
{ {
assert(core->frameBuffer.isInited()); assert(core->frameBuffer.isInited());
#ifdef BBGE_BUILD_OPENGL
glPushMatrix(); glPushMatrix();
glDisable (GL_ALPHA_TEST); glDisable (GL_ALPHA_TEST);
@ -191,12 +190,10 @@ void AfterEffectManager::render()
renderGrid(); renderGrid();
//renderGridPoints(); //renderGridPoints();
glPopMatrix(); glPopMatrix();
#endif
} }
void AfterEffectManager::renderGrid() void AfterEffectManager::renderGrid()
{ {
#ifdef BBGE_BUILD_OPENGL
int firstShader = -1; int firstShader = -1;
int lastShader = -1; int lastShader = -1;
@ -355,12 +352,10 @@ void AfterEffectManager::renderGrid()
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//if (bRenderGridPoints) //if (bRenderGridPoints)
// renderGridPoints(); // renderGridPoints();
#endif
} }
void AfterEffectManager::renderGridPoints() void AfterEffectManager::renderGridPoints()
{ {
#ifdef BBGE_BUILD_OPENGL
glColor4f(0.0f,0.0f,0.0f,1.0f); glColor4f(0.0f,0.0f,0.0f,1.0f);
for (int i = 0; i < (xDivs); i++) for (int i = 0; i < (xDivs); i++)
{ {
@ -374,7 +369,6 @@ void AfterEffectManager::renderGridPoints()
glEnd(); glEnd();
} }
} }
#endif
} }
void AfterEffectManager::unloadDevice() void AfterEffectManager::unloadDevice()

View file

@ -351,7 +351,6 @@ bool exists(const std::string &f, bool makeFatal, bool skipVFS)
void drawCircle(float radius, int stepSize) void drawCircle(float radius, int stepSize)
{ {
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE); //glDisable(GL_CULL_FACE);
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
@ -364,7 +363,6 @@ void drawCircle(float radius, int stepSize)
glEnd(); glEnd();
//glEnable(GL_CULL_FACE); //glEnable(GL_CULL_FACE);
#endif
} }
void exit_error(const std::string &message) void exit_error(const std::string &message)
@ -385,9 +383,7 @@ std::string parseCommand(const std::string &line, const std::string &command)
void glColor3_256(int r, int g, int b) void glColor3_256(int r, int g, int b)
{ {
#ifdef BBGE_BUILD_OPENGL
glColor4f(float(r)/256.0f, float(g)/256.0f, float(b)/256.0f, 1.0f); glColor4f(float(r)/256.0f, float(g)/256.0f, float(b)/256.0f, 1.0f);
#endif
} }
bool chance(int perc) bool chance(int perc)
@ -930,14 +926,12 @@ GLuint generateEmptyTexture(int quality) // Create An Empty Texture
memset(data, 0, size); // Clear Storage Memory memset(data, 0, size); // Clear Storage Memory
#ifdef BBGE_BUILD_OPENGL
glGenTextures(1, &txtnumber); // Create 1 Texture glGenTextures(1, &txtnumber); // Create 1 Texture
glBindTexture(GL_TEXTURE_2D, txtnumber); // Bind The Texture glBindTexture(GL_TEXTURE_2D, txtnumber); // Bind The Texture
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, quality, quality, 0, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, quality, quality, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data); // Build Texture Using Information In data GL_RGBA, GL_UNSIGNED_BYTE, data); // Build Texture Using Information In data
#endif
delete [] data; // Release data delete [] data; // Release data

View file

@ -60,46 +60,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <glfw.h> #include <glfw.h>
#include "glext.h" #include "glext.h"
//#include "glext.h" //#include "glext.h"
#elif BBGE_BUILD_DIRECTX
#if defined(BBGE_BUILD_X360) && !defined(BBGE_BUILD_WINDOWS)
#include <xtl.h>
#include <ppcintrinsics.h>
#endif // _XBOX
#if defined(BBGE_BUILD_X360) && defined(BBGE_BUILD_WINDOWS)
// Using the win32\ path prefix on the D3D include files makes sure that the Xbox 360
// version of D3D is used, not the DirectX SDK version.
#include <win32\vs2005\d3d9.h>
#include <win32\vs2005\d3dx9.h>
#pragma warning(disable:4100)
#include "XTLOnPC.h"
#endif // _PC
#if defined(BBGE_BUILD_X360)
#include <xgraphics.h>
#include <xboxmath.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#endif
#endif #endif
#ifdef BBGE_BUILD_SDL
#include "SDL.h" #include "SDL.h"
#endif
#if defined(BBGE_BUILD_OPENGL)
#define GL_GLEXT_LEGACY 1 #define GL_GLEXT_LEGACY 1
#include "gl.h" #include "gl.h"
#include "glext.h" #include "glext.h"
#endif
#define compile_assert(pred) switch(0){case 0:case (pred):;} #define compile_assert(pred) switch(0){case 0:case (pred):;}
@ -233,9 +202,6 @@ Direction getOppositeDir(Direction dir);
Direction getNextDirClockwise(Direction dir); Direction getNextDirClockwise(Direction dir);
Vector colorRGB(int r, int g, int b); Vector colorRGB(int r, int g, int b);
#ifdef BBGE_BUILD_DIRECTX
typedef unsigned int GLuint;
#endif
GLuint generateEmptyTexture(int res); GLuint generateEmptyTexture(int res);
//void pForEachFile(std::string path, std::string type, void callback(const std::string &filename, int param), int param); //void pForEachFile(std::string path, std::string type, void callback(const std::string &filename, int param), int param);

View file

@ -56,14 +56,12 @@ void BmpFont::load(const std::string &file, float scale, bool loadTexture)
this->scale = scale; this->scale = scale;
#ifdef BBGE_BUILD_OPENGL
GLuint id=0; GLuint id=0;
glGenTextures(1, &id); glGenTextures(1, &id);
if (!font.Create(file.c_str(), id, loadTexture)) if (!font.Create(file.c_str(), id, loadTexture))
return; return;
#endif
loaded = true; loaded = true;
} }
@ -316,7 +314,6 @@ void BitmapText::onRender()
float top_color[3] = {bmpFont->fontTopColor.x*color.x, bmpFont->fontTopColor.y*color.y, bmpFont->fontTopColor.z*color.z}; float top_color[3] = {bmpFont->fontTopColor.x*color.x, bmpFont->fontTopColor.y*color.y, bmpFont->fontTopColor.z*color.z};
float bottom_color[3] = {bmpFont->fontBtmColor.x*color.x, bmpFont->fontBtmColor.y*color.y, bmpFont->fontBtmColor.z*color.z}; float bottom_color[3] = {bmpFont->fontBtmColor.x*color.x, bmpFont->fontBtmColor.y*color.y, bmpFont->fontBtmColor.z*color.z};
#ifdef BBGE_BUILD_OPENGL
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
/* /*
glEnable(GL_BLEND); glEnable(GL_BLEND);
@ -382,7 +379,6 @@ void BitmapText::onRender()
//glEnable(GL_CULL_FACE); //glEnable(GL_CULL_FACE);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
#endif
} }
void BitmapText::unloadDevice() void BitmapText::unloadDevice()

View file

@ -203,7 +203,6 @@ float CollisionShape::getX2()
void CollisionShape::render() void CollisionShape::render()
{ {
#ifdef BBGE_BUILD_OPENGL
glTranslatef(offsetPosition.x, offsetPosition.y,0); glTranslatef(offsetPosition.x, offsetPosition.y,0);
switch(getType()) switch(getType())
{ {
@ -245,7 +244,6 @@ void CollisionShape::render()
} }
glTranslatef(-offsetPosition.x, -offsetPosition.y,0); glTranslatef(-offsetPosition.x, -offsetPosition.y,0);
#endif
//glDisable(GL_BLEND); //glDisable(GL_BLEND);
} }

File diff suppressed because it is too large Load diff

View file

@ -105,174 +105,6 @@ class Texture;
const int baseVirtualWidth = 800; const int baseVirtualWidth = 800;
const int baseVirtualHeight = 600; const int baseVirtualHeight = 600;
#if (defined(BBGE_BUILD_WINDOWS)) && !defined(BBGE_BUILD_SDL)
enum GameKeys
{
KEY_BACKSPACE = DIK_BACKSPACE,
KEY_CAPSLOCK = DIK_CAPSLOCK,
KEY_CIRCUMFLEX = DIK_CIRCUMFLEX,
KEY_DOWNARROW = DIK_DOWNARROW,
KEY_LALT = DIK_LALT,
KEY_LEFTARROW = DIK_LEFTARROW,
KEY_NUMPADMINUS = DIK_NUMPADMINUS,
KEY_NUMPADPERIOD = DIK_NUMPADPERIOD,
KEY_NUMPADPLUS = DIK_NUMPADPLUS,
KEY_NUMPADSLASH = DIK_NUMPADSLASH,
KEY_NUMPADSTAR = DIK_NUMPADSTAR,
KEY_PGDN = DIK_PGDN,
KEY_PGUP = DIK_PGUP,
KEY_RALT = DIK_RALT,
KEY_RIGHTARROW = DIK_RIGHTARROW,
KEY_UPARROW = DIK_UPARROW,
KEY_TILDE = DIK_GRAVE,
KEY_0 = DIK_0,
KEY_1 = DIK_1,
KEY_2 = DIK_2,
KEY_3 = DIK_3,
KEY_4 = DIK_4,
KEY_5 = DIK_5,
KEY_6 = DIK_6,
KEY_7 = DIK_7,
KEY_8 = DIK_8,
KEY_9 = DIK_9,
KEY_A = DIK_A,
KEY_ABNT_C1 = DIK_ABNT_C1,
KEY_ABNT_C2 = DIK_ABNT_C2,
KEY_ADD = DIK_ADD,
KEY_APOSTROPHE = DIK_APOSTROPHE,
KEY_APPS = DIK_APPS,
KEY_AT = DIK_AT,
KEY_AX = DIK_AX,
KEY_B = DIK_B,
KEY_BACK = DIK_BACK,
KEY_BACKSLASH = DIK_BACKSLASH,
KEY_C = DIK_C,
KEY_CALCULATOR = DIK_CALCULATOR,
KEY_CAPITAL = DIK_CAPITAL,
KEY_COLON = DIK_COLON,
KEY_COMMA = DIK_COMMA,
KEY_CONVERT = DIK_CONVERT,
KEY_D = DIK_D,
KEY_DECIMAL = DIK_DECIMAL,
KEY_DELETE = DIK_DELETE,
KEY_DIVIDE = DIK_DIVIDE,
KEY_DOWN = DIK_DOWN,
KEY_E = DIK_E,
KEY_END = DIK_END,
KEY_EQUALS = DIK_EQUALS,
KEY_ESCAPE = DIK_ESCAPE,
KEY_F = DIK_F,
KEY_F1 = DIK_F1,
KEY_F2 = DIK_F2,
KEY_F3 = DIK_F3,
KEY_F4 = DIK_F4,
KEY_F5 = DIK_F5,
KEY_F6 = DIK_F6,
KEY_F7 = DIK_F7,
KEY_F8 = DIK_F8,
KEY_F9 = DIK_F9,
KEY_F10 = DIK_F10,
KEY_F11 = DIK_F11,
KEY_F12 = DIK_F12,
KEY_F13 = DIK_F13,
KEY_F14 = DIK_F14,
KEY_F15 = DIK_F15,
KEY_G = DIK_G,
KEY_GRAVE = DIK_GRAVE,
KEY_H = DIK_H,
KEY_HOME = DIK_HOME,
KEY_I = DIK_I,
KEY_INSERT = DIK_INSERT,
KEY_J = DIK_J,
KEY_K = DIK_K,
KEY_KANA = DIK_KANA,
KEY_KANJI = DIK_KANJI,
KEY_L = DIK_L,
KEY_LBRACKET = DIK_LBRACKET,
KEY_LCONTROL = DIK_LCONTROL,
KEY_LEFT = DIK_LEFT,
KEY_LMENU = DIK_LMENU,
KEY_LSHIFT = DIK_LSHIFT,
KEY_LMETA = DIK_LWIN,
KEY_M = DIK_M,
KEY_MAIL = DIK_MAIL,
KEY_MEDIASELECT = DIK_MEDIASELECT,
KEY_MEDIASTOP = DIK_MEDIASTOP,
KEY_MINUS = DIK_MINUS,
KEY_MULTIPLY = DIK_MULTIPLY,
KEY_MUTE = DIK_MUTE,
KEY_MYCOMPUTER = DIK_MYCOMPUTER,
KEY_N = DIK_N,
KEY_NEXT = DIK_NEXT,
KEY_NEXTTRACK = DIK_NEXTTRACK,
KEY_NOCONVERT = DIK_NOCONVERT,
KEY_NUMLOCK = DIK_NUMLOCK,
KEY_NUMPAD0 = DIK_NUMPAD0,
KEY_NUMPAD1 = DIK_NUMPAD1,
KEY_NUMPAD2 = DIK_NUMPAD2,
KEY_NUMPAD3 = DIK_NUMPAD3,
KEY_NUMPAD4 = DIK_NUMPAD4,
KEY_NUMPAD5 = DIK_NUMPAD5,
KEY_NUMPAD6 = DIK_NUMPAD6,
KEY_NUMPAD7 = DIK_NUMPAD7,
KEY_NUMPAD8 = DIK_NUMPAD8,
KEY_NUMPAD9 = DIK_NUMPAD9,
KEY_NUMPADCOMMA = DIK_NUMPADCOMMA,
KEY_NUMPADENTER = DIK_NUMPADENTER,
KEY_NUMPADEQUALS = DIK_NUMPADEQUALS,
KEY_O = DIK_O,
KEY_OEM_102 = DIK_OEM_102,
KEY_P = DIK_P,
KEY_PAUSE = DIK_PAUSE,
KEY_PERIOD = DIK_PERIOD,
KEY_PLAYPAUSE = DIK_PLAYPAUSE,
KEY_POWER = DIK_POWER,
KEY_PREVTRACK = DIK_PREVTRACK,
KEY_PRIOR = DIK_PRIOR,
KEY_Q = DIK_Q,
KEY_R = DIK_R,
KEY_RBRACKET = DIK_RBRACKET,
KEY_RCONTROL = DIK_RCONTROL,
KEY_RETURN = DIK_RETURN,
KEY_RIGHT = DIK_RIGHT,
KEY_RMENU = DIK_RMENU,
KEY_RSHIFT = DIK_RSHIFT,
KEY_RMETA = DIK_RWIN,
KEY_S = DIK_S,
KEY_SCROLL = DIK_SCROLL,
KEY_SEMICOLON = DIK_SEMICOLON,
KEY_SLASH = DIK_SLASH,
KEY_SLEEP = DIK_SLEEP,
KEY_SPACE = DIK_SPACE,
KEY_STOP = DIK_STOP,
KEY_SUBTRACT = DIK_SUBTRACT,
KEY_SYSRQ = DIK_SYSRQ,
KEY_T = DIK_T,
KEY_TAB = DIK_TAB,
KEY_U = DIK_U,
KEY_UNDERLINE = DIK_UNDERLINE,
KEY_UNLABELED = DIK_UNLABELED,
KEY_UP = DIK_UP,
KEY_V = DIK_V,
KEY_VOLUMEDOWN = DIK_VOLUMEDOWN,
KEY_VOLUMEUP = DIK_VOLUMEUP,
KEY_W = DIK_W,
KEY_WAKE = DIK_WAKE,
KEY_WEBBACK = DIK_WEBBACK,
KEY_WEBFAVORITES = DIK_WEBFAVORITES,
KEY_WEBFORWARD = DIK_WEBFORWARD,
KEY_WEBHOME = DIK_WEBHOME,
KEY_WEBREFRESH = DIK_WEBREFRESH,
KEY_WEBSEARCH = DIK_WEBSEARCH,
KEY_WEBSTOP = DIK_WEBSTOP,
KEY_X = DIK_X,
KEY_Y = DIK_Y,
KEY_YEN = DIK_YEN,
KEY_Z = DIK_Z,
KEY_ANYKEY = 4059,
KEY_MAXARRAY = 256
};
#elif defined(BBGE_BUILD_SDL)
enum GameKeys enum GameKeys
{ {
// replace with GLFW equivalent // replace with GLFW equivalent
@ -393,353 +225,6 @@ enum GameKeys
KEY_ANYKEY, KEY_ANYKEY,
KEY_MAXARRAY KEY_MAXARRAY
}; };
#elif defined(BBGE_BUILD_XINPUT)
enum GameKeys
{
KEY_LSUPER = 0,
KEY_RSUPER = 0,
KEY_LMETA = 0,
KEY_RMETA = 0,
KEY_BACKSPACE = 0,
KEY_PRINTSCREEN = 0,
KEY_LALT = 0,
KEY_RALT = 0,
KEY_LSHIFT = 0,
KEY_RSHIFT = 0,
KEY_LCONTROL = 0,
KEY_RCONTROL = 0,
KEY_NUMPADMINUS = 0,
KEY_NUMPADPERIOD = 0,
KEY_NUMPADPLUS = 0,
KEY_NUMPADSLASH = 0,
KEY_NUMPADSTAR = 0,
KEY_PGDN = 0,
KEY_PGUP = 0,
KEY_TILDE = 0,
KEY_0 = 0,
KEY_1 = 0,
KEY_2 = 0,
KEY_3 = 0,
KEY_4 = 0,
KEY_5 = 0,
KEY_6 = 0,
KEY_7 = 0,
KEY_8 = 0,
KEY_9 = 0,
KEY_A = 0,
KEY_B = 0,
KEY_C = 0,
KEY_D = 0,
KEY_E = 0,
KEY_F = 0,
KEY_G = 0,
KEY_H = 0,
KEY_I = 0,
KEY_J = 0,
KEY_K = 0,
KEY_L = 0,
KEY_M = 0,
KEY_N = 0,
KEY_O = 0,
KEY_P = 0,
KEY_Q = 0,
KEY_R = 0,
KEY_S = 0,
KEY_T = 0,
KEY_U = 0,
KEY_V = 0,
KEY_W = 0,
KEY_X = 0,
KEY_Y = 0,
KEY_Z = 0,
KEY_LEFT = 0,
KEY_RIGHT = 0,
KEY_UP = 0,
KEY_DOWN = 0,
KEY_NUMPAD1 = 0,
KEY_NUMPAD2 = 0,
KEY_NUMPAD3 = 0,
KEY_NUMPAD4 = 0,
KEY_NUMPAD5 = 0,
KEY_NUMPAD6 = 0,
KEY_NUMPAD7 = 0,
KEY_NUMPAD8 = 0,
KEY_NUMPAD9 = 0,
KEY_NUMPAD0 = 0,
KEY_DELETE = 0,
KEY_SPACE = 0,
KEY_RETURN = 0,
KEY_PERIOD = 0,
KEY_MINUS = 0,
KEY_CAPSLOCK = 0,
KEY_SYSRQ = 0,
KEY_TAB = 0,
KEY_HOME = 0,
KEY_END = 0,
KEY_COMMA = 0,
KEY_SLASH = 0,
KEY_F1 = 0,
KEY_F2 = 0,
KEY_F3 = 0,
KEY_F4 = 0,
KEY_F5 = 0,
KEY_F6 = 0,
KEY_F7 = 0,
KEY_F8 = 0,
KEY_F9 = 0,
KEY_F10 = 0,
KEY_F11 = 0,
KEY_F12 = 0,
KEY_F13 = 0,
KEY_F14 = 0,
KEY_F15 = 0,
KEY_ESCAPE = 0,
KEY_ANYKEY = 4059,
KEY_MAXARRAY = 256
};
#elif defined(BBGE_BUILD_GLFW)
enum GameKeys
{
// replace with GLFW equivalent
/*
KEY_DOWNARROW = GLFW_KEY_DOWN,
KEY_RIGHTARROW = GLFW_KEY_RIGHT,
KEY_UPARROW = GLFW_KEY_UP,
KEY_LEFTARROW = GLFW_KEY_LEFT,
*/
KEY_BACKSPACE = GLFW_KEY_BACKSPACE,
//KEY_CAPSLOCK = DIK_CAPSLOCK,
//KEY_CIRCUMFLEX = DIK_CIRCUMFLEX,
KEY_LALT = GLFW_KEY_LALT,
KEY_RALT = GLFW_KEY_RALT,
KEY_LSHIFT = GLFW_KEY_LSHIFT,
KEY_RSHIFT = GLFW_KEY_RSHIFT,
KEY_LCONTROL = GLFW_KEY_LCTRL,
KEY_RCONTROL = GLFW_KEY_RCTRL,
KEY_NUMPADMINUS = GLFW_KEY_KP_SUBTRACT,
KEY_NUMPADPERIOD = GLFW_KEY_KP_DECIMAL,
KEY_NUMPADPLUS = GLFW_KEY_KP_ADD,
KEY_NUMPADSLASH = GLFW_KEY_KP_DIVIDE,
KEY_NUMPADSTAR = GLFW_KEY_KP_MULTIPLY,
KEY_PGDN = GLFW_KEY_PAGEDOWN,
KEY_PGUP = GLFW_KEY_PAGEUP,
//KEY_RALT = GLFW_KEY_RALT,
KEY_TILDE = '`',
KEY_0 = '0',
KEY_1 = '1',
KEY_2 = '2',
KEY_3 = '3',
KEY_4 = '4',
KEY_5 = '5',
KEY_6 = '6',
KEY_7 = '7',
KEY_8 = '8',
KEY_9 = '9',
KEY_A = 'A',
KEY_B = 'B',
KEY_C = 'C',
KEY_D = 'D',
KEY_E = 'E',
KEY_F = 'F',
KEY_G = 'G',
KEY_H = 'H',
KEY_I = 'I',
KEY_J = 'J',
KEY_K = 'K',
KEY_L = 'L',
KEY_M = 'M',
KEY_N = 'N',
KEY_O = 'O',
KEY_P = 'P',
KEY_Q = 'Q',
KEY_R = 'R',
KEY_S = 'S',
KEY_T = 'T',
KEY_U = 'U',
KEY_V = 'V',
KEY_W = 'W',
KEY_X = 'X',
KEY_Y = 'Y',
KEY_Z = 'Z',
KEY_LEFT = GLFW_KEY_LEFT,
KEY_RIGHT = GLFW_KEY_RIGHT,
KEY_UP = GLFW_KEY_UP,
KEY_DOWN = GLFW_KEY_DOWN,
KEY_NUMPAD1 = GLFW_KEY_KP_1,
KEY_NUMPAD2 = GLFW_KEY_KP_2,
KEY_NUMPAD3 = GLFW_KEY_KP_3,
KEY_NUMPAD4 = GLFW_KEY_KP_4,
KEY_NUMPAD5 = GLFW_KEY_KP_5,
KEY_NUMPAD6 = GLFW_KEY_KP_6,
KEY_NUMPAD7 = GLFW_KEY_KP_7,
KEY_NUMPAD8 = GLFW_KEY_KP_8,
KEY_NUMPAD9 = GLFW_KEY_KP_9,
KEY_NUMPAD0 = GLFW_KEY_KP_0,
KEY_DELETE = GLFW_KEY_DEL,
KEY_SPACE = GLFW_KEY_SPACE,
// mac os x
KEY_RETURN = 13,
KEY_PERIOD = '.',
KEY_MINUS = '-',
KEY_CAPSLOCK = -1,
KEY_SYSRQ = '`',
KEY_TAB = GLFW_KEY_TAB,
KEY_HOME = GLFW_KEY_HOME,
KEY_END = GLFW_KEY_END,
KEY_COMMA = ',',
KEY_SLASH = '/',
//KEY_ABNT_C1 = DIK_ABNT_C1,
//KEY_ABNT_C2 = DIK_ABNT_C2,
/*
KEY_ADD = DIK_ADD,
KEY_APOSTROPHE = DIK_APOSTROPHE,
KEY_APPS = DIK_APPS,
KEY_AT = DIK_AT,
KEY_AX = DIK_AX,
*/
/*
KEY_B = 'B',
KEY_BACK = DIK_BACK,
KEY_BACKSLASH = DIK_BACKSLASH,
KEY_C = DIK_C,
KEY_CALCULATOR = DIK_CALCULATOR,
KEY_CAPITAL = DIK_CAPITAL,
KEY_COLON = DIK_COLON,
KEY_COMMA = DIK_COMMA,
KEY_CONVERT = DIK_CONVERT,
KEY_D = DIK_D,
KEY_DECIMAL = DIK_DECIMAL,
KEY_DELETE = DIK_DELETE,
KEY_DIVIDE = DIK_DIVIDE,
KEY_DOWN = DIK_DOWN,
KEY_E = DIK_E,
KEY_END = DIK_END,
KEY_EQUALS = DIK_EQUALS,
KEY_ESCAPE = DIK_ESCAPE,
KEY_F = DIK_F,
*/
KEY_F1 = GLFW_KEY_F1,
KEY_F2 = GLFW_KEY_F2,
KEY_F3 = GLFW_KEY_F3,
KEY_F4 = GLFW_KEY_F4,
KEY_F5 = GLFW_KEY_F5,
KEY_F6 = GLFW_KEY_F6,
KEY_F7 = GLFW_KEY_F7,
KEY_F8 = GLFW_KEY_F8,
KEY_F9 = GLFW_KEY_F9,
KEY_F10 = GLFW_KEY_F10,
KEY_F11 = GLFW_KEY_F11,
KEY_F12 = GLFW_KEY_F12,
KEY_F13 = GLFW_KEY_F13,
KEY_F14 = GLFW_KEY_F14,
KEY_F15 = GLFW_KEY_F15,
/*
KEY_G = DIK_G,
KEY_GRAVE = DIK_GRAVE,
KEY_H = DIK_H,
KEY_HOME = DIK_HOME,
KEY_I = DIK_I,
KEY_INSERT = DIK_INSERT,
KEY_J = DIK_J,
KEY_K = DIK_K,
KEY_KANA = DIK_KANA,
KEY_KANJI = DIK_KANJI,
KEY_L = DIK_L,
KEY_LBRACKET = DIK_LBRACKET,
KEY_LCONTROL = DIK_LCONTROL,
KEY_LEFT = DIK_LEFT,
KEY_LMENU = DIK_LMENU,
KEY_LWIN = DIK_LWIN,
KEY_M = DIK_M,
KEY_MAIL = DIK_MAIL,
KEY_MEDIASELECT = DIK_MEDIASELECT,
KEY_MEDIASTOP = DIK_MEDIASTOP,
KEY_MINUS = DIK_MINUS,
KEY_MULTIPLY = DIK_MULTIPLY,
KEY_MUTE = DIK_MUTE,
KEY_MYCOMPUTER = DIK_MYCOMPUTER,
KEY_N = DIK_N,
KEY_NEXT = DIK_NEXT,
KEY_NEXTTRACK = DIK_NEXTTRACK,
KEY_NOCONVERT = DIK_NOCONVERT,
KEY_NUMLOCK = DIK_NUMLOCK,
KEY_NUMPAD0 = DIK_NUMPAD0,
KEY_NUMPAD1 = DIK_NUMPAD1,
KEY_NUMPAD2 = DIK_NUMPAD2,
KEY_NUMPAD3 = DIK_NUMPAD3,
KEY_NUMPAD4 = DIK_NUMPAD4,
KEY_NUMPAD5 = DIK_NUMPAD5,
KEY_NUMPAD6 = DIK_NUMPAD6,
KEY_NUMPAD7 = DIK_NUMPAD7,
KEY_NUMPAD8 = DIK_NUMPAD8,
KEY_NUMPAD9 = DIK_NUMPAD9,
KEY_NUMPADCOMMA = DIK_NUMPADCOMMA,
KEY_NUMPADENTER = DIK_NUMPADENTER,
KEY_NUMPADEQUALS = DIK_NUMPADEQUALS,
KEY_O = DIK_O,
KEY_OEM_102 = DIK_OEM_102,
KEY_P = DIK_P,
KEY_PAUSE = DIK_PAUSE,
KEY_PERIOD = DIK_PERIOD,
KEY_PLAYPAUSE = DIK_PLAYPAUSE,
KEY_POWER = DIK_POWER,
KEY_PREVTRACK = DIK_PREVTRACK,
KEY_PRIOR = DIK_PRIOR,
KEY_Q = DIK_Q,
KEY_R = DIK_R,
KEY_RBRACKET = DIK_RBRACKET,
KEY_RCONTROL = DIK_RCONTROL,
KEY_RETURN = DIK_RETURN,
KEY_RIGHT = DIK_RIGHT,
KEY_RMENU = DIK_RMENU,
KEY_RWIN = DIK_RWIN,
KEY_S = DIK_S,
KEY_SCROLL = DIK_SCROLL,
KEY_SEMICOLON = DIK_SEMICOLON,
KEY_SLASH = DIK_SLASH,
KEY_SLEEP = DIK_SLEEP,
KEY_SPACE = DIK_SPACE,
KEY_STOP = DIK_STOP,
KEY_SUBTRACT = DIK_SUBTRACT,
KEY_SYSRQ = DIK_SYSRQ,
KEY_T = DIK_T,
KEY_TAB = DIK_TAB,
KEY_U = DIK_U,
KEY_UNDERLINE = DIK_UNDERLINE,
KEY_UNLABELED = DIK_UNLABELED,
KEY_UP = DIK_UP,
KEY_V = DIK_V,
KEY_VOLUMEDOWN = DIK_VOLUMEDOWN,
KEY_VOLUMEUP = DIK_VOLUMEUP,
KEY_W = DIK_W,
KEY_WAKE = DIK_WAKE,
KEY_WEBBACK = DIK_WEBBACK,
KEY_WEBFAVORITES = DIK_WEBFAVORITES,
KEY_WEBFORWARD = DIK_WEBFORWARD,
KEY_WEBHOME = DIK_WEBHOME,
KEY_WEBREFRESH = DIK_WEBREFRESH,
KEY_WEBSEARCH = DIK_WEBSEARCH,
KEY_WEBSTOP = DIK_WEBSTOP,
KEY_X = DIK_X,
KEY_Y = DIK_Y,
KEY_YEN = DIK_YEN,
KEY_Z = DIK_Z,
*/
KEY_ESCAPE = GLFW_KEY_ESC,
KEY_ANYKEY = 4059
};
#endif
enum ButtonState { UP = 0, DOWN }; enum ButtonState { UP = 0, DOWN };
@ -800,13 +285,11 @@ public:
Vector rightStick; Vector rightStick;
bool inited, xinited; bool inited, xinited;
bool anyButton(); bool anyButton();
#ifdef BBGE_BUILD_SDL
# ifdef BBGE_BUILD_SDL2 # ifdef BBGE_BUILD_SDL2
SDL_GameController *sdl_controller; SDL_GameController *sdl_controller;
SDL_Haptic *sdl_haptic; SDL_Haptic *sdl_haptic;
# endif # endif
SDL_Joystick *sdl_joy; SDL_Joystick *sdl_joy;
#endif
#if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2) #if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2)
int eventfd; int eventfd;
int16_t effectid; int16_t effectid;
@ -1188,17 +671,6 @@ public:
void bindTexture(int stage, unsigned int handle); void bindTexture(int stage, unsigned int handle);
#ifdef BBGE_BUILD_DIRECTX
void blitD3DVerts(IDirect3DTexture9 *texture, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y, float v4x, float v4y);
void blitD3D (IDirect3DTexture9 *texture, int width, int height);
void blitD3DPreTrans (IDirect3DTexture9 *texture, float x, float y, int absWidth, int absHeight);
void blitD3DEx (IDirect3DTexture9 *texture, int width, int height, float u1=0, float v1=0, float u2=1, float v2=1);
void blitD3DGradient(D3DCOLOR ulc0, D3DCOLOR ulc1, D3DCOLOR ulc2, D3DCOLOR ulc3);
LPDIRECT3DDEVICE9 getD3DDevice();
LPD3DXSPRITE getD3DSprite();
LPD3DXMATRIXSTACK getD3DMatrixStack();
#endif
bool getKeyState(int k); bool getKeyState(int k);
bool getMouseButtonState(int m); bool getMouseButtonState(int m);
@ -1380,9 +852,7 @@ protected:
std::ofstream _logOut; std::ofstream _logOut;
#ifdef BBGE_BUILD_SDL
int nowTicks, thenTicks; int nowTicks, thenTicks;
#endif
int _vsync, _bpp; int _vsync, _bpp;
bool _fullscreen; bool _fullscreen;

View file

@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void Cube::onRender() void Cube::onRender()
{ {
#if 0 // not used at the moment, and incompatible with OpenGL ES. --ryan. #if 0 // not used at the moment, and incompatible with OpenGL ES. --ryan.
#ifdef BBGE_BUILD_OPENGL
glBegin(GL_QUADS); glBegin(GL_QUADS);
{ {
//auxSolidCube(1); //auxSolidCube(1);
@ -33,5 +32,4 @@ void Cube::onRender()
} }
glEnd(); glEnd();
#endif #endif
#endif
} }

View file

@ -40,10 +40,8 @@ void DarkLayer::unloadDevice()
frameBuffer.unloadDevice(); frameBuffer.unloadDevice();
else else
{ {
#ifdef BBGE_BUILD_OPENGL
if (texture) if (texture)
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);
#endif
} }
} }
@ -106,7 +104,6 @@ void DarkLayer::toggle(bool on)
void DarkLayer::preRender() void DarkLayer::preRender()
{ {
#ifdef BBGE_BUILD_OPENGL
bool verbose = core->coreVerboseDebug; bool verbose = core->coreVerboseDebug;
if (layer != -1) if (layer != -1)
{ {
@ -153,12 +150,10 @@ void DarkLayer::preRender()
*/ */
//glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, quality, quality, 0); //glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, quality, quality, 0);
} }
#endif
} }
void DarkLayer::render() void DarkLayer::render()
{ {
#ifdef BBGE_BUILD_OPENGL
if (renderLayer != -1) if (renderLayer != -1)
{ {
glPushMatrix(); glPushMatrix();
@ -226,5 +221,4 @@ void DarkLayer::render()
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
} }
#endif
} }

View file

@ -132,7 +132,6 @@ void DebugFont::onRender()
{ {
const float vspc = 1.5; const float vspc = 1.5;
#ifdef BBGE_BUILD_OPENGL
for (int i = 0; i < lines.size(); i++) for (int i = 0; i < lines.size(); i++)
{ {
//float width = (lines[i].size()-1) * fontDrawSize * 1.4f * 0.75f; //float width = (lines[i].size()-1) * fontDrawSize * 1.4f * 0.75f;
@ -152,7 +151,6 @@ void DebugFont::onRender()
glTranslatef(width*0.5f, 0, 0); glTranslatef(width*0.5f, 0, 0);
} }
} }
#endif
} }
void DebugFont::setAlign(Align align) void DebugFont::setAlign(Align align)

View file

@ -76,7 +76,6 @@ void PostProcessingFX::render()
{ {
if (enabled[i]) if (enabled[i])
{ {
#ifdef BBGE_BUILD_OPENGL
glPushMatrix(); glPushMatrix();
FXTypes type = (FXTypes)i; FXTypes type = (FXTypes)i;
switch(type) switch(type)
@ -153,7 +152,6 @@ void PostProcessingFX::render()
} }
glPopMatrix(); glPopMatrix();
#endif
} }
} }
} }

View file

@ -257,9 +257,7 @@ void Emitter::onRender()
if (!data.spawnLocal) if (!data.spawnLocal)
{ {
#ifdef BBGE_BUILD_OPENGL
glLoadIdentity(); glLoadIdentity();
#endif
/* /*
if (pe && pe->followCamera) if (pe && pe->followCamera)
{ {
@ -294,7 +292,6 @@ void Emitter::onRender()
const float dx = w2 * p->scale.x; const float dx = w2 * p->scale.x;
const float dy = h2 * p->scale.y; const float dy = h2 * p->scale.y;
#ifdef BBGE_BUILD_OPENGL
Vector col = p->color * colorMult; Vector col = p->color * colorMult;
glColor4f(col.x, col.y, col.z, p->alpha.x * alphaMult); glColor4f(col.x, col.y, col.z, p->alpha.x * alphaMult);
@ -355,13 +352,11 @@ void Emitter::onRender()
glVertex2f(x-dx, y-dy); glVertex2f(x-dx, y-dy);
glEnd(); glEnd();
} }
#endif
} }
} }
} }
else else
{ {
#ifdef BBGE_BUILD_OPENGL
glBegin(GL_QUADS); glBegin(GL_QUADS);
for (Particles::iterator i = particles.begin(); i != particles.end(); i++) for (Particles::iterator i = particles.begin(); i != particles.end(); i++)
{ {
@ -389,7 +384,6 @@ void Emitter::onRender()
} }
} }
glEnd(); glEnd();
#endif
} }

View file

@ -139,17 +139,11 @@ private:
bool stopped; // true if enqueued deletion bool stopped; // true if enqueued deletion
unsigned int samples_done; // Number of samples played and dequeued unsigned int samples_done; // Number of samples played and dequeued
#ifdef BBGE_BUILD_SDL
static SDL_Thread *decoderThread; static SDL_Thread *decoderThread;
static LockedQueue<OggDecoder*> decoderQ; static LockedQueue<OggDecoder*> decoderQ;
static volatile bool stop_thread; static volatile bool stop_thread;
static std::list<OggDecoder*> decoderList; // used by decoder thread only static std::list<OggDecoder*> decoderList; // used by decoder thread only
#else
#warning Threads not supported, music may cut out on area changes!
// ... because the stream runs out of decoded data while the area is
// still loading, so OpenAL aborts playback.
#endif
static void detachDecoder(OggDecoder *); static void detachDecoder(OggDecoder *);
}; };
@ -181,16 +175,13 @@ static const ov_callbacks ogg_memory_callbacks = {
OggDecoder::mem_tell OggDecoder::mem_tell
}; };
#ifdef BBGE_BUILD_SDL
SDL_Thread *OggDecoder::decoderThread = NULL; SDL_Thread *OggDecoder::decoderThread = NULL;
LockedQueue<OggDecoder*> OggDecoder::decoderQ; LockedQueue<OggDecoder*> OggDecoder::decoderQ;
volatile bool OggDecoder::stop_thread; volatile bool OggDecoder::stop_thread;
std::list<OggDecoder*> OggDecoder::decoderList; std::list<OggDecoder*> OggDecoder::decoderList;
#endif
void OggDecoder::startDecoderThread() void OggDecoder::startDecoderThread()
{ {
#ifdef BBGE_BUILD_SDL
stop_thread = false; stop_thread = false;
#ifdef BBGE_BUILD_SDL2 #ifdef BBGE_BUILD_SDL2
decoderThread = SDL_CreateThread((int (*)(void *))decode_loop, "OggDecoder", NULL); decoderThread = SDL_CreateThread((int (*)(void *))decode_loop, "OggDecoder", NULL);
@ -202,12 +193,10 @@ void OggDecoder::startDecoderThread()
debugLog("Failed to create Ogg Vorbis decode thread: " debugLog("Failed to create Ogg Vorbis decode thread: "
+ std::string(SDL_GetError())); + std::string(SDL_GetError()));
} }
#endif
} }
void OggDecoder::stopDecoderThread() void OggDecoder::stopDecoderThread()
{ {
#ifdef BBGE_BUILD_SDL
if (decoderThread) if (decoderThread)
{ {
stop_thread = true; stop_thread = true;
@ -215,27 +204,22 @@ void OggDecoder::stopDecoderThread()
SDL_WaitThread(decoderThread, NULL); SDL_WaitThread(decoderThread, NULL);
decoderThread = NULL; decoderThread = NULL;
} }
#endif
} }
void OggDecoder::detachDecoder(OggDecoder *ogg) void OggDecoder::detachDecoder(OggDecoder *ogg)
{ {
#ifdef BBGE_BUILD_SDL
if(decoderThread) if(decoderThread)
{ {
ogg->thread = true; ogg->thread = true;
decoderQ.push(ogg); decoderQ.push(ogg);
} }
#endif
} }
void OggDecoder::decode_loop(OggDecoder *this_) void OggDecoder::decode_loop(OggDecoder *this_)
{ {
while (!this_->stop_thread) while (!this_->stop_thread)
{ {
#ifdef BBGE_BUILD_SDL
SDL_Delay(10); SDL_Delay(10);
#endif
// Transfer decoder to this background thread // Transfer decoder to this background thread
OggDecoder *ogg; OggDecoder *ogg;
while(decoderQ.pop(ogg)) while(decoderQ.pop(ogg))

View file

@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//WARNING: FrameBuffer objects have to have reloadDevice/unloadDevice called manually! //WARNING: FrameBuffer objects have to have reloadDevice/unloadDevice called manually!
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
#if defined(BBGE_BUILD_OPENGL)
PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL; PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL;
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL; PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL; PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
@ -43,7 +42,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL; PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL;
PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL; PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
#endif #endif
#endif
FrameBuffer::FrameBuffer() FrameBuffer::FrameBuffer()
{ {
@ -123,7 +121,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen, GLint filter)
w=width; w=width;
h=height; h=height;
#ifdef BBGE_BUILD_OPENGL
char *ext = (char*)glGetString( GL_EXTENSIONS ); char *ext = (char*)glGetString( GL_EXTENSIONS );
std::ostringstream os; std::ostringstream os;
@ -137,7 +134,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen, GLint filter)
} }
else else
{ {
#if defined(BBGE_BUILD_SDL)
if (!glIsRenderbufferEXT) if (!glIsRenderbufferEXT)
{ {
glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)SDL_GL_GetProcAddress("glIsRenderbufferEXT"); glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)SDL_GL_GetProcAddress("glIsRenderbufferEXT");
@ -158,7 +154,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen, GLint filter)
glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameterivEXT"); glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameterivEXT");
glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)SDL_GL_GetProcAddress("glGenerateMipmapEXT"); glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)SDL_GL_GetProcAddress("glGenerateMipmapEXT");
} }
#endif
if( !glIsRenderbufferEXT || !glBindRenderbufferEXT || !glDeleteRenderbuffersEXT || if( !glIsRenderbufferEXT || !glBindRenderbufferEXT || !glDeleteRenderbuffersEXT ||
!glGenRenderbuffersEXT || !glRenderbufferStorageEXT || !glGetRenderbufferParameterivEXT || !glGenRenderbuffersEXT || !glRenderbufferStorageEXT || !glGetRenderbufferParameterivEXT ||
@ -219,7 +214,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen, GLint filter)
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
#endif
debugLog("Done"); debugLog("Done");
inited = true; inited = true;
enabled = true; enabled = true;
@ -237,7 +231,6 @@ void FrameBuffer::unloadDevice()
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
#ifdef BBGE_BUILD_OPENGL
if (glDeleteFramebuffersEXT == NULL) if (glDeleteFramebuffersEXT == NULL)
{ {
@ -274,13 +267,11 @@ void FrameBuffer::unloadDevice()
glDeleteRenderbuffersEXT(1, &g_depthRenderBuffer); glDeleteRenderbuffersEXT(1, &g_depthRenderBuffer);
g_depthRenderBuffer = 0; g_depthRenderBuffer = 0;
} }
#endif
#endif #endif
debugLog("done"); debugLog("done");
} }
#if defined(BBGE_BUILD_SDL)
void FrameBuffer::resetOpenGL() void FrameBuffer::resetOpenGL()
{ {
#if defined(BBGE_BUILD_FRAMEBUFFER) #if defined(BBGE_BUILD_FRAMEBUFFER)
@ -305,7 +296,6 @@ void FrameBuffer::resetOpenGL()
glGenerateMipmapEXT = NULL; glGenerateMipmapEXT = NULL;
#endif #endif
} }
#endif
void FrameBuffer::reloadDevice() void FrameBuffer::reloadDevice()
{ {
@ -317,7 +307,6 @@ void FrameBuffer::startCapture()
{ {
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
#ifdef BBGE_BUILD_OPENGL
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
//glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, g_depthRenderBuffer ); //glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, g_depthRenderBuffer );
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_dynamicTextureID, 0 ); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_dynamicTextureID, 0 );
@ -325,7 +314,6 @@ void FrameBuffer::startCapture()
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
#endif
#endif #endif
} }
@ -334,9 +322,7 @@ void FrameBuffer::endCapture()
{ {
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
#ifdef BBGE_BUILD_OPENGL
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
#endif
#endif #endif
} }
@ -345,9 +331,7 @@ void FrameBuffer::bindTexture()
{ {
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
#ifdef BBGE_BUILD_OPENGL
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID ); glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID );
#endif
#endif #endif
} }

View file

@ -44,9 +44,7 @@ public:
void unloadDevice(); void unloadDevice();
void reloadDevice(); void reloadDevice();
#if defined(BBGE_BUILD_SDL)
static void resetOpenGL(); static void resetOpenGL();
#endif
protected: protected:
int _w, _h; int _w, _h;

View file

@ -1635,9 +1635,6 @@ WINGDIAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei hei
# undef __DEFINED_GLAPI # undef __DEFINED_GLAPI
#endif #endif
#ifndef GL_GLEXT_LEGACY
#include <GL/glext.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -59,14 +59,6 @@ void Gradient::makeHorizontal(Vector c1, Vector c2)
void Gradient::onRender() void Gradient::onRender()
{ {
#ifdef BBGE_BUILD_DIRECTX
core->blitD3DGradient
( ulc0.getD3DColor(alpha.x),
ulc1.getD3DColor(alpha.x),
ulc2.getD3DColor(alpha.x),
ulc3.getD3DColor(alpha.x));
#endif
#ifdef BBGE_BUILD_OPENGL
//glNormal3f(0, 0, 1); //glNormal3f(0, 0, 1);
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -100,6 +92,5 @@ void Gradient::onRender()
glVertex3f(-0.5, 0.5, 0); glVertex3f(-0.5, 0.5, 0);
*/ */
glEnd(); glEnd();
#endif
} }

View file

@ -89,13 +89,11 @@ Joystick::Joystick()
{ {
xinited = false; xinited = false;
stickIndex = -1; stickIndex = -1;
#ifdef BBGE_BUILD_SDL
# ifdef BBGE_BUILD_SDL2 # ifdef BBGE_BUILD_SDL2
sdl_controller = NULL; sdl_controller = NULL;
sdl_haptic = NULL; sdl_haptic = NULL;
# endif # endif
sdl_joy = NULL; sdl_joy = NULL;
#endif
#if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2) #if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2)
eventfd = -1; eventfd = -1;
effectid = -1; effectid = -1;
@ -124,11 +122,8 @@ Joystick::Joystick()
void Joystick::init(int stick) void Joystick::init(int stick)
{ {
#if defined(BBGE_BUILD_SDL) || defined(__LINUX__)
std::ostringstream os; std::ostringstream os;
#endif
#ifdef BBGE_BUILD_SDL
stickIndex = stick; stickIndex = stick;
const int numJoy = SDL_NumJoysticks(); const int numJoy = SDL_NumJoysticks();
os << "Found [" << numJoy << "] joysticks"; os << "Found [" << numJoy << "] joysticks";
@ -184,7 +179,6 @@ void Joystick::init(int stick)
{ {
debugLog("Not enough Joystick(s) found"); debugLog("Not enough Joystick(s) found");
} }
#endif
#if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2) #if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2)
os.seekp(0); os.seekp(0);
@ -233,9 +227,6 @@ void Joystick::init(int stick)
debugLog("after catch"); debugLog("after catch");
#if !defined(BBGE_BUILD_SDL)
inited = xinited;
#endif
#endif #endif
} }
@ -250,7 +241,6 @@ void Joystick::shutdown()
eventfd = -1; eventfd = -1;
} }
#endif #endif
#ifdef BBGE_BUILD_SDL
#ifdef BBGE_BUILD_SDL2 #ifdef BBGE_BUILD_SDL2
if (sdl_haptic) if (sdl_haptic)
{ {
@ -269,7 +259,6 @@ void Joystick::shutdown()
SDL_JoystickClose(sdl_joy); SDL_JoystickClose(sdl_joy);
sdl_joy = 0; sdl_joy = 0;
} }
#endif
} }
void Joystick::rumble(float leftMotor, float rightMotor, float time) void Joystick::rumble(float leftMotor, float rightMotor, float time)
@ -389,7 +378,6 @@ void Joystick::callibrate(Vector &calvec, float deadZone)
void Joystick::update(float dt) void Joystick::update(float dt)
{ {
#ifdef BBGE_BUILD_SDL
if (core->joystickEnabled && inited && sdl_joy && stickIndex != -1) if (core->joystickEnabled && inited && sdl_joy && stickIndex != -1)
{ {
#ifdef BBGE_BUILD_SDL2 #ifdef BBGE_BUILD_SDL2
@ -499,7 +487,6 @@ void Joystick::update(float dt)
} }
#endif
if (clearRumbleTime >= 0) if (clearRumbleTime >= 0)
{ {
@ -533,24 +520,6 @@ void Joystick::update(float dt)
#if !defined(BBGE_BUILD_SDL)
buttons[0] = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_A?DOWN:UP;
buttons[1] = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_B?DOWN:UP;
buttons[2] = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_X?DOWN:UP;
buttons[3] = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_Y?DOWN:UP;
position = Vector(xinp.Gamepad.sThumbLX, xinp.Gamepad.sThumbLY)/32768.0f;
position.y = -rightStick.y;
rightStick = Vector(xinp.Gamepad.sThumbRX, xinp.Gamepad.sThumbRY)/32768.0f;
rightStick.y = -rightStick.y;
callibrate(position, deadZone1);
callibrate(rightStick, deadZone2);
#endif
btnStart = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_START; btnStart = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_START;
btnSelect = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_BACK; btnSelect = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_BACK;

View file

@ -31,7 +31,6 @@ Light::Light()
void Light::apply() void Light::apply()
{ {
#ifdef BBGE_BUILD_OPENGL
int t = GL_LIGHT0; int t = GL_LIGHT0;
switch (num) switch (num)
{ {
@ -57,7 +56,6 @@ void Light::apply()
{ {
glDisable(t); glDisable(t);
} }
#endif
} }
void Light::update (float dt) void Light::update (float dt)

View file

@ -28,7 +28,6 @@ LightCone::LightCone() : RenderObject()
void LightCone::onRender() void LightCone::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
RenderObject::onRender(); RenderObject::onRender();
glBegin(GL_QUADS); glBegin(GL_QUADS);
//glNormal3f( 0.0f, 0, 1.0f); //glNormal3f( 0.0f, 0, 1.0f);
@ -41,5 +40,4 @@ void LightCone::onRender()
glColor4f(color.x, color.y, color.z,0*alpha.x); glColor4f(color.x, color.y, color.z,0*alpha.x);
glVertex3f(-spread/2, length, 0); glVertex3f(-spread/2, length, 0);
glEnd(); glEnd();
#endif
} }

View file

@ -1,37 +1,28 @@
#include "MT.h" #include "MT.h"
#include "Base.h" #include "Base.h"
#ifdef BBGE_BUILD_SDL
// --------- Lockable ---------- // --------- Lockable ----------
Lockable::Lockable() Lockable::Lockable()
: _mtx(NULL) : _mtx(NULL)
{ {
#ifdef BBGE_BUILD_SDL
_mtx = SDL_CreateMutex(); _mtx = SDL_CreateMutex();
#endif
} }
Lockable::~Lockable() Lockable::~Lockable()
{ {
#ifdef BBGE_BUILD_SDL
SDL_DestroyMutex((SDL_mutex*)_mtx); SDL_DestroyMutex((SDL_mutex*)_mtx);
#endif
} }
void Lockable::lock() void Lockable::lock()
{ {
#ifdef BBGE_BUILD_SDL
SDL_LockMutex((SDL_mutex*)_mtx); SDL_LockMutex((SDL_mutex*)_mtx);
#endif
} }
void Lockable::unlock() void Lockable::unlock()
{ {
#ifdef BBGE_BUILD_SDL
SDL_UnlockMutex((SDL_mutex*)_mtx); SDL_UnlockMutex((SDL_mutex*)_mtx);
#endif
} }
// --------- Waitable ---------- // --------- Waitable ----------
@ -39,37 +30,26 @@ void Lockable::unlock()
Waitable::Waitable() Waitable::Waitable()
: _cond(NULL) : _cond(NULL)
{ {
#ifdef BBGE_BUILD_SDL
_cond = SDL_CreateCond(); _cond = SDL_CreateCond();
#endif
} }
Waitable::~Waitable() Waitable::~Waitable()
{ {
#ifdef BBGE_BUILD_SDL
SDL_DestroyCond((SDL_cond*)_cond); SDL_DestroyCond((SDL_cond*)_cond);
#endif
} }
void Waitable::wait() void Waitable::wait()
{ {
#ifdef BBGE_BUILD_SDL
SDL_CondWait((SDL_cond*)_cond, (SDL_mutex*)mutex()); SDL_CondWait((SDL_cond*)_cond, (SDL_mutex*)mutex());
#endif
} }
void Waitable::signal() void Waitable::signal()
{ {
#ifdef BBGE_BUILD_SDL
SDL_CondSignal((SDL_cond*)_cond); SDL_CondSignal((SDL_cond*)_cond);
#endif
} }
void Waitable::broadcast() void Waitable::broadcast()
{ {
#ifdef BBGE_BUILD_SDL
SDL_CondBroadcast((SDL_cond*)_cond); SDL_CondBroadcast((SDL_cond*)_cond);
#endif
} }
#endif // BBGE_BUILD_SDL

View file

@ -44,10 +44,8 @@ void PointSprites::init()
glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)glfwGetProcAddress("glPointParameterfvARB"); glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)glfwGetProcAddress("glPointParameterfvARB");
#endif #endif
#ifdef BBGE_BUILD_SDL
glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)SDL_GL_GetProcAddress("glPointParameterfARB"); glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)SDL_GL_GetProcAddress("glPointParameterfARB");
glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)SDL_GL_GetProcAddress("glPointParameterfvARB"); glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)SDL_GL_GetProcAddress("glPointParameterfvARB");
#endif
if( !glPointParameterfARB || !glPointParameterfvARB ) if( !glPointParameterfARB || !glPointParameterfvARB )
{ {

View file

@ -347,7 +347,6 @@ void Quad::renderGrid()
if (xDivs < 2 || yDivs < 2) if (xDivs < 2 || yDivs < 2)
return; return;
#ifdef BBGE_BUILD_OPENGL
const float percentX = fabsf(this->lowerRightTextureCoordinates.x - this->upperLeftTextureCoordinates.x); const float percentX = fabsf(this->lowerRightTextureCoordinates.x - this->upperLeftTextureCoordinates.x);
const float percentY = fabsf(this->upperLeftTextureCoordinates.y - this->lowerRightTextureCoordinates.y); const float percentY = fabsf(this->upperLeftTextureCoordinates.y - this->lowerRightTextureCoordinates.y);
@ -438,7 +437,6 @@ void Quad::renderGrid()
if (texture) if (texture)
glBindTexture(GL_TEXTURE_2D, texture->textures[0]); glBindTexture(GL_TEXTURE_2D, texture->textures[0]);
} }
#endif
} }
void Quad::repeatTextureToFill(bool on) void Quad::repeatTextureToFill(bool on)
@ -453,7 +451,6 @@ void Quad::onRender()
{ {
if (!renderQuad) return; if (!renderQuad) return;
#ifdef BBGE_BUILD_OPENGL
float _w2 = width/2.0f; float _w2 = width/2.0f;
float _h2 = height/2.0f; float _h2 = height/2.0f;
@ -547,123 +544,6 @@ void Quad::onRender()
RenderObject::lastTextureApplied = 0; RenderObject::lastTextureApplied = 0;
} }
#endif
#ifdef BBGE_BUILD_DIRECTX
//core->setColor(color.x, color.y, color.z, alpha.x);
//if (!children.empty() || useDXTransform)
if (true)
{
if (this->texture)
{
if (upperLeftTextureCoordinates.x != 0 || upperLeftTextureCoordinates.y != 0
|| lowerRightTextureCoordinates.x != 1 || lowerRightTextureCoordinates.y != 1)
{
//core->blitD3DEx(this->texture->d3dTexture, fontDrawSize/2, fontDrawSize/2, u, v-ybit, u+xbit, v+ybit-ybit);
core->blitD3DEx(this->texture->d3dTexture, width, height, upperLeftTextureCoordinates.x, upperLeftTextureCoordinates.y, lowerRightTextureCoordinates.x, lowerRightTextureCoordinates.y);
}
else
core->blitD3D(this->texture->d3dTexture, width, height);
}
else
{
core->blitD3D(0, width, height);
}
}
else
{
if (this->texture)
core->blitD3DPreTrans(this->texture->d3dTexture, position.x+offset.x, position.y+offset.y, width*scale.x, width.y*scale.y);
else
core->blitD3DPreTrans(0, position.x+offset.x, position.y+offset.y, width*scale.x, width.y*scale.y);
}
/*
if (this->texture)
{
core->getD3DSprite()->Begin(D3DXSPRITE_ALPHABLEND);
D3DXVECTOR2 scaling((1.0f/float(this->texture->width))*width*scale.x,
(1.0f/float(this->texture->height))*height*scale.y);
if (isfh())
scaling.x = -scaling.x;
D3DXVECTOR2 spriteCentre=D3DXVECTOR2((this->texture->width/2), (this->texture->height/2));
///scale.x
//D3DXVECTOR2 trans=D3DXVECTOR2(position.x, position.y);
if (blendType == BLEND_DEFAULT)
{
core->getD3DDevice()->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
core->getD3DDevice()->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
}
else
{
core->getD3DDevice()->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
core->getD3DDevice()->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
}
D3DXVECTOR2 rotationCentre = spriteCentre;
D3DXVECTOR2 trans=D3DXVECTOR2(position.x,position.y) - spriteCentre;
if (followCamera != 1)
{
trans.x -= core->cameraPos.x;
trans.y -= core->cameraPos.y;
}
D3DXMATRIX mat, scale, final;
//D3DXVECTOR2 centre = trans + spriteCentre;
float rotation = (this->rotation.z*PI)/180.0f;
//D3DXVECTOR2 scaling((1.0f/float(this->texture->width))*width*scale.x,(1.0f/float(this->texture->height))*height*scale.y);
//D3DXVECTOR2 scaling(1,1);
const D3DCOLOR d3dColor=D3DCOLOR_ARGB(int(alpha.x*255), int(color.x*255), int(color.y*255), int(color.z*255));
//const D3DCOLOR d3dColor=D3DCOLOR_ARGB(int(alpha.x*255), int(color.x*255), int(color.y*255), int(color.z*255));
FLOAT scalingRotation = 0;
//D3DXMatrixTransformation2D(&mat,NULL,0.0,&scaling,&spriteCentre,rotation,&trans);
D3DXMatrixTransformation2D(&mat,
&spriteCentre,
scalingRotation,
&scaling,
&spriteCentre,
rotation,
&trans
);
if (followCamera != 1)
{
D3DXMatrixScaling(&scale,core->globalScale.x*core->globalResolutionScale.x,core->globalScale.y*core->globalResolutionScale.y,1);
D3DXMatrixMultiply(&final, &mat, &scale);
core->getD3DSprite()->SetTransform(&final);
}
else
{
D3DXMatrixScaling(&scale,core->globalResolutionScale.x,core->globalResolutionScale.y,1);
D3DXMatrixMultiply(&final, &mat, &scale);
core->getD3DSprite()->SetTransform(&final);
}
//mat = scale * mat;
if (this->texture)
{
core->getD3DSprite()->Draw(this->texture->d3dTexture,NULL,NULL,NULL,d3dColor);//0xFFFFFFFF);//d3dColor);
core->getD3DSprite()->End();
}
else
{
core->getD3DSprite()->End();
D3DRECT rect;
rect.x1 = trans.x - this->width/2;
rect.x2 = trans.x + this->width/2;
rect.y1 = trans.y - this->height/2;
rect.y2 = trans.y + this->height/2;
core->getD3DDevice()->Clear(1,&rect,D3DCLEAR_TARGET,d3dColor,0,0);
}
//core->getD3DSprite()->End();
}
*/
#endif
} }

View file

@ -58,7 +58,6 @@ void QuadTrail::onRender()
{ {
if (numPoints < 2) return; if (numPoints < 2) return;
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE); //glDisable(GL_CULL_FACE);
int c = 0; int c = 0;
Vector p, diff, dl, dr; Vector p, diff, dl, dr;
@ -114,7 +113,6 @@ void QuadTrail::onRender()
glVertex2f((*i).point.x, (*i).point.y); glVertex2f((*i).point.x, (*i).point.y);
} }
glEnd(); glEnd();
#endif
} }
void QuadTrail::onUpdate(float dt) void QuadTrail::onUpdate(float dt)

View file

@ -59,7 +59,6 @@ int RenderObject::getTopLayer()
void RenderObject::applyBlendType() void RenderObject::applyBlendType()
{ {
#ifdef BBGE_BUILD_OPENGL
if (blendEnabled) if (blendEnabled)
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);
@ -84,42 +83,6 @@ void RenderObject::applyBlendType()
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
} }
#endif
#ifdef BBGE_BUILD_DIRECTX
if (blendEnabled)
{
core->getD3DDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
switch (blendType)
{
case BLEND_DEFAULT:
core->getD3DDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
core->getD3DDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;
case BLEND_ADD:
core->getD3DDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
core->getD3DDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
//glBlendFunc(GL_SRC_ALPHA,GL_ONE);
break;
case BLEND_SUB:
core->getD3DDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
core->getD3DDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCALPHA);
//glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
break;
}
core->getD3DDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
core->getD3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
}
else
{
core->getD3DDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
/*
glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
*/
}
#endif
} }
void RenderObject::setColorMult(const Vector &color, const float alpha) void RenderObject::setColorMult(const Vector &color, const float alpha)
@ -179,9 +142,6 @@ RenderObject::RenderObject()
motionBlurFrameOffset = 0; motionBlurFrameOffset = 0;
motionBlur = false; motionBlur = false;
idx = -1; idx = -1;
#ifdef BBGE_BUILD_DIRECTX
useDXTransform = false;
#endif
_fv = false; _fv = false;
_fh = false; _fh = false;
updateCull = -1; updateCull = -1;
@ -255,7 +215,6 @@ bool RenderObject::isPieceFlippedHorizontal()
Vector RenderObject::getInvRotPosition(const Vector &vec) Vector RenderObject::getInvRotPosition(const Vector &vec)
{ {
#ifdef BBGE_BUILD_OPENGL
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
@ -292,9 +251,6 @@ Vector RenderObject::getInvRotPosition(const Vector &vec)
glPopMatrix(); glPopMatrix();
return Vector(x,y,z); return Vector(x,y,z);
#elif BBGE_BUILD_DIRECTX
return vec;
#endif
} }
#ifdef BBGE_USE_GLM #ifdef BBGE_USE_GLM
@ -327,7 +283,6 @@ static void matrixChain(RenderObject *ro)
if (RenderObject *parent = ro->getParent()) if (RenderObject *parent = ro->getParent())
matrixChain(parent); matrixChain(parent);
#ifdef BBGE_BUILD_OPENGL
glTranslatef(ro->position.x+ro->offset.x, ro->position.y+ro->offset.y, 0); glTranslatef(ro->position.x+ro->offset.x, ro->position.y+ro->offset.y, 0);
glRotatef(ro->rotation.z+ro->rotationOffset.z, 0, 0, 1); glRotatef(ro->rotation.z+ro->rotationOffset.z, 0, 0, 1);
glTranslatef(ro->beforeScaleOffset.x, ro->beforeScaleOffset.y, 0); glTranslatef(ro->beforeScaleOffset.x, ro->beforeScaleOffset.y, 0);
@ -338,7 +293,6 @@ static void matrixChain(RenderObject *ro)
glRotatef(180, 0, 1, 0); glRotatef(180, 0, 1, 0);
} }
glTranslatef(ro->internalOffset.x, ro->internalOffset.y, 0); glTranslatef(ro->internalOffset.x, ro->internalOffset.y, 0);
#endif
} }
#endif #endif
@ -369,7 +323,6 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec)
return Vector(transformMatrix[3][0], transformMatrix[3][1], 0); return Vector(transformMatrix[3][0], transformMatrix[3][1], 0);
#else #else
#ifdef BBGE_BUILD_OPENGL
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
@ -383,9 +336,6 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec)
glPopMatrix(); glPopMatrix();
return Vector(x,y,0); return Vector(x,y,0);
#elif BBGE_BUILD_DIRECTX
return vec;
#endif
#endif #endif
} }
@ -656,19 +606,13 @@ void RenderObject::renderCall()
position += offset; position += offset;
#ifdef BBGE_BUILD_DIRECTX
if (!RENDEROBJECT_FASTTRANSFORM)
core->getD3DMatrixStack()->Push();
#endif
#ifdef BBGE_BUILD_OPENGL
if (!RENDEROBJECT_FASTTRANSFORM) if (!RENDEROBJECT_FASTTRANSFORM)
glPushMatrix(); glPushMatrix();
if (!RENDEROBJECT_SHAREATTRIBUTES) if (!RENDEROBJECT_SHAREATTRIBUTES)
{ {
glPushAttrib(GL_ALL_ATTRIB_BITS); glPushAttrib(GL_ALL_ATTRIB_BITS);
} }
#endif
if (!RENDEROBJECT_FASTTRANSFORM) if (!RENDEROBJECT_FASTTRANSFORM)
@ -685,7 +629,6 @@ void RenderObject::renderCall()
{ {
if (followCamera == 1) if (followCamera == 1)
{ {
#ifdef BBGE_BUILD_OPENGL
glLoadIdentity(); glLoadIdentity();
glScalef(core->globalResolutionScale.x, core->globalResolutionScale.y,0); glScalef(core->globalResolutionScale.x, core->globalResolutionScale.y,0);
glTranslatef(position.x, position.y, position.z); glTranslatef(position.x, position.y, position.z);
@ -696,24 +639,11 @@ void RenderObject::renderCall()
} }
glRotatef(rotation.z+rotationOffset.z, 0, 0, 1); glRotatef(rotation.z+rotationOffset.z, 0, 0, 1);
#endif
#ifdef BBGE_BUILD_DIRECTX
core->getD3DMatrixStack()->LoadIdentity();
core->scaleMatrixStack(core->globalResolutionScale.x, core->globalResolutionScale.y,0);
core->translateMatrixStack(position.x, position.y, 0);
if (isfh())
{
//HACK: disable cull ->
core->getD3DMatrixStack()->RotateAxisLocal(&D3DXVECTOR3(0, 1, 0), D3DXToRadian(180));
}
core->rotateMatrixStack(rotation.z + rotationOffset.z);
#endif
} }
else else
{ {
Vector pos = getFollowCameraPosition(); Vector pos = getFollowCameraPosition();
#ifdef BBGE_BUILD_OPENGL
glTranslatef(pos.x, pos.y, pos.z); glTranslatef(pos.x, pos.y, pos.z);
if (isfh()) if (isfh())
{ {
@ -721,29 +651,13 @@ void RenderObject::renderCall()
glRotatef(180, 0, 1, 0); glRotatef(180, 0, 1, 0);
} }
glRotatef(rotation.z+rotationOffset.z, 0, 0, 1); glRotatef(rotation.z+rotationOffset.z, 0, 0, 1);
#endif
#ifdef BBGE_BUILD_DIRECTX
core->translateMatrixStack(pos.x, pos.y, 0);
if (isfh())
{
//HACK: disable cull ->
core->getD3DMatrixStack()->RotateAxisLocal(&D3DXVECTOR3(0, 1, 0), D3DXToRadian(180));
}
core->rotateMatrixStack(rotation.z + rotationOffset.z);
#endif
} }
} }
else else
{ {
#ifdef BBGE_BUILD_OPENGL
glTranslatef(position.x, position.y, position.z); glTranslatef(position.x, position.y, position.z);
#endif
#ifdef BBGE_BUILD_DIRECTX
core->translateMatrixStack(position.x, position.y, 0);
#endif
#ifdef BBGE_BUILD_OPENGL
if (RenderObject::renderPaths && position.data && position.data->path.getNumPathNodes() > 0) if (RenderObject::renderPaths && position.data && position.data->path.getNumPathNodes() > 0)
{ {
glLineWidth(4); glLineWidth(4);
@ -770,8 +684,6 @@ void RenderObject::renderCall()
} }
glEnd(); glEnd();
} }
#endif
#ifdef BBGE_BUILD_OPENGL
glRotatef(rotation.z+rotationOffset.z, 0, 0, 1); glRotatef(rotation.z+rotationOffset.z, 0, 0, 1);
if (isfh()) if (isfh())
@ -779,34 +691,11 @@ void RenderObject::renderCall()
//glDisable(GL_CULL_FACE); //glDisable(GL_CULL_FACE);
glRotatef(180, 0, 1, 0); glRotatef(180, 0, 1, 0);
} }
#endif
#ifdef BBGE_BUILD_DIRECTX
//core->getD3DMatrixStack()->RotateAxisLocal(&D3DXVECTOR3(0, 0, 1), rotation.z+rotationOffset.z);
core->rotateMatrixStack(rotation.z + rotationOffset.z);
if (isfh())
{
//HACK: disable cull
core->getD3DDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
//core->getD3DMatrixStack()->Scale(-1, 1, 1);
//core->applyMatrixStackToWorld();
core->getD3DMatrixStack()->RotateAxisLocal(&D3DXVECTOR3(0, 1, 0), D3DXToRadian(180));
//core->applyMatrixStackToWorld();
}
#endif
} }
#ifdef BBGE_BUILD_OPENGL
glTranslatef(beforeScaleOffset.x, beforeScaleOffset.y, beforeScaleOffset.z); glTranslatef(beforeScaleOffset.x, beforeScaleOffset.y, beforeScaleOffset.z);
glScalef(scale.x, scale.y, 1); glScalef(scale.x, scale.y, 1);
glTranslatef(internalOffset.x, internalOffset.y, internalOffset.z); glTranslatef(internalOffset.x, internalOffset.y, internalOffset.z);
#endif
#ifdef BBGE_BUILD_DIRECTX
core->translateMatrixStack(beforeScaleOffset.x, beforeScaleOffset.y, 0);
core->scaleMatrixStack(scale.x, scale.y, 1);
core->translateMatrixStack(internalOffset.x, internalOffset.y, 0);
core->applyMatrixStackToWorld();
#endif
//glDisable(GL_CULL_FACE); //glDisable(GL_CULL_FACE);
@ -844,41 +733,27 @@ void RenderObject::renderCall()
//if (useColor) //if (useColor)
{ {
#ifdef BBGE_BUILD_OPENGL
if (rlayer) if (rlayer)
glColor4f(color.x * rlayer->color.x, color.y * rlayer->color.y, color.z * rlayer->color.z, alpha.x*alphaMod); glColor4f(color.x * rlayer->color.x, color.y * rlayer->color.y, color.z * rlayer->color.z, alpha.x*alphaMod);
else else
glColor4f(color.x, color.y, color.z, alpha.x*alphaMod); glColor4f(color.x, color.y, color.z, alpha.x*alphaMod);
#elif defined(BBGE_BUILD_DIRECTX)
core->setColor(color.x, color.y, color.z, alpha.x*alphaMod);
#endif
} }
if (texture) if (texture)
{ {
#ifdef BBGE_BUILD_OPENGL
if (texture->textures[0] != lastTextureApplied || repeatTexture != lastTextureRepeat) if (texture->textures[0] != lastTextureApplied || repeatTexture != lastTextureRepeat)
{ {
texture->apply(repeatTexture); texture->apply(repeatTexture);
lastTextureRepeat = repeatTexture; lastTextureRepeat = repeatTexture;
lastTextureApplied = texture->textures[0]; lastTextureApplied = texture->textures[0];
} }
#endif
#ifdef BBGE_BUILD_DIRECTX
texture->apply(repeatTexture);
#endif
} }
else else
{ {
if (lastTextureApplied != 0 || repeatTexture != lastTextureRepeat) if (lastTextureApplied != 0 || repeatTexture != lastTextureRepeat)
{ {
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
#endif
#ifdef BBGE_BUILD_DIRECTX
core->bindTexture(0, 0);
#endif
lastTextureApplied = 0; lastTextureApplied = 0;
lastTextureRepeat = repeatTexture; lastTextureRepeat = repeatTexture;
} }
@ -922,13 +797,7 @@ void RenderObject::renderCall()
if (!RENDEROBJECT_FASTTRANSFORM) if (!RENDEROBJECT_FASTTRANSFORM)
{ {
#ifdef BBGE_BUILD_OPENGL
glPopMatrix(); glPopMatrix();
#endif
#ifdef BBGE_BUILD_DIRECTX
core->getD3DMatrixStack()->Pop();
core->applyMatrixStackToWorld();
#endif
} }
@ -939,7 +808,6 @@ void RenderObject::renderCollision()
{ {
if (!collisionRects.empty()) if (!collisionRects.empty())
{ {
#ifdef BBGE_BUILD_OPENGL
glPushAttrib(GL_ALL_ATTRIB_BITS); glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix(); glPushMatrix();
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
@ -974,12 +842,10 @@ void RenderObject::renderCollision()
glDisable(GL_BLEND); glDisable(GL_BLEND);
glPopAttrib(); glPopAttrib();
#endif
} }
if (!collisionMask.empty()) if (!collisionMask.empty())
{ {
#ifdef BBGE_BUILD_OPENGL
glPushAttrib(GL_ALL_ATTRIB_BITS); glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix(); glPushMatrix();
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
@ -1023,7 +889,6 @@ void RenderObject::renderCollision()
glPopAttrib(); glPopAttrib();
//glTranslatef(offset.x, offset.y,0); //glTranslatef(offset.x, offset.y,0);
#endif
} }
else if (collideRadius > 0) else if (collideRadius > 0)
{ {

View file

@ -277,10 +277,6 @@ public:
//Flags flags; //Flags flags;
#ifdef BBGE_BUILD_DIRECTX
bool useDXTransform;
//D3DXMATRIX matrix;
#endif
float collideRadius; float collideRadius;
Vector collidePosition; Vector collidePosition;

View file

@ -364,9 +364,7 @@ void RenderObjectLayer::renderPass(int pass)
{ {
if (displayList[i].isList) if (displayList[i].isList)
{ {
#ifdef BBGE_BUILD_OPENGL
glCallList(displayList[i].u.listID); glCallList(displayList[i].u.listID);
#endif
RenderObject::lastTextureApplied = 0; RenderObject::lastTextureApplied = 0;
} }
else else
@ -430,7 +428,6 @@ void RenderObjectLayer::generateDisplayList()
} }
else else
{ {
#ifdef BBGE_BUILD_OPENGL
int listID = glGenLists(1); int listID = glGenLists(1);
if (listID != 0) if (listID != 0)
{ {
@ -450,16 +447,13 @@ void RenderObjectLayer::generateDisplayList()
} }
else else
debugLog("glGenLists failed"); debugLog("glGenLists failed");
#endif
} }
} }
else else
{ {
if (lastWasStatic) if (lastWasStatic)
{ {
#ifdef BBGE_BUILD_OPENGL
glEndList(); glEndList();
#endif
lastWasStatic = false; lastWasStatic = false;
} }
} }
@ -477,9 +471,7 @@ void RenderObjectLayer::generateDisplayList()
if (lastWasStatic) if (lastWasStatic)
{ {
#ifdef BBGE_BUILD_OPENGL
glEndList(); glEndList();
#endif
} }
displayList.resize(listLength); displayList.resize(listLength);

View file

@ -42,7 +42,6 @@ void OutlineRect::setLineSize(int ls)
void OutlineRect::onRender() void OutlineRect::onRender()
{ {
#ifdef BBGE_BUILD_OPENGL
glLineWidth(lineSize); glLineWidth(lineSize);
glBegin(GL_LINES); glBegin(GL_LINES);
// l // l
@ -71,7 +70,6 @@ void OutlineRect::onRender()
glVertex2f(0,h2); glVertex2f(0,h2);
glEnd(); glEnd();
} }
#endif
} }

View file

@ -52,7 +52,6 @@ void ScreenTransition::createTexture()
} }
*/ */
#ifdef BBGE_BUILD_OPENGL
//create our texture //create our texture
glGenTextures(1,&screen_texture); glGenTextures(1,&screen_texture);
glBindTexture(GL_TEXTURE_2D, screen_texture); glBindTexture(GL_TEXTURE_2D, screen_texture);
@ -63,7 +62,6 @@ void ScreenTransition::createTexture()
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); //GL_NEAREST); //GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); //GL_NEAREST); //GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,3, textureWidth, textureHeight, 0 , GL_RGB, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D,0,3, textureWidth, textureHeight, 0 , GL_RGB, GL_UNSIGNED_BYTE, NULL);
glBindTexture(GL_TEXTURE_2D,0); glBindTexture(GL_TEXTURE_2D,0);
#endif
/* /*
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@ -73,13 +71,11 @@ void ScreenTransition::createTexture()
void ScreenTransition::destroyTexture() void ScreenTransition::destroyTexture()
{ {
#ifdef BBGE_BUILD_OPENGL
if (screen_texture) if (screen_texture)
{ {
glDeleteTextures(1, &screen_texture); glDeleteTextures(1, &screen_texture);
screen_texture = 0; screen_texture = 0;
} }
#endif
} }
void ScreenTransition::unloadDevice() void ScreenTransition::unloadDevice()
@ -104,14 +100,12 @@ void ScreenTransition::capture()
errorLog(os.str()); errorLog(os.str());
*/ */
#ifdef BBGE_BUILD_OPENGL
if (screen_texture) if (screen_texture)
{ {
glBindTexture(GL_TEXTURE_2D,screen_texture); glBindTexture(GL_TEXTURE_2D,screen_texture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, windowWidth, windowHeight); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, windowWidth, windowHeight);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
} }
#endif
core->showBuffer(); core->showBuffer();
} }
@ -138,7 +132,6 @@ void ScreenTransition::onRender()
{ {
if (alpha.x == 0) return; if (alpha.x == 0) return;
#ifdef BBGE_BUILD_OPENGL
float width2 = float(width)/2; float width2 = float(width)/2;
float height2 = float(height)/2; float height2 = float(height)/2;
@ -185,6 +178,5 @@ void ScreenTransition::onRender()
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
RenderObject::lastTextureApplied = 0; RenderObject::lastTextureApplied = 0;
#endif
} }

View file

@ -42,9 +42,7 @@ protected:
float width, height; float width, height;
//void onUpdate(float dt); //void onUpdate(float dt);
#ifdef BBGE_BUILD_OPENGL
GLuint screen_texture; GLuint screen_texture;
#endif
}; };
#endif #endif

View file

@ -80,7 +80,6 @@ void Shader::staticInit()
} }
else else
{ {
#ifdef BBGE_BUILD_SDL
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glCreateProgramObjectARB"); glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glCreateProgramObjectARB");
glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)SDL_GL_GetProcAddress("glDeleteObjectARB"); glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)SDL_GL_GetProcAddress("glDeleteObjectARB");
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glUseProgramObjectARB"); glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glUseProgramObjectARB");
@ -101,7 +100,6 @@ void Shader::staticInit()
glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)SDL_GL_GetProcAddress("glUniform2ivARB"); glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)SDL_GL_GetProcAddress("glUniform2ivARB");
glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)SDL_GL_GetProcAddress("glUniform3ivARB"); glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)SDL_GL_GetProcAddress("glUniform3ivARB");
glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)SDL_GL_GetProcAddress("glUniform4ivARB"); glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)SDL_GL_GetProcAddress("glUniform4ivARB");
#endif
if( !glCreateProgramObjectARB || !glDeleteObjectARB || !glUseProgramObjectARB || if( !glCreateProgramObjectARB || !glDeleteObjectARB || !glUseProgramObjectARB ||
!glCreateShaderObjectARB || !glCreateShaderObjectARB || !glCompileShaderARB || !glCreateShaderObjectARB || !glCreateShaderObjectARB || !glCompileShaderARB ||
@ -134,9 +132,7 @@ Shader::Shader()
numUniforms = -1; numUniforms = -1;
uniformsDirty = false; uniformsDirty = false;
#ifdef BBGE_BUILD_OPENGL
g_programObj = 0; g_programObj = 0;
#endif
} }
Shader::~Shader() Shader::~Shader()

View file

@ -45,10 +45,8 @@ public:
protected: protected:
std::string vertFile, fragFile; std::string vertFile, fragFile;
std::string vertSrc, fragSrc; std::string vertSrc, fragSrc;
#ifdef BBGE_BUILD_OPENGL
GLuint g_programObj; GLuint g_programObj;
int numUniforms; int numUniforms;
#endif
private: private:
static void staticInit(); static void staticInit();

View file

@ -41,11 +41,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "..\j2k-codec\j2k-codec.h" #include "..\j2k-codec\j2k-codec.h"
#endif #endif
#ifdef BBGE_BUILD_OPENGL
GLint Texture::filter = GL_LINEAR; GLint Texture::filter = GL_LINEAR;
GLint Texture::format = 0; GLint Texture::format = 0;
#endif
bool Texture::useMipMaps = true; bool Texture::useMipMaps = true;
/* /*
@ -57,12 +55,7 @@ bool Texture::useMipMaps = true;
Texture::Texture() Texture::Texture()
{ {
#ifdef BBGE_BUILD_OPENGL
textures[0] = 0; textures[0] = 0;
#endif
#ifdef BBGE_BUILD_DIRECTX
d3dTexture = 0;
#endif
width = height = 0; width = height = 0;
repeat = false; repeat = false;
@ -79,7 +72,6 @@ Texture::~Texture()
void Texture::read(int tx, int ty, int w, int h, unsigned char *pixels) void Texture::read(int tx, int ty, int w, int h, unsigned char *pixels)
{ {
#ifdef BBGE_BUILD_OPENGL
if (tx == 0 && ty == 0 && w == this->width && h == this->height) if (tx == 0 && ty == 0 && w == this->width && h == this->height)
{ {
glBindTexture(GL_TEXTURE_2D, textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]);
@ -94,12 +86,10 @@ void Texture::read(int tx, int ty, int w, int h, unsigned char *pixels)
<< tx << "," << ty << "+" << w << "x" << h << ")"; << tx << "," << ty << "+" << w << "x" << h << ")";
debugLog(os.str()); debugLog(os.str());
} }
#endif
} }
void Texture::write(int tx, int ty, int w, int h, const unsigned char *pixels) void Texture::write(int tx, int ty, int w, int h, const unsigned char *pixels)
{ {
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]);
glTexSubImage2D(GL_TEXTURE_2D, 0, glTexSubImage2D(GL_TEXTURE_2D, 0,
@ -145,12 +135,10 @@ void Texture::write(int tx, int ty, int w, int h, const unsigned char *pixels)
pixels Specifies a pointer to the image data in memory. pixels Specifies a pointer to the image data in memory.
*/ */
#endif
} }
void Texture::unload() void Texture::unload()
{ {
#ifdef BBGE_BUILD_OPENGL
if (textures[0]) if (textures[0])
{ {
ow = width; ow = width;
@ -165,28 +153,17 @@ void Texture::unload()
glDeleteTextures(1, &textures[0]); glDeleteTextures(1, &textures[0]);
textures[0] = 0; textures[0] = 0;
} }
#endif
} }
void Texture::destroy() void Texture::destroy()
{ {
#ifdef BBGE_BUILD_OPENGL
unload(); unload();
#endif
#ifdef BBGE_BUILD_DIRECTX
if (d3dTexture)
{
d3dTexture->Release();
d3dTexture = 0;
}
#endif
core->removeTexture(this); core->removeTexture(this);
} }
int Texture::getPixelWidth() int Texture::getPixelWidth()
{ {
#ifdef BBGE_BUILD_OPENGL
int w = 0, h = 0; int w = 0, h = 0;
unsigned int size = 0; unsigned int size = 0;
unsigned char *data = getBufferAndSize(&w, &h, &size); unsigned char *data = getBufferAndSize(&w, &h, &size);
@ -210,14 +187,10 @@ int Texture::getPixelWidth()
} }
free(data); free(data);
return largestx - smallestx; return largestx - smallestx;
#elif defined(BBGE_BUILD_DIRECTX)
return 0;
#endif
} }
int Texture::getPixelHeight() int Texture::getPixelHeight()
{ {
#ifdef BBGE_BUILD_OPENGL
int w = 0, h = 0; int w = 0, h = 0;
unsigned int size = 0; unsigned int size = 0;
unsigned char *data = getBufferAndSize(&w, &h, &size); unsigned char *data = getBufferAndSize(&w, &h, &size);
@ -241,9 +214,6 @@ int Texture::getPixelHeight()
} }
free(data); free(data);
return largesty - smallesty; return largesty - smallesty;
#elif defined(BBGE_BUILD_DIRECTX)
return 0;
#endif
} }
void Texture::reload() void Texture::reload()
@ -320,25 +290,8 @@ bool Texture::load(std::string file)
if (post == "png") if (post == "png")
{ {
#ifdef BBGE_BUILD_OPENGL
return loadPNG(file); return loadPNG(file);
#endif
#ifdef BBGE_BUILD_DIRECTX
D3DXCreateTextureFromFile(core->getD3DDevice(), file.c_str(), &this->d3dTexture);
if (!d3dTexture)
{
errorLog ("failed to load texture");
}
else
{
D3DSURFACE_DESC desc;
this->d3dTexture->GetLevelDesc(0,&desc);
width = desc.Width;
height = desc.Height;
}
#endif
} }
else if (post == "zga") else if (post == "zga")
{ {
@ -364,7 +317,6 @@ bool Texture::load(std::string file)
void Texture::apply(bool repeatOverride) void Texture::apply(bool repeatOverride)
{ {
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]);
if (repeat || repeatOverride) if (repeat || repeatOverride)
{ {
@ -384,11 +336,6 @@ void Texture::apply(bool repeatOverride)
repeating = false; repeating = false;
} }
} }
#endif
#ifdef BBGE_BUILD_DIRECTX
core->getD3DDevice()->SetTexture(0, d3dTexture);
#endif
} }
void Texture::unbind() void Texture::unbind()
@ -400,7 +347,6 @@ bool Texture::loadPNG(const std::string &file)
if (file.empty()) return false; if (file.empty()) return false;
bool good = false; bool good = false;
#ifdef BBGE_BUILD_OPENGL
pngInfo info; pngInfo info;
@ -444,7 +390,6 @@ bool Texture::loadPNG(const std::string &file)
if(memptr) if(memptr)
delete [] memptr; delete [] memptr;
#endif
return good; return good;
} }

View file

@ -63,14 +63,9 @@ public:
static bool useMipMaps; static bool useMipMaps;
bool repeat, repeating; bool repeat, repeating;
#ifdef BBGE_BUILD_OPENGL
static GLint filter; static GLint filter;
static GLint format; static GLint format;
GLuint textures[1]; GLuint textures[1];
#endif
#ifdef BBGE_BUILD_DIRECTX
LPDIRECT3DTEXTURE9 d3dTexture;
#endif
void reload(); void reload();

View file

@ -39,7 +39,6 @@ void Vector::rotate2DRad(float rad)
Vector getRotatedVector(const Vector &vec, float rot) Vector getRotatedVector(const Vector &vec, float rot)
{ {
#ifdef BBGE_BUILD_OPENGL
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
@ -59,9 +58,6 @@ Vector getRotatedVector(const Vector &vec, float rot)
glPopMatrix(); glPopMatrix();
return Vector(x,y,z); return Vector(x,y,z);
#elif defined(BBGE_BUILD_DIRECTX)
return vec;
#endif
} }
// note update this from float lerp // note update this from float lerp

View file

@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <vector> #include <vector>
#include "Event.h" #include "Event.h"
#ifdef BBGE_BUILD_DIRECTX
#include <d3dx9.h>
#endif
typedef float scalar_t; typedef float scalar_t;
class Vector class Vector
@ -392,12 +389,6 @@ public:
z += 360; z += 360;
} }
#ifdef BBGE_BUILD_DIRECTX
const D3DCOLOR getD3DColor(float alpha)
{
return D3DCOLOR_RGBA(int(x*255), int(y*255), int(z*255), int(alpha*255));
}
#endif
void rotate2DRad(float rad); void rotate2DRad(float rad);
void rotate2D360(float angle); void rotate2D360(float angle);
}; };

View file

@ -298,14 +298,9 @@ endif(NOT(AQUARIA_EXTRA_DATA_DIR STREQUAL ""))
# Aquaria/BBGE specific defines... # Aquaria/BBGE specific defines...
ADD_DEFINITIONS(-DGL_GLEXT_LEGACY=1)
ADD_DEFINITIONS(-DHAVE_PUTENV=1)
ADD_DEFINITIONS(-DTIXML_USE_STL=1)
ADD_DEFINITIONS(-DBBGE_SKIP_CONFIG_HEADERS=1) # if this is not defined, it will use .h files to set the necessary defines ADD_DEFINITIONS(-DBBGE_SKIP_CONFIG_HEADERS=1) # if this is not defined, it will use .h files to set the necessary defines
ADD_DEFINITIONS(-DBBGE_BUILD_SDL=1)
ADD_DEFINITIONS(-DBBGE_BUILD_FRAMEBUFFER=1) ADD_DEFINITIONS(-DBBGE_BUILD_FRAMEBUFFER=1)
ADD_DEFINITIONS(-DBBGE_BUILD_SHADERS=1) ADD_DEFINITIONS(-DBBGE_BUILD_SHADERS=1)
ADD_DEFINITIONS(-DBBGE_BUILD_OPENGL=1)
ADD_DEFINITIONS(-DBBGE_BUILD_OPENGL_DYNAMIC=1) ADD_DEFINITIONS(-DBBGE_BUILD_OPENGL_DYNAMIC=1)
ADD_DEFINITIONS(-DBBGE_BUILD_FMOD_OPENAL_BRIDGE=1) ADD_DEFINITIONS(-DBBGE_BUILD_FMOD_OPENAL_BRIDGE=1)
IF(AQUARIA_USE_VFS) IF(AQUARIA_USE_VFS)