1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-05-10 11:03:51 +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()
{
#ifdef BBGE_BUILD_OPENGL
glLineWidth(1);
glBegin(GL_LINES);
glColor4f(1, 1, 1, 1);
@ -47,7 +46,6 @@ class TimelineRender : public RenderObject
glVertex3f(x, 5, 0);
}
glEnd();
#endif
}
};

View file

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

View file

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

View file

@ -60,7 +60,6 @@ void CurrentRender::onUpdate(float dt)
void CurrentRender::onRender()
{
#ifdef BBGE_BUILD_OPENGL
// note: Leave cull_face disabled!?
//glDisable(GL_CULL_FACE);
//int qs = 0;
@ -316,7 +315,6 @@ void CurrentRender::onRender()
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"
#ifdef BBGE_BUILD_OPENGL
#include <sys/stat.h>
#endif
#ifdef BBGE_BUILD_VFS
#include "ttvfs.h"
@ -281,9 +279,7 @@ void DSQ::forceInputGrabOff()
{
toggleInputGrabPlat(false);
setInpGrab = 0;
#ifdef BBGE_BUILD_SDL
SDL_ShowCursor(SDL_DISABLE);
#endif
}
void DSQ::rumble(float leftMotor, float rightMotor, float time)
@ -857,7 +853,6 @@ void DSQ::setVersionLabelText()
versionLabel->setText(os.str());
}
#ifdef BBGE_BUILD_SDL
static bool sdlVideoModeOK(const int w, const int h, const int bpp)
{
#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);
#endif
}
#endif
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");
*/
#ifdef BBGE_BUILD_SDL
SDL_Init(SDL_INIT_VIDEO);
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))
fullscreen = false; // last chance.
}
#endif
debugLog("Init Graphics Library...");
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, debugMenu), KEY_BACKSPACE, 0);
#if BBGE_BUILD_SDL
addAction(MakeFunctionEvent(DSQ, takeScreenshot ), KEY_PRINTSCREEN, 0);
#endif
addAction(MakeFunctionEvent(DSQ, takeScreenshotKey ), KEY_P, 0);
}
void DSQ::jiggleCursor()
{
#ifdef BBGE_BUILD_SDL
// hacky
SDL_ShowCursor(SDL_ENABLE);
SDL_ShowCursor(SDL_DISABLE);
#endif
}
float skipSfxVol = 1.0;
@ -4209,9 +4197,7 @@ void DSQ::onUpdate(float dt)
{
pollEvents();
ActionMapper::onUpdate(sec);
#ifdef BBGE_BUILD_SDL
SDL_Delay(int(sec*1000));
#endif
render();
showBuffer();
resetTimer();
@ -4965,10 +4951,8 @@ void AquariaScreenTransition::capture()
width = core->getWindowWidth();
height = core->getWindowHeight();
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D,screen_texture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, width, height);
#endif
dsq->cursor->alpha = oldAlpha;

View file

@ -1949,7 +1949,6 @@ void Game::clearObsRows()
void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
{
#ifdef BBGE_BUILD_OPENGL
if (q->texture)
{
std::vector<TileVector> obs;
@ -2079,7 +2078,6 @@ void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
}
glPopMatrix();
}
#endif
}
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 */)
{
#ifdef BBGE_BUILD_OPENGL
if (q->texture)
{
q->collidePosition = Vector(0,0,0);
@ -2869,7 +2866,6 @@ void Game::generateCollisionMask(Quad *q, float overrideCollideRadius /* = 0 */)
rot += 360;
*/
}
#endif
}
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 drawy2 = (endCol+1)*TILE_SIZE;
#ifdef BBGE_BUILD_OPENGL
glBegin(GL_QUADS);
glVertex3i(drawx1, drawy2, 0.0f);
glVertex3i(drawx2, drawy2, 0.0f);
glVertex3i(drawx2, drawy1, 0.0f);
glVertex3i(drawx1, drawy1, 0.0f);
glEnd();
#endif
#ifdef BBGE_BUILD_DIRECTX
core->blitD3DVerts(0,
drawx1, drawy1,
drawx2, drawy1,
drawx2, drawy2,
drawx1, drawy2);
#endif
}
void GridRender::onRender()
@ -163,7 +154,6 @@ void SongLineRender::onRender()
int ls = (4*w)/1024.0f;
if (ls < 0)
ls = 1;
#ifdef BBGE_BUILD_OPENGL
glLineWidth(ls);
const int alphaLine = pts.size()*(0.9f);
float a = 1;
@ -178,6 +168,5 @@ void SongLineRender::onRender()
glVertex2f(pts[i].pt.x, pts[i].pt.y);
}
glEnd();
#endif
}

View file

@ -125,7 +125,6 @@ HairNode *Hair::getHairNode(int idx)
void Hair::onRender()
{
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE);
glBegin(GL_QUAD_STRIP);
@ -189,7 +188,6 @@ void Hair::onRender()
*/
//glEnable(GL_CULL_FACE);
#endif
}
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[])
{
@ -102,7 +88,6 @@ static void CheckConfig(void)
extraDataDir = AQUARIA_EXTRA_DATA_DIR;
#endif
#endif
CheckConfig();

View file

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

View file

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

View file

@ -93,7 +93,6 @@ std::string getMapTemplateFilename()
void WarpAreaRender::onRender()
{
#ifdef BBGE_BUILD_OPENGL
for (int i = 0; i < dsq->game->warpAreas.size(); i++)
{
WarpArea *a = &dsq->game->warpAreas[i];
@ -141,53 +140,6 @@ void WarpAreaRender::onRender()
}
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)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -177,7 +177,6 @@ void AfterEffectManager::render()
{
assert(core->frameBuffer.isInited());
#ifdef BBGE_BUILD_OPENGL
glPushMatrix();
glDisable (GL_ALPHA_TEST);
@ -191,12 +190,10 @@ void AfterEffectManager::render()
renderGrid();
//renderGridPoints();
glPopMatrix();
#endif
}
void AfterEffectManager::renderGrid()
{
#ifdef BBGE_BUILD_OPENGL
int firstShader = -1;
int lastShader = -1;
@ -355,12 +352,10 @@ void AfterEffectManager::renderGrid()
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//if (bRenderGridPoints)
// renderGridPoints();
#endif
}
void AfterEffectManager::renderGridPoints()
{
#ifdef BBGE_BUILD_OPENGL
glColor4f(0.0f,0.0f,0.0f,1.0f);
for (int i = 0; i < (xDivs); i++)
{
@ -374,7 +369,6 @@ void AfterEffectManager::renderGridPoints()
glEnd();
}
}
#endif
}
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)
{
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE);
glBegin(GL_POLYGON);
@ -364,7 +363,6 @@ void drawCircle(float radius, int stepSize)
glEnd();
//glEnable(GL_CULL_FACE);
#endif
}
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)
{
#ifdef BBGE_BUILD_OPENGL
glColor4f(float(r)/256.0f, float(g)/256.0f, float(b)/256.0f, 1.0f);
#endif
}
bool chance(int perc)
@ -930,14 +926,12 @@ GLuint generateEmptyTexture(int quality) // Create An Empty Texture
memset(data, 0, size); // Clear Storage Memory
#ifdef BBGE_BUILD_OPENGL
glGenTextures(1, &txtnumber); // Create 1 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_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, quality, quality, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data); // Build Texture Using Information In data
#endif
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 "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
#ifdef BBGE_BUILD_SDL
#include "SDL.h"
#endif
#if defined(BBGE_BUILD_OPENGL)
#define GL_GLEXT_LEGACY 1
#include "gl.h"
#include "glext.h"
#endif
#define compile_assert(pred) switch(0){case 0:case (pred):;}
@ -233,9 +202,6 @@ Direction getOppositeDir(Direction dir);
Direction getNextDirClockwise(Direction dir);
Vector colorRGB(int r, int g, int b);
#ifdef BBGE_BUILD_DIRECTX
typedef unsigned int GLuint;
#endif
GLuint generateEmptyTexture(int res);
//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;
#ifdef BBGE_BUILD_OPENGL
GLuint id=0;
glGenTextures(1, &id);
if (!font.Create(file.c_str(), id, loadTexture))
return;
#endif
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 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_BLEND);
@ -382,7 +379,6 @@ void BitmapText::onRender()
//glEnable(GL_CULL_FACE);
glBindTexture(GL_TEXTURE_2D, 0);
#endif
}
void BitmapText::unloadDevice()

View file

@ -203,7 +203,6 @@ float CollisionShape::getX2()
void CollisionShape::render()
{
#ifdef BBGE_BUILD_OPENGL
glTranslatef(offsetPosition.x, offsetPosition.y,0);
switch(getType())
{
@ -245,7 +244,6 @@ void CollisionShape::render()
}
glTranslatef(-offsetPosition.x, -offsetPosition.y,0);
#endif
//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 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
{
// replace with GLFW equivalent
@ -393,353 +225,6 @@ enum GameKeys
KEY_ANYKEY,
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 };
@ -800,13 +285,11 @@ public:
Vector rightStick;
bool inited, xinited;
bool anyButton();
#ifdef BBGE_BUILD_SDL
# ifdef BBGE_BUILD_SDL2
SDL_GameController *sdl_controller;
SDL_Haptic *sdl_haptic;
# endif
SDL_Joystick *sdl_joy;
#endif
#if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2)
int eventfd;
int16_t effectid;
@ -1188,17 +671,6 @@ public:
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 getMouseButtonState(int m);
@ -1380,9 +852,7 @@ protected:
std::ofstream _logOut;
#ifdef BBGE_BUILD_SDL
int nowTicks, thenTicks;
#endif
int _vsync, _bpp;
bool _fullscreen;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -139,17 +139,11 @@ private:
bool stopped; // true if enqueued deletion
unsigned int samples_done; // Number of samples played and dequeued
#ifdef BBGE_BUILD_SDL
static SDL_Thread *decoderThread;
static LockedQueue<OggDecoder*> decoderQ;
static volatile bool stop_thread;
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 *);
};
@ -181,16 +175,13 @@ static const ov_callbacks ogg_memory_callbacks = {
OggDecoder::mem_tell
};
#ifdef BBGE_BUILD_SDL
SDL_Thread *OggDecoder::decoderThread = NULL;
LockedQueue<OggDecoder*> OggDecoder::decoderQ;
volatile bool OggDecoder::stop_thread;
std::list<OggDecoder*> OggDecoder::decoderList;
#endif
void OggDecoder::startDecoderThread()
{
#ifdef BBGE_BUILD_SDL
stop_thread = false;
#ifdef BBGE_BUILD_SDL2
decoderThread = SDL_CreateThread((int (*)(void *))decode_loop, "OggDecoder", NULL);
@ -202,12 +193,10 @@ void OggDecoder::startDecoderThread()
debugLog("Failed to create Ogg Vorbis decode thread: "
+ std::string(SDL_GetError()));
}
#endif
}
void OggDecoder::stopDecoderThread()
{
#ifdef BBGE_BUILD_SDL
if (decoderThread)
{
stop_thread = true;
@ -215,27 +204,22 @@ void OggDecoder::stopDecoderThread()
SDL_WaitThread(decoderThread, NULL);
decoderThread = NULL;
}
#endif
}
void OggDecoder::detachDecoder(OggDecoder *ogg)
{
#ifdef BBGE_BUILD_SDL
if(decoderThread)
{
ogg->thread = true;
decoderQ.push(ogg);
}
#endif
}
void OggDecoder::decode_loop(OggDecoder *this_)
{
while (!this_->stop_thread)
{
#ifdef BBGE_BUILD_SDL
SDL_Delay(10);
#endif
// Transfer decoder to this background thread
OggDecoder *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!
#ifdef BBGE_BUILD_FRAMEBUFFER
#if defined(BBGE_BUILD_OPENGL)
PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL;
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
@ -43,7 +42,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL;
PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
#endif
#endif
FrameBuffer::FrameBuffer()
{
@ -123,7 +121,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen, GLint filter)
w=width;
h=height;
#ifdef BBGE_BUILD_OPENGL
char *ext = (char*)glGetString( GL_EXTENSIONS );
std::ostringstream os;
@ -137,7 +134,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen, GLint filter)
}
else
{
#if defined(BBGE_BUILD_SDL)
if (!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");
glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)SDL_GL_GetProcAddress("glGenerateMipmapEXT");
}
#endif
if( !glIsRenderbufferEXT || !glBindRenderbufferEXT || !glDeleteRenderbuffersEXT ||
!glGenRenderbuffersEXT || !glRenderbufferStorageEXT || !glGetRenderbufferParameterivEXT ||
@ -219,7 +214,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen, GLint filter)
glBindTexture(GL_TEXTURE_2D, 0);
#endif
debugLog("Done");
inited = true;
enabled = true;
@ -237,7 +231,6 @@ void FrameBuffer::unloadDevice()
#ifdef BBGE_BUILD_FRAMEBUFFER
#ifdef BBGE_BUILD_OPENGL
if (glDeleteFramebuffersEXT == NULL)
{
@ -274,13 +267,11 @@ void FrameBuffer::unloadDevice()
glDeleteRenderbuffersEXT(1, &g_depthRenderBuffer);
g_depthRenderBuffer = 0;
}
#endif
#endif
debugLog("done");
}
#if defined(BBGE_BUILD_SDL)
void FrameBuffer::resetOpenGL()
{
#if defined(BBGE_BUILD_FRAMEBUFFER)
@ -305,7 +296,6 @@ void FrameBuffer::resetOpenGL()
glGenerateMipmapEXT = NULL;
#endif
}
#endif
void FrameBuffer::reloadDevice()
{
@ -317,7 +307,6 @@ void FrameBuffer::startCapture()
{
#ifdef BBGE_BUILD_FRAMEBUFFER
#ifdef BBGE_BUILD_OPENGL
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
//glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, g_depthRenderBuffer );
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 );
#endif
#endif
}
@ -334,9 +322,7 @@ void FrameBuffer::endCapture()
{
#ifdef BBGE_BUILD_FRAMEBUFFER
#ifdef BBGE_BUILD_OPENGL
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
#endif
#endif
}
@ -345,9 +331,7 @@ void FrameBuffer::bindTexture()
{
#ifdef BBGE_BUILD_FRAMEBUFFER
#ifdef BBGE_BUILD_OPENGL
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID );
#endif
#endif
}

View file

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

View file

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

View file

@ -59,14 +59,6 @@ void Gradient::makeHorizontal(Vector c1, Vector c2)
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);
glBegin(GL_QUADS);
@ -100,6 +92,5 @@ void Gradient::onRender()
glVertex3f(-0.5, 0.5, 0);
*/
glEnd();
#endif
}

View file

@ -89,13 +89,11 @@ Joystick::Joystick()
{
xinited = false;
stickIndex = -1;
#ifdef BBGE_BUILD_SDL
# ifdef BBGE_BUILD_SDL2
sdl_controller = NULL;
sdl_haptic = NULL;
# endif
sdl_joy = NULL;
#endif
#if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2)
eventfd = -1;
effectid = -1;
@ -124,11 +122,8 @@ Joystick::Joystick()
void Joystick::init(int stick)
{
#if defined(BBGE_BUILD_SDL) || defined(__LINUX__)
std::ostringstream os;
#endif
#ifdef BBGE_BUILD_SDL
stickIndex = stick;
const int numJoy = SDL_NumJoysticks();
os << "Found [" << numJoy << "] joysticks";
@ -184,7 +179,6 @@ void Joystick::init(int stick)
{
debugLog("Not enough Joystick(s) found");
}
#endif
#if defined(__LINUX__) && !defined(BBGE_BUILD_SDL2)
os.seekp(0);
@ -233,9 +227,6 @@ void Joystick::init(int stick)
debugLog("after catch");
#if !defined(BBGE_BUILD_SDL)
inited = xinited;
#endif
#endif
}
@ -250,7 +241,6 @@ void Joystick::shutdown()
eventfd = -1;
}
#endif
#ifdef BBGE_BUILD_SDL
#ifdef BBGE_BUILD_SDL2
if (sdl_haptic)
{
@ -269,7 +259,6 @@ void Joystick::shutdown()
SDL_JoystickClose(sdl_joy);
sdl_joy = 0;
}
#endif
}
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)
{
#ifdef BBGE_BUILD_SDL
if (core->joystickEnabled && inited && sdl_joy && stickIndex != -1)
{
#ifdef BBGE_BUILD_SDL2
@ -499,7 +487,6 @@ void Joystick::update(float dt)
}
#endif
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;
btnSelect = xinp.Gamepad.wButtons & XINPUT_GAMEPAD_BACK;

View file

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

View file

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

View file

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

View file

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

View file

@ -347,7 +347,6 @@ void Quad::renderGrid()
if (xDivs < 2 || yDivs < 2)
return;
#ifdef BBGE_BUILD_OPENGL
const float percentX = fabsf(this->lowerRightTextureCoordinates.x - this->upperLeftTextureCoordinates.x);
const float percentY = fabsf(this->upperLeftTextureCoordinates.y - this->lowerRightTextureCoordinates.y);
@ -438,7 +437,6 @@ void Quad::renderGrid()
if (texture)
glBindTexture(GL_TEXTURE_2D, texture->textures[0]);
}
#endif
}
void Quad::repeatTextureToFill(bool on)
@ -453,7 +451,6 @@ void Quad::onRender()
{
if (!renderQuad) return;
#ifdef BBGE_BUILD_OPENGL
float _w2 = width/2.0f;
float _h2 = height/2.0f;
@ -547,123 +544,6 @@ void Quad::onRender()
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;
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE);
int c = 0;
Vector p, diff, dl, dr;
@ -114,7 +113,6 @@ void QuadTrail::onRender()
glVertex2f((*i).point.x, (*i).point.y);
}
glEnd();
#endif
}
void QuadTrail::onUpdate(float dt)

View file

@ -59,7 +59,6 @@ int RenderObject::getTopLayer()
void RenderObject::applyBlendType()
{
#ifdef BBGE_BUILD_OPENGL
if (blendEnabled)
{
glEnable(GL_BLEND);
@ -84,42 +83,6 @@ void RenderObject::applyBlendType()
glDisable(GL_BLEND);
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)
@ -179,9 +142,6 @@ RenderObject::RenderObject()
motionBlurFrameOffset = 0;
motionBlur = false;
idx = -1;
#ifdef BBGE_BUILD_DIRECTX
useDXTransform = false;
#endif
_fv = false;
_fh = false;
updateCull = -1;
@ -255,7 +215,6 @@ bool RenderObject::isPieceFlippedHorizontal()
Vector RenderObject::getInvRotPosition(const Vector &vec)
{
#ifdef BBGE_BUILD_OPENGL
glPushMatrix();
glLoadIdentity();
@ -292,9 +251,6 @@ Vector RenderObject::getInvRotPosition(const Vector &vec)
glPopMatrix();
return Vector(x,y,z);
#elif BBGE_BUILD_DIRECTX
return vec;
#endif
}
#ifdef BBGE_USE_GLM
@ -327,7 +283,6 @@ static void matrixChain(RenderObject *ro)
if (RenderObject *parent = ro->getParent())
matrixChain(parent);
#ifdef BBGE_BUILD_OPENGL
glTranslatef(ro->position.x+ro->offset.x, ro->position.y+ro->offset.y, 0);
glRotatef(ro->rotation.z+ro->rotationOffset.z, 0, 0, 1);
glTranslatef(ro->beforeScaleOffset.x, ro->beforeScaleOffset.y, 0);
@ -338,7 +293,6 @@ static void matrixChain(RenderObject *ro)
glRotatef(180, 0, 1, 0);
}
glTranslatef(ro->internalOffset.x, ro->internalOffset.y, 0);
#endif
}
#endif
@ -369,7 +323,6 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec)
return Vector(transformMatrix[3][0], transformMatrix[3][1], 0);
#else
#ifdef BBGE_BUILD_OPENGL
glPushMatrix();
glLoadIdentity();
@ -383,9 +336,6 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec)
glPopMatrix();
return Vector(x,y,0);
#elif BBGE_BUILD_DIRECTX
return vec;
#endif
#endif
}
@ -656,19 +606,13 @@ void RenderObject::renderCall()
position += offset;
#ifdef BBGE_BUILD_DIRECTX
if (!RENDEROBJECT_FASTTRANSFORM)
core->getD3DMatrixStack()->Push();
#endif
#ifdef BBGE_BUILD_OPENGL
if (!RENDEROBJECT_FASTTRANSFORM)
glPushMatrix();
if (!RENDEROBJECT_SHAREATTRIBUTES)
{
glPushAttrib(GL_ALL_ATTRIB_BITS);
}
#endif
if (!RENDEROBJECT_FASTTRANSFORM)
@ -685,7 +629,6 @@ void RenderObject::renderCall()
{
if (followCamera == 1)
{
#ifdef BBGE_BUILD_OPENGL
glLoadIdentity();
glScalef(core->globalResolutionScale.x, core->globalResolutionScale.y,0);
glTranslatef(position.x, position.y, position.z);
@ -696,24 +639,11 @@ void RenderObject::renderCall()
}
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
{
Vector pos = getFollowCameraPosition();
#ifdef BBGE_BUILD_OPENGL
glTranslatef(pos.x, pos.y, pos.z);
if (isfh())
{
@ -721,29 +651,13 @@ void RenderObject::renderCall()
glRotatef(180, 0, 1, 0);
}
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
{
#ifdef BBGE_BUILD_OPENGL
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)
{
glLineWidth(4);
@ -770,8 +684,6 @@ void RenderObject::renderCall()
}
glEnd();
}
#endif
#ifdef BBGE_BUILD_OPENGL
glRotatef(rotation.z+rotationOffset.z, 0, 0, 1);
if (isfh())
@ -779,34 +691,11 @@ void RenderObject::renderCall()
//glDisable(GL_CULL_FACE);
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);
glScalef(scale.x, scale.y, 1);
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);
@ -844,41 +733,27 @@ void RenderObject::renderCall()
//if (useColor)
{
#ifdef BBGE_BUILD_OPENGL
if (rlayer)
glColor4f(color.x * rlayer->color.x, color.y * rlayer->color.y, color.z * rlayer->color.z, alpha.x*alphaMod);
else
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)
{
#ifdef BBGE_BUILD_OPENGL
if (texture->textures[0] != lastTextureApplied || repeatTexture != lastTextureRepeat)
{
texture->apply(repeatTexture);
lastTextureRepeat = repeatTexture;
lastTextureApplied = texture->textures[0];
}
#endif
#ifdef BBGE_BUILD_DIRECTX
texture->apply(repeatTexture);
#endif
}
else
{
if (lastTextureApplied != 0 || repeatTexture != lastTextureRepeat)
{
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, 0);
#endif
#ifdef BBGE_BUILD_DIRECTX
core->bindTexture(0, 0);
#endif
lastTextureApplied = 0;
lastTextureRepeat = repeatTexture;
}
@ -922,13 +797,7 @@ void RenderObject::renderCall()
if (!RENDEROBJECT_FASTTRANSFORM)
{
#ifdef BBGE_BUILD_OPENGL
glPopMatrix();
#endif
#ifdef BBGE_BUILD_DIRECTX
core->getD3DMatrixStack()->Pop();
core->applyMatrixStackToWorld();
#endif
}
@ -939,7 +808,6 @@ void RenderObject::renderCollision()
{
if (!collisionRects.empty())
{
#ifdef BBGE_BUILD_OPENGL
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, 0);
@ -974,12 +842,10 @@ void RenderObject::renderCollision()
glDisable(GL_BLEND);
glPopAttrib();
#endif
}
if (!collisionMask.empty())
{
#ifdef BBGE_BUILD_OPENGL
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, 0);
@ -1023,7 +889,6 @@ void RenderObject::renderCollision()
glPopAttrib();
//glTranslatef(offset.x, offset.y,0);
#endif
}
else if (collideRadius > 0)
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -45,10 +45,8 @@ public:
protected:
std::string vertFile, fragFile;
std::string vertSrc, fragSrc;
#ifdef BBGE_BUILD_OPENGL
GLuint g_programObj;
int numUniforms;
#endif
private:
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"
#endif
#ifdef BBGE_BUILD_OPENGL
GLint Texture::filter = GL_LINEAR;
GLint Texture::format = 0;
#endif
bool Texture::useMipMaps = true;
/*
@ -57,12 +55,7 @@ bool Texture::useMipMaps = true;
Texture::Texture()
{
#ifdef BBGE_BUILD_OPENGL
textures[0] = 0;
#endif
#ifdef BBGE_BUILD_DIRECTX
d3dTexture = 0;
#endif
width = height = 0;
repeat = false;
@ -79,7 +72,6 @@ Texture::~Texture()
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)
{
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 << ")";
debugLog(os.str());
}
#endif
}
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]);
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.
*/
#endif
}
void Texture::unload()
{
#ifdef BBGE_BUILD_OPENGL
if (textures[0])
{
ow = width;
@ -165,28 +153,17 @@ void Texture::unload()
glDeleteTextures(1, &textures[0]);
textures[0] = 0;
}
#endif
}
void Texture::destroy()
{
#ifdef BBGE_BUILD_OPENGL
unload();
#endif
#ifdef BBGE_BUILD_DIRECTX
if (d3dTexture)
{
d3dTexture->Release();
d3dTexture = 0;
}
#endif
core->removeTexture(this);
}
int Texture::getPixelWidth()
{
#ifdef BBGE_BUILD_OPENGL
int w = 0, h = 0;
unsigned int size = 0;
unsigned char *data = getBufferAndSize(&w, &h, &size);
@ -210,14 +187,10 @@ int Texture::getPixelWidth()
}
free(data);
return largestx - smallestx;
#elif defined(BBGE_BUILD_DIRECTX)
return 0;
#endif
}
int Texture::getPixelHeight()
{
#ifdef BBGE_BUILD_OPENGL
int w = 0, h = 0;
unsigned int size = 0;
unsigned char *data = getBufferAndSize(&w, &h, &size);
@ -241,9 +214,6 @@ int Texture::getPixelHeight()
}
free(data);
return largesty - smallesty;
#elif defined(BBGE_BUILD_DIRECTX)
return 0;
#endif
}
void Texture::reload()
@ -320,25 +290,8 @@ bool Texture::load(std::string file)
if (post == "png")
{
#ifdef BBGE_BUILD_OPENGL
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")
{
@ -364,7 +317,6 @@ bool Texture::load(std::string file)
void Texture::apply(bool repeatOverride)
{
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, textures[0]);
if (repeat || repeatOverride)
{
@ -384,11 +336,6 @@ void Texture::apply(bool repeatOverride)
repeating = false;
}
}
#endif
#ifdef BBGE_BUILD_DIRECTX
core->getD3DDevice()->SetTexture(0, d3dTexture);
#endif
}
void Texture::unbind()
@ -400,7 +347,6 @@ bool Texture::loadPNG(const std::string &file)
if (file.empty()) return false;
bool good = false;
#ifdef BBGE_BUILD_OPENGL
pngInfo info;
@ -444,7 +390,6 @@ bool Texture::loadPNG(const std::string &file)
if(memptr)
delete [] memptr;
#endif
return good;
}

View file

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

View file

@ -39,7 +39,6 @@ void Vector::rotate2DRad(float rad)
Vector getRotatedVector(const Vector &vec, float rot)
{
#ifdef BBGE_BUILD_OPENGL
glPushMatrix();
glLoadIdentity();
@ -59,9 +58,6 @@ Vector getRotatedVector(const Vector &vec, float rot)
glPopMatrix();
return Vector(x,y,z);
#elif defined(BBGE_BUILD_DIRECTX)
return vec;
#endif
}
// 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 "Event.h"
#ifdef BBGE_BUILD_DIRECTX
#include <d3dx9.h>
#endif
typedef float scalar_t;
class Vector
@ -392,12 +389,6 @@ public:
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 rotate2D360(float angle);
};

View file

@ -298,14 +298,9 @@ endif(NOT(AQUARIA_EXTRA_DATA_DIR STREQUAL ""))
# 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_BUILD_SDL=1)
ADD_DEFINITIONS(-DBBGE_BUILD_FRAMEBUFFER=1)
ADD_DEFINITIONS(-DBBGE_BUILD_SHADERS=1)
ADD_DEFINITIONS(-DBBGE_BUILD_OPENGL=1)
ADD_DEFINITIONS(-DBBGE_BUILD_OPENGL_DYNAMIC=1)
ADD_DEFINITIONS(-DBBGE_BUILD_FMOD_OPENAL_BRIDGE=1)
IF(AQUARIA_USE_VFS)