1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 06:24:32 +00:00

Rework & cleanup CMake project files

- Building with CMake for development is now actually sane
- Split deps into projects and extra files
- Building against external deps should still work but needs testing
- Can now build out of the box without further adjustments as long as SDL(2) is found properly
- Build Lua in C++ mode (so it can use exceptions instead of setjmp/longjmp)
  - Unfortunately we need to enable exceptions for this :(

- Remove these defines:
  * AQUARIA_BUILD_SCENEEDITOR (now always on)
  * AQUARIA_BUILD_CONSOLE (now always on)
  * BBGE_BUILD_ACHIEVEMENTS_INTERNAL (now always on unless BBGE_BUILD_STEAMWORKS is defined)
  * BBGE_BUILD_OPENGL_DYNAMIC (now always on, define BBGE_BUILD_OPENGL_STATIC if needed)
  * BBGE_BUILD_FMOD_OPENAL_BRIDGE (now always on)
- BBGE_BUILD_STEAMWORKS is not actually implemented (any volunteers?)
- Prepare later removal of SDL & the old vc90 project from the repo. See #74 for extra notes.
This commit is contained in:
fgenesis 2022-04-07 02:38:39 +02:00
parent f0f9f1a719
commit 49b9e0f05a
52 changed files with 719 additions and 1053 deletions

View file

@ -1,13 +0,0 @@
#ifndef BBGE_COMPILE_CONFIG_H
#define BBGE_COMPILE_CONFIG_H
#ifndef BBGE_SKIP_CONFIG_HEADERS
#define BBGE_BUILD_OPENGL_DYNAMIC 1
#define BBGE_BUILD_FMOD_OPENAL_BRIDGE 1
#define BBGE_BUILD_ACHIEVEMENTS_INTERNAL 1
#define BBGE_BUILD_VFS 1
#endif
#endif

View file

@ -29,8 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#endif
#include "BBGECompileConfig.h"
#define compile_assert(pred) switch(0){case 0:case (pred):;}
#ifdef _MSC_VER

116
BBGE/CMakeLists.txt Normal file
View file

@ -0,0 +1,116 @@
# Bit Blot Game Engine sources...
set(BBGE_SRCS
ActionInput.cpp
ActionInput.h
ActionMapper.cpp
ActionMapper.h
ActionSet.cpp
ActionSet.h
ActionStatus.cpp
ActionStatus.h
AfterEffect.cpp
AfterEffect.h
Base.cpp
Base.h
BaseText.h
bithacks.h
BitmapFont.cpp
BitmapFont.h
CMakeLists.txt
Core.cpp
Core.h
DarkLayer.cpp
DarkLayer.h
DebugFont.cpp
DebugFont.h
Effects.cpp
Effects.h
Emitter.cpp
Event.cpp
Event.h
FmodOpenALBridge.cpp
FmodOpenALBridge.h
FrameBuffer.cpp
FrameBuffer.h
GameKeyNames.cpp
GameKeyNames.h
GameKeys.h
GLLoad.cpp
GLLoad.h
Gradient.cpp
Gradient.h
Image.cpp
Image.h
Joystick.cpp
Joystick.h
LensFlare.cpp
LensFlare.h
Localization.cpp
Localization.h
MathFunctions.h
MT.cpp
MT.h
OpenGLStubs.h
OSFunctions.cpp
OSFunctions.h
ParticleEffect.cpp
ParticleManager.cpp
Particles.cpp
Particles.h
Precacher.cpp
Precacher.h
Quad.cpp
Quad.h
QuadTrail.cpp
QuadTrail.h
ReadXML.cpp
ReadXML.h
Rect.h
Refcounted.h
RenderBase.cpp
RenderBase.h
RenderObject.cpp
RenderObject.h
RenderObject_inline.h
RenderObjectLayer.cpp
RenderRect.cpp
RoundedRect.cpp
RoundedRect.h
ScreenTransition.cpp
ScreenTransition.h
ScriptObject.cpp
ScriptObject.h
Shader.cpp
Shader.h
SimpleIStringStream.h
SkeletalSprite.cpp
SkeletalSprite.h
Slider.cpp
Slider.h
SoundManager.cpp
SoundManager.h
SpawnParticleData.cpp
StateMachine.cpp
StateMachine.h
StateManager.cpp
StateManager.h
StringBank.cpp
StringBank.h
Texture.cpp
Texture.h
TTFFont.cpp
TTFFont.h
Vector.cpp
Vector.h
Window.cpp
Window.h
Window_SDL1.cpp
Window_SDL2.cpp
)
if(APPLE AND NOT AQUARIA_USE_SDL2)
set(BBGE_SRCS ${BBGE_SRCS} Cocoa.mm)
endif()
add_library(BBGE ${BBGE_SRCS})
target_link_libraries(BBGE ExternalLibs ${SDL_LIBRARY})

View file

@ -51,6 +51,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef BBGE_BUILD_VFS
#include "ttvfs.h"
#endif
#include "ttvfs_stdio.h"
Core *core = 0;
@ -709,7 +710,6 @@ void Core::initGraphicsLibrary(int width, int height, bool fullscreen, bool vsyn
window->open(width, height, fullscreen, bpp, vsync, display, hz);
window->setTitle(appName.c_str());
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
// get GL symbols AFTER opening the window, otherwise we get a super old GL context on windows and nothing works
if (!lookup_all_glsyms())
{
@ -718,7 +718,6 @@ void Core::initGraphicsLibrary(int width, int height, bool fullscreen, bool vsyn
SDL_Quit();
exit_error(os.str());
}
#endif
debugLog("GL vendor, renderer & version:");
debugLog((const char*)glGetString(GL_VENDOR));
@ -833,9 +832,7 @@ void Core::shutdownGraphicsLibrary()
delete window;
window = NULL;
SDL_QuitSubSystem(SDL_INIT_VIDEO);
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
unload_all_glsyms();
#endif
lib_graphics = false;
@ -2316,7 +2313,7 @@ void Core::initLocalization()
while(in)
{
in >> low >> up;
trans[(unsigned char)(low[0])] = (unsigned char)up[0];
}
initCharTranslationTables(&trans);

View file

@ -1,7 +1,16 @@
#include "GLLoad.h"
#ifdef BBGE_BUILD_OPENGL_STATIC
bool lookup_all_glsyms() { return true; }
bool void unload_all_glsyms() { return false; }
#else
#include "Base.h"
#include "RenderBase.h"
#include "GLLoad.h"
#include <sstream>
#ifdef GLAPIENTRY
@ -16,7 +25,6 @@
#include <GL/glext.h>
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
@ -89,6 +97,7 @@ static bool lookup_glsym(const char *funcname, void **func)
bool lookup_all_glsyms()
{
bool retval = true;
#define GL_FUNC(ret,fn,params,call,rt) \
if (!lookup_glsym(#fn, (void **) &p##fn)) retval = false;
#include "OpenGLStubs.h"
@ -210,4 +219,4 @@ void unload_all_glsyms()
glUniform4ivARB = NULL;
}
#endif // BBGE_BUILD_OPENGL_DYNAMIC
#endif // BBGE_BUILD_OPENGL_STATIC

View file

@ -2,7 +2,6 @@
#define BBGE_GAME_KEYS_H
#include <SDL_version.h>
#include "BBGECompileConfig.h"
#if SDL_VERSION_ATLEAST(2,0,0)

View file

@ -37,7 +37,7 @@ void Shader::staticInit()
bool use = true;
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
#ifndef BBGE_BUILD_OPENGL_STATIC
if( !glCreateProgramObjectARB || !glDeleteObjectARB || !glUseProgramObjectARB ||
!glCreateShaderObjectARB || !glCreateShaderObjectARB || !glCompileShaderARB ||
!glGetObjectParameterivARB || !glAttachObjectARB || !glGetInfoLogARB ||

View file

@ -24,15 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Base.h"
#include "ttvfs_stdio.h"
#ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE
#include "FmodOpenALBridge.h"
#else
#include <fmod.h>
#include <fmod.hpp>
#ifdef BBGE_BUILD_WINDOWS
#pragma comment(lib, "fmodex_vc.lib")
#endif
#endif
#include "FmodOpenALBridge.h"
SoundManager *sound = 0;
@ -328,11 +321,6 @@ SoundManager::SoundManager(const std::string &defaultDevice)
if (checkError()) goto get_out;
}
#ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE
SoundCore::system->getNumChannels(&channels);
#endif
debugLog("set file system");
result = SoundCore::system->setFileSystem(myopen, myclose, myread, myseek, 2048);

View file

@ -1,173 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "Core.h"
typedef std::map<std::string, int> InputCodeMap;
InputCodeMap inputCodeMap;
void initInputCodeMap()
{
inputCodeMap["0"] = 0;
inputCodeMap["KEY_A"] = KEY_A;
inputCodeMap["KEY_B"] = KEY_B;
inputCodeMap["KEY_C"] = KEY_C;
inputCodeMap["KEY_D"] = KEY_D;
inputCodeMap["KEY_E"] = KEY_E;
inputCodeMap["KEY_F"] = KEY_F;
inputCodeMap["KEY_G"] = KEY_G;
inputCodeMap["KEY_H"] = KEY_H;
inputCodeMap["KEY_I"] = KEY_I;
inputCodeMap["KEY_J"] = KEY_J;
inputCodeMap["KEY_K"] = KEY_K;
inputCodeMap["KEY_L"] = KEY_L;
inputCodeMap["KEY_M"] = KEY_M;
inputCodeMap["KEY_N"] = KEY_N;
inputCodeMap["KEY_O"] = KEY_O;
inputCodeMap["KEY_P"] = KEY_P;
inputCodeMap["KEY_Q"] = KEY_Q;
inputCodeMap["KEY_R"] = KEY_R;
inputCodeMap["KEY_S"] = KEY_S;
inputCodeMap["KEY_T"] = KEY_T;
inputCodeMap["KEY_U"] = KEY_U;
inputCodeMap["KEY_V"] = KEY_V;
inputCodeMap["KEY_W"] = KEY_W;
inputCodeMap["KEY_X"] = KEY_X;
inputCodeMap["KEY_Y"] = KEY_Y;
inputCodeMap["KEY_Z"] = KEY_Z;
inputCodeMap["KEY_1"] = KEY_1;
inputCodeMap["KEY_2"] = KEY_2;
inputCodeMap["KEY_3"] = KEY_3;
inputCodeMap["KEY_4"] = KEY_4;
inputCodeMap["KEY_5"] = KEY_5;
inputCodeMap["KEY_6"] = KEY_6;
inputCodeMap["KEY_7"] = KEY_7;
inputCodeMap["KEY_8"] = KEY_8;
inputCodeMap["KEY_9"] = KEY_9;
inputCodeMap["KEY_0"] = KEY_0;
inputCodeMap["KEY_NUMPAD1"] = KEY_NUMPAD1;
inputCodeMap["KEY_NUMPAD2"] = KEY_NUMPAD2;
inputCodeMap["KEY_NUMPAD3"] = KEY_NUMPAD3;
inputCodeMap["KEY_NUMPAD4"] = KEY_NUMPAD4;
inputCodeMap["KEY_NUMPAD5"] = KEY_NUMPAD5;
inputCodeMap["KEY_NUMPAD6"] = KEY_NUMPAD6;
inputCodeMap["KEY_NUMPAD7"] = KEY_NUMPAD7;
inputCodeMap["KEY_NUMPAD8"] = KEY_NUMPAD8;
inputCodeMap["KEY_NUMPAD9"] = KEY_NUMPAD9;
inputCodeMap["KEY_NUMPAD0"] = KEY_NUMPAD0;
inputCodeMap["KEY_F1"] = KEY_F1;
inputCodeMap["KEY_F2"] = KEY_F2;
inputCodeMap["KEY_F3"] = KEY_F3;
inputCodeMap["KEY_F4"] = KEY_F4;
inputCodeMap["KEY_F5"] = KEY_F5;
inputCodeMap["KEY_F6"] = KEY_F6;
inputCodeMap["KEY_F7"] = KEY_F7;
inputCodeMap["KEY_F8"] = KEY_F8;
inputCodeMap["KEY_F9"] = KEY_F9;
inputCodeMap["KEY_F10"] = KEY_F10;
inputCodeMap["KEY_F11"] = KEY_F11;
inputCodeMap["KEY_F12"] = KEY_F12;
inputCodeMap["KEY_LEFT"] = KEY_LEFT;
inputCodeMap["KEY_RIGHT"] = KEY_RIGHT;
inputCodeMap["KEY_UP"] = KEY_UP;
inputCodeMap["KEY_DOWN"] = KEY_DOWN;
inputCodeMap["KEY_SPACE"] = KEY_SPACE;
inputCodeMap["KEY_LCONTROL"] = KEY_LCONTROL;
inputCodeMap["KEY_RCONTROL"] = KEY_RCONTROL;
inputCodeMap["KEY_LSHIFT"] = KEY_LSHIFT;
inputCodeMap["KEY_RSHIFT"] = KEY_RSHIFT;
inputCodeMap["KEY_LMETA"] = KEY_LMETA;
inputCodeMap["KEY_RMETA"] = KEY_RMETA;
inputCodeMap["KEY_LALT"] = KEY_LALT;
inputCodeMap["KEY_RALT"] = KEY_RALT;
inputCodeMap["KEY_RETURN"] = KEY_RETURN;
inputCodeMap["KEY_TAB"] = KEY_TAB;
inputCodeMap["KEY_ESCAPE"] = KEY_ESCAPE;
inputCodeMap["MOUSE_BUTTON_LEFT"] = ActionMapper::MOUSE_BUTTON_LEFT;
inputCodeMap["MOUSE_BUTTON_RIGHT"] = ActionMapper::MOUSE_BUTTON_RIGHT;
inputCodeMap["MOUSE_BUTTON_MIDDLE"] = ActionMapper::MOUSE_BUTTON_MIDDLE;
for (int i = 0; i < 17; i++)
{
std::ostringstream os;
os << "JOY_BUTTON_" << i;
inputCodeMap[os.str()] = ActionMapper::JOY1_BUTTON_0+i;
}
}
void clearInputCodeMap()
{
inputCodeMap.clear();
}
std::string getInputCodeToString(int key)
{
for (InputCodeMap::iterator i = inputCodeMap.begin(); i != inputCodeMap.end(); i++)
{
if ((*i).second == key)
{
return (*i).first;
}
}
return "";
}
// FIXME: Move stringbank to BBGE and move these strings into it. -- fg
std::string getInputCodeToUserString(int key)
{
for (InputCodeMap::iterator i = inputCodeMap.begin(); i != inputCodeMap.end(); i++)
{
if ((*i).second == key)
{
std::string use = (*i).first;
size_t idx = 0;
idx = use.find("KEY_");
if (idx != std::string::npos)
{
use = use.substr(4, use.size());
}
if (use == "MOUSE_BUTTON_LEFT")
use = "Left Mouse Button";
if (use == "MOUSE_BUTTON_RIGHT")
use = "Right Mouse Button";
if (use == "MOUSE_BUTTON_MIDDLE")
use = "Middle Mouse Button";
return use;
}
}
return "";
}
int getStringToInputCode(const std::string &string)
{
return inputCodeMap[string];
}