fixed compilation under windows
- crashes sometimes for no obvious reason when loading fontsmain
parent
b5c4ef359f
commit
c2ca0a1a4d
|
@ -10,6 +10,9 @@ SET (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||||
SET (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
SET (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
|
FIND_PACKAGE (SDL REQUIRED)
|
||||||
|
FIND_PACKAGE (SDL_net REQUIRED)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES (
|
INCLUDE_DIRECTORIES (
|
||||||
engine/
|
engine/
|
||||||
asteroids/
|
asteroids/
|
||||||
|
@ -54,6 +57,11 @@ SET ( ASTEROIDSEDITOR_SOURCES
|
||||||
asteroids/View.cc
|
asteroids/View.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES (
|
||||||
|
${SDLMIXER_INCLUDE_DIRS}
|
||||||
|
${SDLNET_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
ADD_EXECUTABLE ( fysxasteroids ${ASTEROIDS_SOURCES} )
|
ADD_EXECUTABLE ( fysxasteroids ${ASTEROIDS_SOURCES} )
|
||||||
ADD_EXECUTABLE ( fysxasteroidseditor ${ASTEROIDSEDITOR_SOURCES} )
|
ADD_EXECUTABLE ( fysxasteroidseditor ${ASTEROIDSEDITOR_SOURCES} )
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,7 @@ void Controller::ResetPlayerEntity () {
|
||||||
Engine::EntityBase *player_entity = GetModel()->GetEntity(GetModel()->GetPlayerEntityId());
|
Engine::EntityBase *player_entity = GetModel()->GetEntity(GetModel()->GetPlayerEntityId());
|
||||||
player_entity->mPhysicState->mAngleVelocity = 0.;
|
player_entity->mPhysicState->mAngleVelocity = 0.;
|
||||||
|
|
||||||
int i;
|
player_entity->ResetControllerKeyState();
|
||||||
for (i = 0; i < EntityControllerMaxKeyStates; i++)
|
|
||||||
player_entity->UnsetControllerKeyState(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We definitely have to reset the player entity id
|
// We definitely have to reset the player entity id
|
||||||
|
|
|
@ -160,6 +160,7 @@ void Model::Process () {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Model::InitLevelList () {
|
unsigned int Model::InitLevelList () {
|
||||||
|
boost::filesystem::path level_dir_path;
|
||||||
std::string level_dir_name = Engine::GetResourceFullPath("/data/levels/");
|
std::string level_dir_name = Engine::GetResourceFullPath("/data/levels/");
|
||||||
Engine::LogDebug ("Searching for levels in %s", level_dir_name.c_str());
|
Engine::LogDebug ("Searching for levels in %s", level_dir_name.c_str());
|
||||||
|
|
||||||
|
@ -167,12 +168,12 @@ unsigned int Model::InitLevelList () {
|
||||||
|
|
||||||
boost::filesystem::path level_dir(level_dir_name);
|
boost::filesystem::path level_dir(level_dir_name);
|
||||||
|
|
||||||
if (!boost::filesystem::exists(level_dir)) {
|
if (!boost::filesystem::exists(level_dir.file_string())) {
|
||||||
Engine::LogError ("Could not init level list: \todo %s does not exist!");
|
Engine::LogError ("Could not init level list: %s does not exist!", level_dir.filename());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!boost::filesystem::is_directory(level_dir)) {
|
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;
|
boost::filesystem::directory_iterator end_iter;
|
||||||
|
@ -184,8 +185,8 @@ unsigned int Model::InitLevelList () {
|
||||||
level_relative_path += dir_iter->path().filename();
|
level_relative_path += dir_iter->path().filename();
|
||||||
|
|
||||||
// check whether we found an official level
|
// check whether we found an official level
|
||||||
std::string map_name (level_relative_path);
|
std::string map_name (dir_iter->filename());
|
||||||
map_name = map_name.substr(map_name.rfind ('/') + 1, map_name.size());
|
|
||||||
if (mLevelHashes.find(map_name) == mLevelHashes.end()) {
|
if (mLevelHashes.find(map_name) == mLevelHashes.end()) {
|
||||||
Engine::LogDebug ("Skipping unofficial level %s", std::string(level_relative_path).c_str());
|
Engine::LogDebug ("Skipping unofficial level %s", std::string(level_relative_path).c_str());
|
||||||
continue;
|
continue;
|
||||||
|
@ -559,7 +560,7 @@ void Model::SubmitHighscoreEntry (const std::string &name, const unsigned int po
|
||||||
int Model::DoLoadLevel (const char* filename) {
|
int Model::DoLoadLevel (const char* filename) {
|
||||||
// verify the hash of the map
|
// verify the hash of the map
|
||||||
std::string map_name (filename);
|
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();
|
||||||
std::string map_hash = sha256_hash_file (filename);
|
std::string map_hash = sha256_hash_file (filename);
|
||||||
if (map_hash != mLevelHashes[map_name]) {
|
if (map_hash != mLevelHashes[map_name]) {
|
||||||
Engine::LogMessage ("Map verification for file %s failed!", map_name.c_str());
|
Engine::LogMessage ("Map verification for file %s failed!", map_name.c_str());
|
||||||
|
|
|
@ -116,22 +116,29 @@ int main (int argc, char* argv[]) {
|
||||||
|
|
||||||
SetLogPrintLevel (Engine::LogLevelWarning);
|
SetLogPrintLevel (Engine::LogLevelWarning);
|
||||||
|
|
||||||
std::string user_path = ".";
|
std::string user_path = "";
|
||||||
std::string game_data_path = ".";
|
std::string game_data_path = "";
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
user_path = create_user_path();
|
user_path = create_user_path();
|
||||||
game_data_path = find_game_data_dir();
|
game_data_path = find_game_data_dir();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
boost::filesystem::path cpath = boost::filesystem::initial_path<boost::filesystem::path>();
|
||||||
|
std::cerr << "cwd: " << cpath.string() << std::endl;
|
||||||
|
|
||||||
// we assume the user path to be local folder
|
// we assume the user path to be local folder
|
||||||
std::string log_file_path = user_path;
|
std::string log_file_path = user_path;
|
||||||
log_file_path += "/game.log";
|
log_file_path += "/game.log";
|
||||||
|
|
||||||
|
user_path = boost::filesystem::path(cpath.string() + user_path).file_string();
|
||||||
|
game_data_path = boost::filesystem::path(cpath.string() + game_data_path).file_string();
|
||||||
|
log_file_path = boost::filesystem::path (cpath.string() + log_file_path).file_string();
|
||||||
|
|
||||||
cout << "User Data Dir = " << user_path << endl;
|
cout << "User Data Dir = " << user_path << endl;
|
||||||
engine.SetUserDataPath (user_path);
|
engine.SetUserDataPath (user_path);
|
||||||
|
|
||||||
Engine::SetLogFilename (log_file_path.c_str());
|
Engine::SetLogFilename (log_file_path);
|
||||||
|
|
||||||
engine.SetGameDataPath (game_data_path);
|
engine.SetGameDataPath (game_data_path);
|
||||||
cout << "Game Data Dir = " << game_data_path << endl;
|
cout << "Game Data Dir = " << game_data_path << endl;
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
#include "Module.h"
|
#include "Module.h"
|
||||||
#include "EngineEnums.h"
|
#include "EngineEnums.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
@ -115,13 +117,13 @@ class Engine : public Module {
|
||||||
* \brief it
|
* \brief it
|
||||||
*/
|
*/
|
||||||
std::string GetResourceFullPath (const std::string &resource) {
|
std::string GetResourceFullPath (const std::string &resource) {
|
||||||
return mGameDataPath + resource;
|
return boost::filesystem::path(mGameDataPath + resource).file_string();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Returns the path to a file by prepending the user data path to it
|
/** \brief Returns the path to a file by prepending the user data path to it
|
||||||
*/
|
*/
|
||||||
std::string GetUserDirFullPath (const std::string &path) {
|
std::string GetUserDirFullPath (const std::string &path) {
|
||||||
return mUserDataPath + path;
|
return boost::filesystem::path(mUserDataPath + path).file_string();
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -13,17 +13,22 @@ bool EntityControllerState::GetKey (int state) {
|
||||||
void EntityControllerState::SetKey (int state) {
|
void EntityControllerState::SetKey (int state) {
|
||||||
assert (state < EntityControllerMaxKeyStates && state >= 0);
|
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);
|
mKeyState.set (state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityControllerState::UnsetKey (int state) {
|
void EntityControllerState::UnsetKey (int state) {
|
||||||
assert (state < EntityControllerMaxKeyStates && state >= 0);
|
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);
|
mKeyState.reset (state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityControllerState::Reset () {
|
||||||
|
LogDebug ("Entity %d: Resetting all key states", mId);
|
||||||
|
mKeyState.reset ();
|
||||||
|
}
|
||||||
|
|
||||||
void EntityBase::SetControllerKeyState (int state) {
|
void EntityBase::SetControllerKeyState (int state) {
|
||||||
if (!mControllerState) {
|
if (!mControllerState) {
|
||||||
LogError ("Error when trying to send a KeyState to an Entity that has no EntityControllerState!");
|
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);
|
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?
|
* \todo [Low] The current design is very unflexible. Is there a better way?
|
||||||
*/
|
*/
|
||||||
struct EntityControllerState {
|
struct EntityControllerState {
|
||||||
|
unsigned int mId;
|
||||||
|
|
||||||
std::bitset<EntityControllerMaxKeyStates> mKeyState;
|
std::bitset<EntityControllerMaxKeyStates> mKeyState;
|
||||||
|
|
||||||
bool GetKey (int state);
|
bool GetKey (int state);
|
||||||
void SetKey (int state);
|
void SetKey (int state);
|
||||||
void UnsetKey (int state);
|
void UnsetKey (int state);
|
||||||
|
void Reset ();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Represents the base of everything that exists in the engine
|
/** \brief Represents the base of everything that exists in the engine
|
||||||
|
@ -131,6 +134,8 @@ struct EntityBase {
|
||||||
virtual void SetControllerKeyState (int state);
|
virtual void SetControllerKeyState (int state);
|
||||||
/** \brief Removes the given state to the current movement state of the Entity */
|
/** \brief Removes the given state to the current movement state of the Entity */
|
||||||
virtual void UnsetControllerKeyState (int state);
|
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 */
|
/** \brief Helper function to set the id to all substates */
|
||||||
void SetId (unsigned int id) {
|
void SetId (unsigned int id) {
|
||||||
|
@ -138,6 +143,8 @@ struct EntityBase {
|
||||||
|
|
||||||
if (mPhysicState)
|
if (mPhysicState)
|
||||||
mPhysicState->mId = id;
|
mPhysicState->mId = id;
|
||||||
|
if (mControllerState)
|
||||||
|
mControllerState->mId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Executes game logic for the collision event
|
/** Executes game logic for the collision event
|
||||||
|
|
|
@ -250,7 +250,7 @@ bool Button (int id, const char* caption, int x, int y, int w, int h) {
|
||||||
SelectFont("console.ttf size=23 color=#ffffff");
|
SelectFont("console.ttf size=23 color=#ffffff");
|
||||||
view->DrawGLString( xpos, ypos, caption);
|
view->DrawGLString( xpos, ypos, caption);
|
||||||
} else {
|
} else {
|
||||||
SelectFont("console.ttf size=23 color=#4d4d4d");
|
SelectFont("console.ttf size=23 color=#444444");
|
||||||
view->DrawGLString( xpos - 2., ypos + 2., caption);
|
view->DrawGLString( xpos - 2., ypos + 2., caption);
|
||||||
SelectFont("console.ttf size=23 color=#b3b3b3");
|
SelectFont("console.ttf size=23 color=#b3b3b3");
|
||||||
view->DrawGLString( xpos, ypos, caption);
|
view->DrawGLString( xpos, ypos, caption);
|
||||||
|
@ -371,7 +371,7 @@ bool CheckButton (int id, const char* caption, bool checked, int x, int y, int w
|
||||||
SelectFont("console.ttf size=23 color=#ffffff");
|
SelectFont("console.ttf size=23 color=#ffffff");
|
||||||
view->DrawGLString( xpos, ypos, caption);
|
view->DrawGLString( xpos, ypos, caption);
|
||||||
} else {
|
} else {
|
||||||
SelectFont("console.ttf size=23 color=#4d4d4d");
|
SelectFont("console.ttf size=23 color=#444444");
|
||||||
view->DrawGLString( xpos - 2., ypos + 2., caption);
|
view->DrawGLString( xpos - 2., ypos + 2., caption);
|
||||||
SelectFont("console.ttf size=23 color=#b3b3b3");
|
SelectFont("console.ttf size=23 color=#b3b3b3");
|
||||||
view->DrawGLString( xpos, ypos, caption);
|
view->DrawGLString( xpos, ypos, caption);
|
||||||
|
|
|
@ -90,11 +90,11 @@ void Logging::SetLogPrintLevel (LogLevel print_level) {
|
||||||
mPrintLevel = print_level;
|
mPrintLevel = print_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::SetLogFilename (const char *filename) {
|
void Logging::SetLogFilename (const std::string &filename) {
|
||||||
mLogFileOut.open (filename, std::ios_base::trunc);
|
mLogFileOut.open (filename.c_str(), std::ios_base::trunc);
|
||||||
|
|
||||||
if (!mLogFileOut) {
|
if (!mLogFileOut) {
|
||||||
LogError ("Could not open logfile %s for writing!", filename);
|
LogError ("Could not open logfile %s for writing!", filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
requested_logfilename = "";
|
requested_logfilename = "";
|
||||||
|
@ -122,7 +122,7 @@ void SetLogPrintLevel (LogLevel print_level) {
|
||||||
LoggingInstance->SetLogPrintLevel (print_level);
|
LoggingInstance->SetLogPrintLevel (print_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetLogFilename (const char *filename) {
|
void SetLogFilename (const std::string &filename) {
|
||||||
if (!LoggingInstance) {
|
if (!LoggingInstance) {
|
||||||
requested_logfilename = filename;
|
requested_logfilename = filename;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Logging : public Module {
|
||||||
public:
|
public:
|
||||||
void Log (LogLevel level, const char *str, ...);
|
void Log (LogLevel level, const char *str, ...);
|
||||||
void SetLogPrintLevel (LogLevel print_level);
|
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
|
/** \brief Returns the last LogEntry that was sent to the Logging module
|
||||||
*/
|
*/
|
||||||
const LogEntry& GetLastEntry ();
|
const LogEntry& GetLastEntry ();
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct LogEntry {
|
||||||
/** \brief Sets the level for which messages should be printed out */
|
/** \brief Sets the level for which messages should be printed out */
|
||||||
void SetLogPrintLevel (LogLevel print_level);
|
void SetLogPrintLevel (LogLevel print_level);
|
||||||
/** \brief Sets the filename to which all the logging is sent, set to NULL to disable logging */
|
/** \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
|
/** \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) {
|
std::string sha256_hash (std::string input) {
|
||||||
char result_buf[64];
|
char result_buf[65];
|
||||||
|
result_buf[64] = '\0';
|
||||||
|
|
||||||
SHA256_CTX ctx256;
|
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_Update(&ctx256, (unsigned char*) input.c_str(), input.size());
|
||||||
SHA256_End (&ctx256, result_buf);
|
SHA256_End (&ctx256, result_buf);
|
||||||
|
|
||||||
return std::string (result_buf, 64);
|
return std::string (result_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sha256_hash_file (const char *filename) {
|
std::string sha256_hash_file (const char *filename) {
|
||||||
|
@ -62,7 +63,6 @@ std::string sha256_hash_file (const char *filename) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
file_stream.seekg (0,std::ios_base::end);
|
file_stream.seekg (0,std::ios_base::end);
|
||||||
std::streampos file_end = file_stream.tellg();
|
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.seekg(0, std::ios_base::beg);
|
||||||
file_stream.read ((char*)file_buffer, file_size);
|
file_stream.read ((char*)file_buffer, file_size);
|
||||||
|
|
||||||
char result_buf[64];
|
char result_buf[65];
|
||||||
|
|
||||||
SHA256_CTX ctx256;
|
SHA256_CTX ctx256;
|
||||||
|
|
||||||
|
@ -90,6 +90,8 @@ std::string sha256_hash_file (const char *filename) {
|
||||||
|
|
||||||
delete[] file_buffer;
|
delete[] file_buffer;
|
||||||
|
|
||||||
|
result_buf[64] = '\0';
|
||||||
|
|
||||||
// std::cerr << "file hash is " << std::string (result_buf, 64) << std::endl;
|
// std::cerr << "file hash is " << std::string (result_buf, 64) << std::endl;
|
||||||
|
|
||||||
return std::string (result_buf, 64);
|
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);
|
OGLFT::Monochrome *font = new OGLFT::Monochrome (font_path.c_str(), font_size);
|
||||||
if ( font == 0 || !font->isValid() ) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ bool ViewBase::LoadFont (const std::string &font_spec_string) {
|
||||||
font->setBackgroundColor(0., 0., 0., 0.);
|
font->setBackgroundColor(0., 0., 0., 0.);
|
||||||
|
|
||||||
mFonts.insert(std::make_pair<std::string, OGLFT::Monochrome*>(font_spec_string, font));
|
mFonts.insert(std::make_pair<std::string, OGLFT::Monochrome*>(font_spec_string, font));
|
||||||
|
LogDebug ("Loading font %s successful!", font_name.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ void ViewBase::SelectFont (const char *font) {
|
||||||
}
|
}
|
||||||
|
|
||||||
LogDebug ("Selecting font %s failed, trying to load it", font);
|
LogDebug ("Selecting font %s failed, trying to load it", font);
|
||||||
LogDebug ("font count = %d", mFonts.size());
|
|
||||||
if (LoadFont (font)) {
|
if (LoadFont (font)) {
|
||||||
LogDebug ("font count = %d", mFonts.size());
|
LogDebug ("font count = %d", mFonts.size());
|
||||||
font_iter = mFonts.find(font);
|
font_iter = mFonts.find(font);
|
||||||
|
|
|
@ -8,7 +8,12 @@
|
||||||
#define VIEW_DEFAULT_WIDTH 800
|
#define VIEW_DEFAULT_WIDTH 800
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#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
|
#endif
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
|
|
|
@ -89,8 +89,11 @@ namespace OGLFT {
|
||||||
FT_Face ft_face;
|
FT_Face ft_face;
|
||||||
|
|
||||||
FT_Error error = FT_New_Face( Library::instance(), filename, 0, &ft_face );
|
FT_Error error = FT_New_Face( Library::instance(), filename, 0, &ft_face );
|
||||||
|
assert (0);
|
||||||
|
std::cerr << "FreeType error code: " << error << std::endl;
|
||||||
|
|
||||||
if ( error != 0 ) {
|
if ( error != 0 ) {
|
||||||
|
std::cerr << "FreeType error code: " << error << std::endl;
|
||||||
valid_ = false;
|
valid_ = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -178,8 +181,10 @@ namespace OGLFT {
|
||||||
|
|
||||||
FT_Error error = FT_New_Face( Library::instance(), filename, 0, &ft_face );
|
FT_Error error = FT_New_Face( Library::instance(), filename, 0, &ft_face );
|
||||||
|
|
||||||
if ( error != 0 )
|
if ( error != 0 ) {
|
||||||
|
std::cerr << "FreeType error code: " << error << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
faces_.push_back( FaceData( ft_face ) );
|
faces_.push_back( FaceData( ft_face ) );
|
||||||
|
|
||||||
|
@ -406,7 +411,10 @@ namespace OGLFT {
|
||||||
FT_Error error = FT_Load_Glyph( faces_[f].face_, glyph_index,
|
FT_Error error = FT_Load_Glyph( faces_[f].face_, glyph_index,
|
||||||
FT_LOAD_DEFAULT );
|
FT_LOAD_DEFAULT );
|
||||||
|
|
||||||
if ( error != 0 ) return;
|
if ( error != 0 ) {
|
||||||
|
std::cerr << "FreeType error code: " << error << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rotation_reference_glyph_ = glyph_index;
|
rotation_reference_glyph_ = glyph_index;
|
||||||
|
|
||||||
|
@ -1348,6 +1356,8 @@ namespace OGLFT {
|
||||||
{
|
{
|
||||||
if ( !isValid() ) return;
|
if ( !isValid() ) return;
|
||||||
|
|
||||||
|
std::cerr << "Raster is valid!" << std::endl;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -619,7 +619,7 @@ namespace OGLFT {
|
||||||
* \param blue the blue component of the background color.
|
* \param blue the blue component of the background color.
|
||||||
* \param alpha the alpha 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 green = 1.0,
|
||||||
GLfloat blue = 1.0,
|
GLfloat blue = 1.0,
|
||||||
GLfloat alpha = 0.0 );
|
GLfloat alpha = 0.0 );
|
||||||
|
@ -631,7 +631,7 @@ namespace OGLFT {
|
||||||
* \param background_color an array of 4 values corresponding to the
|
* \param background_color an array of 4 values corresponding to the
|
||||||
* red, green, blue and alpha components of the background color.
|
* 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
|
#ifndef OGLFT_NO_QT
|
||||||
/*!
|
/*!
|
||||||
* This is the nominal background color of the glyphs. A lot of other things
|
* This is the nominal background color of the glyphs. A lot of other things
|
||||||
|
|
|
@ -86,7 +86,12 @@
|
||||||
* made).
|
* made).
|
||||||
*/
|
*/
|
||||||
#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
|
#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
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -71,7 +71,7 @@ extern "C" {
|
||||||
* uintXX_t (from inttypes.h), you may need to define things by hand
|
* uintXX_t (from inttypes.h), you may need to define things by hand
|
||||||
* for your system:
|
* for your system:
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 1
|
||||||
typedef unsigned char u_int8_t; /* 1-byte (8-bits) */
|
typedef unsigned char u_int8_t; /* 1-byte (8-bits) */
|
||||||
typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */
|
typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */
|
||||||
typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */
|
typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */
|
||||||
|
|
Loading…
Reference in New Issue