Compare commits
10 Commits
e63456f7fe
...
e5de3ba244
Author | SHA1 | Date |
---|---|---|
Martin Felis | e5de3ba244 | |
Martin Felis | 40a11244dd | |
Martin Felis | 5f862e092a | |
Martin Felis | 600c80fffa | |
Martin Felis (berta win) | 853d691658 | |
martin | e3733a7b0b | |
Martin Felis | 10701d787c | |
Martin Felis (berta win) | ef942fe580 | |
Martin Felis (berta win) | c2ca0a1a4d | |
Martin Felis (schakeline) | b5c4ef359f |
|
@ -1,6 +1,8 @@
|
|||
syntax:glob
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CPackConfig.cmake
|
||||
CPackSourceConfig.cmake
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
debug
|
||||
|
|
|
@ -10,6 +10,9 @@ SET (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
|||
SET (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
FIND_PACKAGE (SDL REQUIRED)
|
||||
FIND_PACKAGE (SDL_net REQUIRED)
|
||||
|
||||
INCLUDE_DIRECTORIES (
|
||||
engine/
|
||||
asteroids/
|
||||
|
@ -54,6 +57,11 @@ SET ( ASTEROIDSEDITOR_SOURCES
|
|||
asteroids/View.cc
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES (
|
||||
${SDLMIXER_INCLUDE_DIRS}
|
||||
${SDLNET_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE ( fysxasteroids ${ASTEROIDS_SOURCES} )
|
||||
ADD_EXECUTABLE ( fysxasteroidseditor ${ASTEROIDSEDITOR_SOURCES} )
|
||||
|
||||
|
@ -106,33 +114,40 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A fun and good looking clone of the popul
|
|||
SET(CPACK_PACKAGE_VENDOR "Martin Felis <martin@fysx.org>")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.txt")
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR "9")
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH "1")
|
||||
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR "0")
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH "0")
|
||||
# SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
|
||||
SET(CPACK_PACKAGE_CONTACT "Martin Felis <martin@fysx.org>")
|
||||
|
||||
# Add defines for the version
|
||||
SET (VERSION_STRING
|
||||
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||
ADD_DEFINITIONS(-DFYSXASTEROIDS_VERSION=\"${VERSION_STRING}\")
|
||||
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
# There is a bug in NSI that does not handle full unix paths properly. Make
|
||||
# sure there is at least one set of four (4) backlasshes.
|
||||
SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
|
||||
SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/data/textures\\\\icon.bmp")
|
||||
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\fysxasteroids.exe")
|
||||
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} fysxdotorg")
|
||||
SET(CPACK_NSIS_DISPLAY_NAME "fysxasteroids")
|
||||
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.fysx.org")
|
||||
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.fysx.org")
|
||||
SET(CPACK_NSIS_CONTACT "martin@fysx.org")
|
||||
SET(CPACK_NSIS_MODIFY_PATH ON)
|
||||
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "/fysxdotorg")
|
||||
ELSE(WIN32 AND NOT UNIX)
|
||||
# Debian stuff
|
||||
SET(CPACK_GENERATOR "DEB")
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Martin Felis <martin@fysx.org>")
|
||||
# Debian stuff
|
||||
SET(CPACK_GENERATOR "DEB")
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Martin Felis <martin@fysx.org>")
|
||||
SET(CPACK_STRIP_FILES "bin/fysxasteroids" "bin/fysxasteroidseditor")
|
||||
SET(CPACK_SOURCE_STRIP_FILES "TRUE")
|
||||
SET(CPACK_DEBIAN_PACKAGE_SECTION "Games and Amusement")
|
||||
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-filesystem1.42.0 (>= 1.42.0-1), libboost-system1.42.0 (>= 1.42.0-1), libc6 (>= 2.4), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libglu1-mesa | libglu1, libice6 (>= 1:1.0.0), libpng12-0 (>= 1.2.13-4), libsdl-net1.2 (>= 1.2.7), libsdl-mixer1.2 (>= 1.2.6), libsdl1.2debian (>= 1.2.10-1), libsm6, libstdc++6 (>= 4.4.0), libx11-6, libxext6, zlib1g (>= 1:1.1.4)")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS
|
||||
"libboost-filesystem1.40.0 (>= 1.40.0-1), libboost-system1.40.0 (>= 1.40.0-1), libc6 (>= 2.4), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libglu1-mesa | libglu1, libice6 (>= 1:1.0.0), libpng12-0 (>= 1.2.13-4), libsdl-net1.2 (>= 1.2.7), libsdl-mixer1.2 (>= 1.2.6), libsdl1.2debian (>= 1.2.10-1), libsm6, libstdc++6 (>= 4.4.0), libx11-6, libxext6, zlib1g (>= 1:1.1.4)"
|
||||
)
|
||||
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
SET(CPACK_PACKAGE_EXECUTABLES "fysxasteroids" "fysxasteroidseditor")
|
||||
|
||||
INCLUDE ( CPack )
|
||||
|
|
|
@ -38,9 +38,7 @@ void Controller::ResetPlayerEntity () {
|
|||
Engine::EntityBase *player_entity = GetModel()->GetEntity(GetModel()->GetPlayerEntityId());
|
||||
player_entity->mPhysicState->mAngleVelocity = 0.;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < EntityControllerMaxKeyStates; i++)
|
||||
player_entity->UnsetControllerKeyState(i);
|
||||
player_entity->ResetControllerKeyState();
|
||||
}
|
||||
|
||||
// We definitely have to reset the player entity id
|
||||
|
|
|
@ -52,7 +52,7 @@ int Model::OnInit (int argc, char* argv[]) {
|
|||
mLevelHashes["level06_WolleNew3_watch_your.map"] = "e5e86667623b12a491a2395a9b361617ee961edf8d349b7419942f0dbf76b769";
|
||||
mLevelHashes["level07_circled.map"] = "98aa36bf2c8f6be8cd23c7c284d6ff413db992f09e5d5866e5a3aa393a93b367";
|
||||
mLevelHashes["level08_highway.map"] = "bf5e678750d3f4d47c7bfec5ae62d852db1f475146ef013040d1e67308708a66";
|
||||
mLevelHashes["level09_WolleNew4_wheres_the_brain.map"] = "f3f685f6eb6cc703a5eaa0177472717ea49dddc2099e2bd1865f551f94e8fdf4";
|
||||
mLevelHashes["level09_WolleNew4_wheres_the_brain.map"] = "94af432a967ed68389a41c2907b3500de9b6a8744816c025a7269ff2ef0509c9";
|
||||
mLevelHashes["level10_WolleWhatever_whatever.map"] = "2f97984e86bd0969909032fa44bcf883dd181fbe61782ee7dd704b0b63dfd0e1";
|
||||
mLevelHashes["level11_Strahlensatz.map"] = "3f293d4b0ea23688c15761a54b2ee097cc6a41b30750cc8fc5fccf94c20bf018";
|
||||
mLevelHashes["level12_almost_there_test5.map"] = "5cefdc7dadbbfc30f32580f3e50cfbb6cae9ca5f432fd73e777bdbb835f3660a";
|
||||
|
@ -61,7 +61,7 @@ int Model::OnInit (int argc, char* argv[]) {
|
|||
mLevelHashes["level15_WolleNew6_smack_my.map"] = "1d7e1223bbd8a68492108c2416c1a8ba828d293601c02e489dbf6b5db6a1aaa2";
|
||||
mLevelHashes["level16_Wolle7_todesspirale.map"] = "d82d8f6c21806238a7b6a87c1217a0dff42f4e59e73f28e7af3f0c8afd908e38";
|
||||
mLevelHashes["level17_WolleEasyNew1_twin_supernova.map"] = "4e177f82a0ba8f909ff1af1adf13caf82ab41cf09d69504c87f3e0551b9b73ed";
|
||||
mLevelHashes["level18_WolleNew2_dont_drink.map"] = "3b7b0fa59ee652e763ea43ffd7e572e1bd0436116fd5d5b13ed679fce362d265";
|
||||
mLevelHashes["level18_WolleNew2_dont_drink.map"] = "09c32e7bc6bc3c8ef7bd96b0f60094dd46276227d653abfa3c300687d31776fd";
|
||||
mLevelHashes["level19_Geisterfahrer.map"] = "2036741d6fd4a863324210e53b903d7a898c4478e5eb9607a43a110bb6999ace";
|
||||
mLevelHashes["level20_billiard.map"] = "23dcffbf61bd887db7613b02d0c9ad04d77d800af631edbcf5822a169dcc2a9d";
|
||||
mLevelHashes["level21_final.map"] = "6384b1565c0c844d7083e744d6cfbaf9de42f5ad5ecb0cb668c3a2458860c8ac";
|
||||
|
@ -160,19 +160,20 @@ void Model::Process () {
|
|||
}
|
||||
|
||||
unsigned int Model::InitLevelList () {
|
||||
boost::filesystem::path level_dir_path;
|
||||
std::string level_dir_name = Engine::GetResourceFullPath("/data/levels/");
|
||||
Engine::LogDebug ("Searching for levels in %s", level_dir_name.c_str());
|
||||
|
||||
mLevelList.clear();
|
||||
|
||||
boost::filesystem::path level_dir(level_dir_name);
|
||||
|
||||
if (!boost::filesystem::exists(level_dir)) {
|
||||
Engine::LogError ("Could not init level list: \todo %s does not exist!");
|
||||
|
||||
if (!boost::filesystem::exists(level_dir.string())) {
|
||||
Engine::LogError ("Could not init level list: %s does not exist!", level_dir.filename().c_str());
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_directory(level_dir)) {
|
||||
Engine::LogError ("Could not init level list: \todo %s is not a directory!");
|
||||
Engine::LogError ("Could not init level list: %s is not a directory!", level_dir_name.c_str());
|
||||
}
|
||||
|
||||
boost::filesystem::directory_iterator end_iter;
|
||||
|
@ -181,11 +182,11 @@ unsigned int Model::InitLevelList () {
|
|||
++dir_iter) {
|
||||
if (boost::filesystem::is_regular_file (dir_iter->status())) {
|
||||
std::string level_relative_path (level_dir_name);
|
||||
level_relative_path += dir_iter->path().filename();
|
||||
level_relative_path += dir_iter->path().filename().string();
|
||||
|
||||
// check whether we found an official level
|
||||
std::string map_name (level_relative_path);
|
||||
map_name = map_name.substr(map_name.rfind ('/') + 1, map_name.size());
|
||||
std::string map_name (dir_iter->path().filename().string());
|
||||
|
||||
if (mLevelHashes.find(map_name) == mLevelHashes.end()) {
|
||||
Engine::LogDebug ("Skipping unofficial level %s", std::string(level_relative_path).c_str());
|
||||
continue;
|
||||
|
@ -559,14 +560,14 @@ void Model::SubmitHighscoreEntry (const std::string &name, const unsigned int po
|
|||
int Model::DoLoadLevel (const char* filename) {
|
||||
// verify the hash of the map
|
||||
std::string map_name (filename);
|
||||
map_name = map_name.substr(map_name.rfind ('/') + 1, map_name.size());
|
||||
map_name = boost::filesystem::path(map_name).filename().string();
|
||||
std::string map_hash = sha256_hash_file (filename);
|
||||
if (map_hash != mLevelHashes[map_name]) {
|
||||
Engine::LogMessage ("Map verification for file %s failed!", map_name.c_str());
|
||||
mGameModified = true;
|
||||
mCurrentLevelModified = true;
|
||||
}
|
||||
Engine::LogDebug ("Verification for level %s OK: loading level.");
|
||||
Engine::LogDebug ("Verification for level %s OK: loading level.", map_name.c_str());
|
||||
|
||||
std::fstream level_file (filename, std::ios::in);
|
||||
|
||||
|
|
|
@ -491,10 +491,15 @@ void View::DrawUiMainMenu() {
|
|||
DrawPageTitle ("Asteroids");
|
||||
|
||||
SelectFont("console.ttf size=23 color=#444444");
|
||||
DrawGLString( screen_right - 272, screen_bottom - 16, "http://www.fysx.org");
|
||||
DrawGLString( screen_right - 272, screen_bottom - 6, "http://www.fysx.org");
|
||||
SelectFont("console.ttf size=23 color=#cccccc");
|
||||
DrawGLString( screen_right - 270, screen_bottom - 18, "http://www.fysx.org");
|
||||
|
||||
DrawGLString( screen_right - 270, screen_bottom - 8, "http://www.fysx.org");
|
||||
|
||||
SelectFont("console.ttf size=23 color=#444444");
|
||||
DrawGLString( 8, screen_bottom - 6, FYSXASTEROIDS_VERSION);
|
||||
SelectFont("console.ttf size=23 color=#cccccc");
|
||||
DrawGLString( 6, screen_bottom - 8, FYSXASTEROIDS_VERSION);
|
||||
|
||||
SelectFont("console.ttf size=23");
|
||||
if (Engine::GUI::Button (1, "New Game", screen_right * 0.5 - 100, 200, button_width, button_height)) {
|
||||
PushViewState(ViewStateEnterPlayername);
|
||||
|
|
|
@ -116,10 +116,17 @@ int main (int argc, char* argv[]) {
|
|||
|
||||
SetLogPrintLevel (Engine::LogLevelWarning);
|
||||
|
||||
std::string user_path = ".";
|
||||
std::string game_data_path = ".";
|
||||
// find the path for game data and user data
|
||||
std::string user_path = "";
|
||||
std::string game_data_path = "";
|
||||
|
||||
// use the current path as default
|
||||
boost::filesystem::path cpath = boost::filesystem::initial_path<boost::filesystem::path>();
|
||||
user_path = boost::filesystem::path(cpath.string() + user_path).string();
|
||||
game_data_path = boost::filesystem::path(cpath.string() + game_data_path).string();
|
||||
|
||||
#ifndef WIN32
|
||||
// on linux et al we check more thoroughly at the possible directories
|
||||
user_path = create_user_path();
|
||||
game_data_path = find_game_data_dir();
|
||||
#endif
|
||||
|
@ -128,15 +135,17 @@ int main (int argc, char* argv[]) {
|
|||
std::string log_file_path = user_path;
|
||||
log_file_path += "/game.log";
|
||||
|
||||
log_file_path = boost::filesystem::path (log_file_path).string();
|
||||
|
||||
cout << "User Data Dir = " << user_path << endl;
|
||||
engine.SetUserDataPath (user_path);
|
||||
|
||||
Engine::SetLogFilename (log_file_path.c_str());
|
||||
Engine::SetLogFilename (log_file_path);
|
||||
|
||||
engine.SetGameDataPath (game_data_path);
|
||||
cout << "Game Data Dir = " << game_data_path << endl;
|
||||
|
||||
if (engine.Init (argc, argv) != 0) {
|
||||
if (engine.Init (argc, argv) != 0) {
|
||||
cout << "Could not start engine!" << endl;
|
||||
exit (-1);
|
||||
}
|
||||
|
@ -150,7 +159,9 @@ int main (int argc, char* argv[]) {
|
|||
else
|
||||
SDL_WM_SetIcon(image,NULL);
|
||||
|
||||
SDL_WM_SetCaption("fysxasteroids -RC2-","fysxasteroids -RC2-");
|
||||
std::string version_string = "fysxasteroids ";
|
||||
version_string += FYSXASTEROIDS_VERSION;
|
||||
SDL_WM_SetCaption(version_string.c_str(), version_string.c_str());
|
||||
|
||||
engine.GetView()->SetGridSize (8,8);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Format
|
||||
# <Type> <player?> <xpos> <ypos> <zpos> <zrot> <yrot> <xrot> <xvel> <yvel> <zvel> <rotvel>
|
||||
Title Where's the brain?
|
||||
Author SirRandom
|
||||
Title A little step for humankind
|
||||
Author SirArmstrong
|
||||
ParTime 20
|
||||
GameEntityTypeShip 1 0.253333 0 -1.14 0 90 0 0 0 0 0
|
||||
GameEntityTypeAsteroid 0 -10.45 0 -5.47833 0 0 0 4.05333 0 1.77333 31.3935
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Format
|
||||
# <Type> <player?> <xpos> <ypos> <zpos> <zrot> <yrot> <xrot> <xvel> <yvel> <zvel> <rotvel>
|
||||
Title Don't drink and orbit alien pla
|
||||
Title Don't drink and orbit alien planets
|
||||
Author SirUnseen
|
||||
ParTime 31
|
||||
GameEntityTypeShip 1 10.3867 0 -7.63167 0 38.6598 0 7.41 0 -3.95833 0
|
||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@ FIND_PACKAGE (SDL_net REQUIRED)
|
|||
FIND_PACKAGE (OpenGL REQUIRED)
|
||||
FIND_PACKAGE (PNG REQUIRED)
|
||||
FIND_PACKAGE (FreeType2 REQUIRED)
|
||||
FIND_PACKAGE (Boost COMPONENTS filesystem REQUIRED)
|
||||
FIND_PACKAGE (Boost COMPONENTS filesystem system REQUIRED)
|
||||
|
||||
ADD_SUBDIRECTORY ( libraries )
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <bitset>
|
||||
#include <limits>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "Module.h"
|
||||
#include "EngineEnums.h"
|
||||
#include "Utils.h"
|
||||
|
@ -115,13 +117,13 @@ class Engine : public Module {
|
|||
* \brief it
|
||||
*/
|
||||
std::string GetResourceFullPath (const std::string &resource) {
|
||||
return mGameDataPath + resource;
|
||||
return boost::filesystem::path(mGameDataPath + resource).string();
|
||||
};
|
||||
|
||||
/** \brief Returns the path to a file by prepending the user data path to it
|
||||
*/
|
||||
std::string GetUserDirFullPath (const std::string &path) {
|
||||
return mUserDataPath + path;
|
||||
return boost::filesystem::path(mUserDataPath + path).string();
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -13,17 +13,22 @@ bool EntityControllerState::GetKey (int state) {
|
|||
void EntityControllerState::SetKey (int state) {
|
||||
assert (state < EntityControllerMaxKeyStates && state >= 0);
|
||||
|
||||
LogDebug ("Setting Entity Key State %d", state);
|
||||
LogDebug ("Entity %d: Setting Entity Key State %d", mId, state);
|
||||
mKeyState.set (state);
|
||||
}
|
||||
|
||||
void EntityControllerState::UnsetKey (int state) {
|
||||
assert (state < EntityControllerMaxKeyStates && state >= 0);
|
||||
|
||||
LogDebug ("Unsetting Entity Key State %d", state);
|
||||
LogDebug ("Entity %d: Unsetting Entity Key State %d", mId, state);
|
||||
mKeyState.reset (state);
|
||||
}
|
||||
|
||||
void EntityControllerState::Reset () {
|
||||
LogDebug ("Entity %d: Resetting all key states", mId);
|
||||
mKeyState.reset ();
|
||||
}
|
||||
|
||||
void EntityBase::SetControllerKeyState (int state) {
|
||||
if (!mControllerState) {
|
||||
LogError ("Error when trying to send a KeyState to an Entity that has no EntityControllerState!");
|
||||
|
@ -40,4 +45,13 @@ void EntityBase::UnsetControllerKeyState (int state) {
|
|||
mControllerState->UnsetKey (state);
|
||||
}
|
||||
|
||||
void EntityBase::ResetControllerKeyState () {
|
||||
if (!mControllerState) {
|
||||
LogError ("Error when trying to send a KeyState to an Entity that has no EntityControllerState!");
|
||||
}
|
||||
|
||||
LogDebug ("Entity %d: Resetting key states", mId);
|
||||
mControllerState->Reset ();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,11 +100,14 @@ struct EntityPhysicState {
|
|||
* \todo [Low] The current design is very unflexible. Is there a better way?
|
||||
*/
|
||||
struct EntityControllerState {
|
||||
unsigned int mId;
|
||||
|
||||
std::bitset<EntityControllerMaxKeyStates> mKeyState;
|
||||
|
||||
bool GetKey (int state);
|
||||
void SetKey (int state);
|
||||
void UnsetKey (int state);
|
||||
void Reset ();
|
||||
};
|
||||
|
||||
/** \brief Represents the base of everything that exists in the engine
|
||||
|
@ -131,6 +134,8 @@ struct EntityBase {
|
|||
virtual void SetControllerKeyState (int state);
|
||||
/** \brief Removes the given state to the current movement state of the Entity */
|
||||
virtual void UnsetControllerKeyState (int state);
|
||||
/** \brief Resets all keys (i.e. no keys are pressed) */
|
||||
virtual void ResetControllerKeyState ();
|
||||
|
||||
/** \brief Helper function to set the id to all substates */
|
||||
void SetId (unsigned int id) {
|
||||
|
@ -138,6 +143,8 @@ struct EntityBase {
|
|||
|
||||
if (mPhysicState)
|
||||
mPhysicState->mId = id;
|
||||
if (mControllerState)
|
||||
mControllerState->mId = id;
|
||||
}
|
||||
|
||||
/** Executes game logic for the collision event
|
||||
|
|
|
@ -33,8 +33,8 @@ bool regionhit (int x, int y, int w, int h) {
|
|||
}
|
||||
|
||||
void DrawBlock (int x, int y, int w, int h) {
|
||||
const float shading_dark = 0.5;
|
||||
const float shading_light = 1.3;
|
||||
const float shading_dark = 0.5f;
|
||||
const float shading_light = 1.3f;
|
||||
|
||||
float color[4];
|
||||
glGetFloatv (GL_CURRENT_COLOR, color);
|
||||
|
@ -42,10 +42,10 @@ void DrawBlock (int x, int y, int w, int h) {
|
|||
glBegin(GL_QUADS);
|
||||
|
||||
// middle part
|
||||
glVertex3f (x, y, 0.);
|
||||
glVertex3f (x, y + h, 0.);
|
||||
glVertex3f (x + w, y + h, 0.);
|
||||
glVertex3f (x + w, y, 0.);
|
||||
glVertex3i (x, y, 0);
|
||||
glVertex3i (x, y + h, 0);
|
||||
glVertex3i (x + w, y + h, 0);
|
||||
glVertex3i (x + w, y, 0);
|
||||
|
||||
glEnd();
|
||||
|
||||
|
@ -56,38 +56,38 @@ void DrawBlock (int x, int y, int w, int h) {
|
|||
glColor3f (color[0] * shading_dark, color[1] * shading_dark, color[2] * shading_dark);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3f (x,y + 2, 0.);
|
||||
glVertex3f (x,y +h, 0.);
|
||||
glVertex3f (x + w - 2, y + h, 0.);
|
||||
glVertex3i (x, y + 2, 0);
|
||||
glVertex3i (x, y + h, 0);
|
||||
glVertex3i (x + w - 2, y + h, 0);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void DrawRoundedBlock (int x, int y, int w, int h) {
|
||||
const int d = 16;
|
||||
const float shading_dark = 0.5;
|
||||
const float shading_light = 1.3;
|
||||
const float shading_dark = 0.5f;
|
||||
const float shading_light = 1.3f;
|
||||
|
||||
assert (h > d);
|
||||
assert (w > d);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
// lower part
|
||||
glVertex3f (x, y, 0.);
|
||||
glVertex3f (x, y + d, 0.);
|
||||
glVertex3f (x + w, y + d, 0.);
|
||||
glVertex3f (x + w - d, y, 0.);
|
||||
glVertex3i (x, y, 0);
|
||||
glVertex3i (x, y + d, 0);
|
||||
glVertex3i (x + w, y + d, 0);
|
||||
glVertex3i (x + w - d, y, 0);
|
||||
|
||||
// middle part
|
||||
glVertex3f (x, y + d, 0.);
|
||||
glVertex3f (x, y + d + h - 2 * d, 0.);
|
||||
glVertex3f (x + w, y + d + h - 2 * d, 0.);
|
||||
glVertex3f (x + w, y + d, 0.);
|
||||
glVertex3i (x, y + d, 0);
|
||||
glVertex3i (x, y + d + h - 2 * d, 0);
|
||||
glVertex3i (x + w, y + d + h - 2 * d, 0);
|
||||
glVertex3i (x + w, y + d, 0);
|
||||
|
||||
// bottom part
|
||||
glVertex3f (x, y + h - d, 0.);
|
||||
glVertex3f (x + d, y + h, 0.);
|
||||
glVertex3f (x + w, y + h, 0.);
|
||||
glVertex3f (x + w, y + h - d, 0.);
|
||||
glVertex3i (x, y + h - d, 0);
|
||||
glVertex3i (x + d, y + h, 0);
|
||||
glVertex3i (x + w, y + h, 0);
|
||||
glVertex3i (x + w, y + h - d, 0);
|
||||
|
||||
glEnd();
|
||||
|
||||
|
@ -99,16 +99,16 @@ void DrawRoundedBlock (int x, int y, int w, int h) {
|
|||
glColor3f (color[0] * shading_dark, color[1] * shading_dark, color[2] * shading_dark);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3f (x,y + 2, 0.);
|
||||
glVertex3f (x,y + h -d, 0.);
|
||||
glVertex3f (x + d, y + h, 0.);
|
||||
glVertex3f (x + w - 2, y + h, 0.);
|
||||
glVertex3i (x,y + 2, 0);
|
||||
glVertex3i (x,y + h - d, 0);
|
||||
glVertex3i (x + d, y + h, 0);
|
||||
glVertex3i (x + w - 2, y + h, 0);
|
||||
glEnd();
|
||||
|
||||
glColor3f (color[0] * shading_light, color[1] * shading_light, color[2] * shading_light);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3f (x + w - d, y, 0.);
|
||||
glVertex3f (x + w, y + d, 0.);
|
||||
glVertex3i (x + w - d, y, 0);
|
||||
glVertex3i (x + w, y + d, 0);
|
||||
glEnd();
|
||||
|
||||
glColor4fv (color);
|
||||
|
@ -137,12 +137,12 @@ void Label (int id, const char* caption, int x, int y) {
|
|||
// we shift the gray a little left and up depending on the font size
|
||||
font_spec << "console.ttf size=" << font_size << " color=#808080";
|
||||
SelectFont(font_spec.str().c_str());
|
||||
view->DrawGLString(x - font_size / 20.f , y + height * 0.5 + font_size / 20.f, caption);
|
||||
view->DrawGLString(x - font_size / 20.f , y + height * 0.5f + font_size / 20.f, caption);
|
||||
|
||||
font_spec.str("");
|
||||
font_spec << "console.ttf size=" << font_size << " color=#ffffff";
|
||||
SelectFont(font_spec.str().c_str());
|
||||
view->DrawGLString(x , y + height * 0.5, caption);
|
||||
view->DrawGLString(x , y + height * 0.5f, caption);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,12 +171,12 @@ void LabelCentered (int id, const char* caption, int x, int y) {
|
|||
// we shift the gray a little left and up depending on the font size
|
||||
font_spec << "console.ttf size=" << font_size << " color=#808080";
|
||||
SelectFont(font_spec.str().c_str());
|
||||
view->DrawGLString(x - 0.5 * width - font_size / 20.f , y + height * 0.5 + font_size / 20.f, caption);
|
||||
view->DrawGLString(x - 0.5f * width - font_size / 20.f , y + height * 0.5f + font_size / 20.f, caption);
|
||||
|
||||
font_spec.str("");
|
||||
font_spec << "console.ttf size=" << font_size << " color=#ffffff";
|
||||
SelectFont(font_spec.str().c_str());
|
||||
view->DrawGLString(x - 0.5 * width, y + height * 0.5, caption);
|
||||
view->DrawGLString(x - 0.5f * width, y + height * 0.5f, caption);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,20 +213,20 @@ bool Button (int id, const char* caption, int x, int y, int w, int h) {
|
|||
}
|
||||
|
||||
// Render
|
||||
glColor3f (0.2, 0.2, 0.2);
|
||||
glColor3f (0.2f, 0.2f, 0.2f);
|
||||
// DrawRoundedBlock (x + 4, y + 4, w, h);
|
||||
|
||||
if (controller->uistate.hotitem == id
|
||||
|| controller->uistate.kbditem == id) {
|
||||
if (controller->uistate.activeitem == id) {
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glColor3f (0.8f, 0.8f, 0.8f);
|
||||
DrawRoundedBlock (x, y, w, h);
|
||||
} else {
|
||||
glColor3f (0.7, 0.7, 0.7);
|
||||
glColor3f (0.7f, 0.7f, 0.7f);
|
||||
DrawRoundedBlock (x, y, w, h);
|
||||
}
|
||||
} else {
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
glColor3f (0.4f, 0.4f, 0.4f);
|
||||
DrawRoundedBlock (x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -240,18 +240,18 @@ bool Button (int id, const char* caption, int x, int y, int w, int h) {
|
|||
SelectFont("console.ttf size=23");
|
||||
view->DrawGLStringMeasure(caption, &width, &height);
|
||||
|
||||
float xpos = x + w * 0.5 - width * 0.5;
|
||||
float ypos = y + h * 0.5 - height * 0.5;
|
||||
float xpos = x + w * 0.5f - width * 0.5f;
|
||||
float ypos = y + h * 0.5f - height * 0.5f;
|
||||
// LogDebug ("measure '%s' width = %f height = %f", caption, width, height);
|
||||
|
||||
if (controller->uistate.hotitem == id || controller->uistate.kbditem == id) {
|
||||
SelectFont("console.ttf size=23 color=#666666");
|
||||
view->DrawGLString( xpos - 2., ypos + 2., caption);
|
||||
view->DrawGLString( xpos - 2.f, ypos + 2.f, caption);
|
||||
SelectFont("console.ttf size=23 color=#ffffff");
|
||||
view->DrawGLString( xpos, ypos, caption);
|
||||
} else {
|
||||
SelectFont("console.ttf size=23 color=#4d4d4d");
|
||||
view->DrawGLString( xpos - 2., ypos + 2., caption);
|
||||
SelectFont("console.ttf size=23 color=#444444");
|
||||
view->DrawGLString( xpos - 2.f, ypos + 2.f, caption);
|
||||
SelectFont("console.ttf size=23 color=#b3b3b3");
|
||||
view->DrawGLString( xpos, ypos, caption);
|
||||
}
|
||||
|
@ -331,23 +331,23 @@ bool CheckButton (int id, const char* caption, bool checked, int x, int y, int w
|
|||
|
||||
// Render
|
||||
if (checked) {
|
||||
glColor3f (0.91, 0.84, 0.);
|
||||
glColor3f (0.91f, 0.84f, 0.);
|
||||
DrawRoundedBlock (x - 2, y - 2, w + 4, h + 4);
|
||||
}
|
||||
|
||||
glColor3f (0.2, 0.2, 0.2);
|
||||
glColor3f (0.2f, 0.2f, 0.2f);
|
||||
|
||||
if (controller->uistate.hotitem == id
|
||||
|| controller->uistate.kbditem == id) {
|
||||
if (controller->uistate.activeitem == id) {
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glColor3f (0.8f, 0.8f, 0.8f);
|
||||
DrawRoundedBlock (x, y, w, h);
|
||||
} else {
|
||||
glColor3f (0.7, 0.7, 0.7);
|
||||
glColor3f (0.7f, 0.7f, 0.7f);
|
||||
DrawRoundedBlock (x, y, w, h);
|
||||
}
|
||||
} else {
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
glColor3f (0.4f, 0.4f, 0.4f);
|
||||
DrawRoundedBlock (x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -361,18 +361,18 @@ bool CheckButton (int id, const char* caption, bool checked, int x, int y, int w
|
|||
SelectFont("console.ttf size=23");
|
||||
view->DrawGLStringMeasure(caption, &width, &height);
|
||||
|
||||
float xpos = x + w * 0.5 - width * 0.5;
|
||||
float ypos = y + h * 0.5 - height * 0.5;
|
||||
float xpos = x + w * 0.5f - width * 0.5f;
|
||||
float ypos = y + h * 0.5f - height * 0.5f;
|
||||
// LogDebug ("measure '%s' width = %f height = %f", caption, width, height);
|
||||
|
||||
if (controller->uistate.hotitem == id || controller->uistate.kbditem == id) {
|
||||
SelectFont("console.ttf size=23 color=#666666");
|
||||
view->DrawGLString( xpos - 2., ypos + 2., caption);
|
||||
view->DrawGLString( xpos - 2.f, ypos + 2.f, caption);
|
||||
SelectFont("console.ttf size=23 color=#ffffff");
|
||||
view->DrawGLString( xpos, ypos, caption);
|
||||
} else {
|
||||
SelectFont("console.ttf size=23 color=#4d4d4d");
|
||||
view->DrawGLString( xpos - 2., ypos + 2., caption);
|
||||
SelectFont("console.ttf size=23 color=#444444");
|
||||
view->DrawGLString( xpos - 2.f, ypos + 2.f, caption);
|
||||
SelectFont("console.ttf size=23 color=#b3b3b3");
|
||||
view->DrawGLString( xpos, ypos, caption);
|
||||
}
|
||||
|
@ -465,14 +465,14 @@ bool LineEdit (int id, int x, int y, std::string &text_value, const int &maxleng
|
|||
// If we have keyboard focus, we highlight the widget
|
||||
if ( controller->uistate.kbditem == id) {
|
||||
if (controller->uistate.activeitem == id) {
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glColor3f (0.8f, 0.8f, 0.8f);
|
||||
DrawBlock (x, y, w, h);
|
||||
} else {
|
||||
glColor3f (0.7, 0.7, 0.7);
|
||||
glColor3f (0.7f, 0.7f, 0.7f);
|
||||
DrawBlock (x, y, w, h);
|
||||
}
|
||||
} else {
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
glColor3f (0.4f, 0.4f, 0.4f);
|
||||
DrawBlock (x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ bool LineEdit (int id, int x, int y, std::string &text_value, const int &maxleng
|
|||
view = EngineGetView ();
|
||||
assert (view);
|
||||
|
||||
glColor3f (1., 1., 1.);
|
||||
glColor3f (1.f, 1.f, 1.f);
|
||||
|
||||
std::string text_output = text_value;
|
||||
|
||||
|
@ -605,14 +605,14 @@ bool LineEditMasked (int id, int x, int y, std::string &text_value, const int &m
|
|||
// If we have keyboard focus, we highlight the widget
|
||||
if ( controller->uistate.kbditem == id) {
|
||||
if (controller->uistate.activeitem == id) {
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glColor3f (0.8f, 0.8f, 0.8f);
|
||||
DrawBlock (x, y, w, h);
|
||||
} else {
|
||||
glColor3f (0.7, 0.7, 0.7);
|
||||
glColor3f (0.7f, 0.7f, 0.7f);
|
||||
DrawBlock (x, y, w, h);
|
||||
}
|
||||
} else {
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
glColor3f (0.4f, 0.4f, 0.4f);
|
||||
DrawBlock (x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ bool LineEditMasked (int id, int x, int y, std::string &text_value, const int &m
|
|||
view = EngineGetView ();
|
||||
assert (view);
|
||||
|
||||
glColor3f (1., 1., 1.);
|
||||
glColor3f (1.f, 1.f, 1.f);
|
||||
|
||||
std::string text_output = text_value;
|
||||
|
||||
|
@ -725,7 +725,7 @@ float VerticalSlider (int id, int x, int y, int w, int h, float min_value, float
|
|||
int slider_pos = (w * value) / max_value - knob_width / 2;
|
||||
|
||||
// Check for hotness
|
||||
if (regionhit (x, y + h * 0.5 - knob_height * 0.5, w, knob_height)) {
|
||||
if (regionhit (x, y + h * 0.5f - knob_height * 0.5f, w, knob_height)) {
|
||||
controller->uistate.hotitem = id;
|
||||
if (controller->uistate.activeitem == 0
|
||||
&& controller->GetButtonState(MouseButtonLeft)) {
|
||||
|
@ -746,21 +746,21 @@ float VerticalSlider (int id, int x, int y, int w, int h, float min_value, float
|
|||
// If we have keyboard focus, we highlight the widget
|
||||
if ( controller->uistate.kbditem == id) {
|
||||
if (controller->uistate.activeitem == id) {
|
||||
glColor3f (0.6, 0.6, 0.6);
|
||||
glColor3f (0.6f, 0.6f, 0.6f);
|
||||
DrawBlock (x, y, w, h);
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
DrawBlock (x + slider_pos, y + h * 0.5 - knob_height * 0.5, knob_width, knob_height);
|
||||
glColor3f (0.8f, 0.8f, 0.8f);
|
||||
DrawBlock (x + slider_pos, y + h * 0.5f - knob_height * 0.5f, knob_width, knob_height);
|
||||
} else {
|
||||
glColor3f (0.6, 0.6, 0.6);
|
||||
glColor3f (0.6f, 0.6f, 0.6f);
|
||||
DrawBlock (x, y, w, h);
|
||||
glColor3f (0.7, 0.7, 0.7);
|
||||
DrawBlock (x + slider_pos, y + h * 0.5 - knob_height * 0.5, knob_width, knob_height);
|
||||
glColor3f (0.7f, 0.7f, 0.7f);
|
||||
DrawBlock (x + slider_pos, y + h * 0.5f - knob_height * 0.5f, knob_width, knob_height);
|
||||
}
|
||||
} else {
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
glColor3f (0.4f, 0.4f, 0.4f);
|
||||
DrawBlock (x, y, w, h);
|
||||
glColor3f (0.5, 0.5, 0.5);
|
||||
DrawBlock (x + slider_pos, y + h * 0.5 - knob_height * 0.5, knob_width, knob_height);
|
||||
glColor3f (0.5f, 0.5f, 0.5f);
|
||||
DrawBlock (x + slider_pos, y + h * 0.5f - knob_height * 0.5f, knob_width, knob_height);
|
||||
}
|
||||
|
||||
if (controller->uistate.kbditem == id) {
|
||||
|
@ -776,14 +776,14 @@ float VerticalSlider (int id, int x, int y, int w, int h, float min_value, float
|
|||
controller->uistate.last_keysym = SDLK_CLEAR;
|
||||
break;
|
||||
case SDLK_LEFT:
|
||||
value -= (max_value - min_value) * 0.1;
|
||||
value -= (max_value - min_value) * 0.1f;
|
||||
if ( value < min_value)
|
||||
value = min_value;
|
||||
controller->uistate.last_keysym = SDLK_CLEAR;
|
||||
return true;
|
||||
break;
|
||||
case SDLK_RIGHT:
|
||||
value += (max_value - min_value) * 0.1;
|
||||
value += (max_value - min_value) * 0.1f;
|
||||
if ( value > max_value)
|
||||
value = max_value;
|
||||
controller->uistate.last_keysym = SDLK_CLEAR;
|
||||
|
@ -831,6 +831,5 @@ bool CheckKeyPressed (int keycode) {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -90,11 +90,11 @@ void Logging::SetLogPrintLevel (LogLevel print_level) {
|
|||
mPrintLevel = print_level;
|
||||
}
|
||||
|
||||
void Logging::SetLogFilename (const char *filename) {
|
||||
mLogFileOut.open (filename, std::ios_base::trunc);
|
||||
void Logging::SetLogFilename (const std::string &filename) {
|
||||
mLogFileOut.open (filename.c_str(), std::ios_base::trunc);
|
||||
|
||||
if (!mLogFileOut) {
|
||||
LogError ("Could not open logfile %s for writing!", filename);
|
||||
LogError ("Could not open logfile %s for writing!", filename.c_str());
|
||||
}
|
||||
|
||||
requested_logfilename = "";
|
||||
|
@ -122,7 +122,7 @@ void SetLogPrintLevel (LogLevel print_level) {
|
|||
LoggingInstance->SetLogPrintLevel (print_level);
|
||||
}
|
||||
|
||||
void SetLogFilename (const char *filename) {
|
||||
void SetLogFilename (const std::string &filename) {
|
||||
if (!LoggingInstance) {
|
||||
requested_logfilename = filename;
|
||||
return;
|
||||
|
|
|
@ -20,7 +20,7 @@ class Logging : public Module {
|
|||
public:
|
||||
void Log (LogLevel level, const char *str, ...);
|
||||
void SetLogPrintLevel (LogLevel print_level);
|
||||
void SetLogFilename (const char *filename);
|
||||
void SetLogFilename (const std::string &filename);
|
||||
/** \brief Returns the last LogEntry that was sent to the Logging module
|
||||
*/
|
||||
const LogEntry& GetLastEntry ();
|
||||
|
|
|
@ -24,7 +24,7 @@ struct LogEntry {
|
|||
/** \brief Sets the level for which messages should be printed out */
|
||||
void SetLogPrintLevel (LogLevel print_level);
|
||||
/** \brief Sets the filename to which all the logging is sent, set to NULL to disable logging */
|
||||
void SetLogFilename (const char *filename);
|
||||
void SetLogFilename (const std::string &filename);
|
||||
|
||||
/** \brief Sends the Message to the Logging system
|
||||
*
|
||||
|
|
|
@ -43,7 +43,8 @@ bool create_dir (const std::string &dir_str) {
|
|||
}
|
||||
|
||||
std::string sha256_hash (std::string input) {
|
||||
char result_buf[64];
|
||||
char result_buf[65];
|
||||
result_buf[64] = '\0';
|
||||
|
||||
SHA256_CTX ctx256;
|
||||
|
||||
|
@ -51,7 +52,7 @@ std::string sha256_hash (std::string input) {
|
|||
SHA256_Update(&ctx256, (unsigned char*) input.c_str(), input.size());
|
||||
SHA256_End (&ctx256, result_buf);
|
||||
|
||||
return std::string (result_buf, 64);
|
||||
return std::string (result_buf);
|
||||
}
|
||||
|
||||
std::string sha256_hash_file (const char *filename) {
|
||||
|
@ -62,7 +63,6 @@ std::string sha256_hash_file (const char *filename) {
|
|||
return "";
|
||||
}
|
||||
|
||||
|
||||
file_stream.seekg (0,std::ios_base::end);
|
||||
std::streampos file_end = file_stream.tellg();
|
||||
|
||||
|
@ -78,7 +78,7 @@ std::string sha256_hash_file (const char *filename) {
|
|||
file_stream.seekg(0, std::ios_base::beg);
|
||||
file_stream.read ((char*)file_buffer, file_size);
|
||||
|
||||
char result_buf[64];
|
||||
char result_buf[65];
|
||||
|
||||
SHA256_CTX ctx256;
|
||||
|
||||
|
@ -90,6 +90,8 @@ std::string sha256_hash_file (const char *filename) {
|
|||
|
||||
delete[] file_buffer;
|
||||
|
||||
result_buf[64] = '\0';
|
||||
|
||||
// std::cerr << "file hash is " << std::string (result_buf, 64) << std::endl;
|
||||
|
||||
return std::string (result_buf, 64);
|
||||
|
|
|
@ -312,7 +312,7 @@ bool ViewBase::LoadFont (const std::string &font_spec_string) {
|
|||
|
||||
OGLFT::Monochrome *font = new OGLFT::Monochrome (font_path.c_str(), font_size);
|
||||
if ( font == 0 || !font->isValid() ) {
|
||||
LogError ("Could not load font %s!", font_path.c_str());
|
||||
LogError ("Could not load font %s! (ptr=%x", font_path.c_str(), (void*)font);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ bool ViewBase::LoadFont (const std::string &font_spec_string) {
|
|||
font->setBackgroundColor(0., 0., 0., 0.);
|
||||
|
||||
mFonts.insert(std::make_pair<std::string, OGLFT::Monochrome*>(font_spec_string, font));
|
||||
|
||||
LogDebug ("Loading font %s successful!", font_name.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -335,9 +335,9 @@ void ViewBase::SelectFont (const char *font) {
|
|||
}
|
||||
|
||||
LogDebug ("Selecting font %s failed, trying to load it", font);
|
||||
LogDebug ("font count = %d", mFonts.size());
|
||||
|
||||
if (LoadFont (font)) {
|
||||
LogDebug ("font count = %d", mFonts.size());
|
||||
LogDebug ("font count = %d", mFonts.size());
|
||||
font_iter = mFonts.find(font);
|
||||
|
||||
assert (mFonts.find(font) != mFonts.end());
|
||||
|
|
|
@ -8,7 +8,12 @@
|
|||
#define VIEW_DEFAULT_WIDTH 800
|
||||
|
||||
#ifdef WIN32
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
|
||||
|
||||
#include <cmath>
|
||||
inline double roundf(double x) { return floor(x + 0.5); }
|
||||
#endif
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
|
|
@ -89,8 +89,9 @@ namespace OGLFT {
|
|||
FT_Face ft_face;
|
||||
|
||||
FT_Error error = FT_New_Face( Library::instance(), filename, 0, &ft_face );
|
||||
|
||||
|
||||
if ( error != 0 ) {
|
||||
std::cerr << "FreeType error code: " << error << std::endl;
|
||||
valid_ = false;
|
||||
return;
|
||||
}
|
||||
|
@ -178,8 +179,10 @@ namespace OGLFT {
|
|||
|
||||
FT_Error error = FT_New_Face( Library::instance(), filename, 0, &ft_face );
|
||||
|
||||
if ( error != 0 )
|
||||
return false;
|
||||
if ( error != 0 ) {
|
||||
std::cerr << "FreeType error code: " << error << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
faces_.push_back( FaceData( ft_face ) );
|
||||
|
||||
|
@ -406,7 +409,10 @@ namespace OGLFT {
|
|||
FT_Error error = FT_Load_Glyph( faces_[f].face_, glyph_index,
|
||||
FT_LOAD_DEFAULT );
|
||||
|
||||
if ( error != 0 ) return;
|
||||
if ( error != 0 ) {
|
||||
std::cerr << "FreeType error code: " << error << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
rotation_reference_glyph_ = glyph_index;
|
||||
|
||||
|
|
|
@ -619,7 +619,7 @@ namespace OGLFT {
|
|||
* \param blue the blue component of the background color.
|
||||
* \param alpha the alpha component of the background color.
|
||||
*/
|
||||
void setBackgroundColor ( GLfloat red = 1.0,
|
||||
OGLFT_API void setBackgroundColor ( GLfloat red = 1.0,
|
||||
GLfloat green = 1.0,
|
||||
GLfloat blue = 1.0,
|
||||
GLfloat alpha = 0.0 );
|
||||
|
@ -631,7 +631,7 @@ namespace OGLFT {
|
|||
* \param background_color an array of 4 values corresponding to the
|
||||
* red, green, blue and alpha components of the background color.
|
||||
*/
|
||||
void setBackgroundColor ( const GLfloat background_color[4] );
|
||||
OGLFT_API void setBackgroundColor ( const GLfloat background_color[4] );
|
||||
#ifndef OGLFT_NO_QT
|
||||
/*!
|
||||
* This is the nominal background color of the glyphs. A lot of other things
|
||||
|
|
|
@ -86,7 +86,12 @@
|
|||
* made).
|
||||
*/
|
||||
#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
|
||||
#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
|
||||
#ifdef WIN32
|
||||
#define LITTLE_ENDIAN 12345
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#else
|
||||
#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -71,7 +71,7 @@ extern "C" {
|
|||
* uintXX_t (from inttypes.h), you may need to define things by hand
|
||||
* for your system:
|
||||
*/
|
||||
#if 0
|
||||
#if WIN32
|
||||
typedef unsigned char u_int8_t; /* 1-byte (8-bits) */
|
||||
typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */
|
||||
typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */
|
||||
|
|
Loading…
Reference in New Issue