version information in the CMakeLists.txt are now available in the code

main
martin 2011-05-06 17:37:49 +02:00
parent 10701d787c
commit e3733a7b0b
5 changed files with 27 additions and 17 deletions

View File

@ -120,6 +120,11 @@ SET(CPACK_PACKAGE_VERSION_PATCH "8-rc2")
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.

View File

@ -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);

View File

@ -116,24 +116,26 @@ int main (int argc, char* argv[]) {
SetLogPrintLevel (Engine::LogLevelWarning);
// 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).file_string();
game_data_path = boost::filesystem::path(cpath.string() + game_data_path).file_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
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
std::string log_file_path = user_path;
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();
log_file_path = boost::filesystem::path (log_file_path).file_string();
cout << "User Data Dir = " << user_path << endl;
engine.SetUserDataPath (user_path);
@ -157,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);

View File

@ -89,11 +89,9 @@ namespace OGLFT {
FT_Face 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 ) {
std::cerr << "FreeType error code: " << error << std::endl;
std::cerr << "FreeType error code: " << error << std::endl;
valid_ = false;
return;
}
@ -1356,8 +1354,6 @@ namespace OGLFT {
{
if ( !isValid() ) return;
std::cerr << "Raster is valid!" << std::endl;
init();
}

View File

@ -71,7 +71,7 @@ extern "C" {
* uintXX_t (from inttypes.h), you may need to define things by hand
* for your system:
*/
#if 1
#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) */