Compare commits

...

30 Commits

Author SHA1 Message Date
krzys-h 6b26a0ab6d Updated data submodule 2014-04-02 19:59:48 +02:00
krzys-h 5910b2a7f8 Merge remote-tracking branch 'origin/dev' into dev-ui 2014-04-02 19:52:31 +02:00
krzys-h 083ca8f14e Changing mouse images 2014-03-31 14:41:35 +02:00
krzys-h 837442336b New mouse cursors 2014-03-30 21:31:25 +02:00
krzys-h c96369cf04 Removed old authors text when exiting the game 2014-03-24 21:15:15 +01:00
krzys-h f01313ea99 Credits in CEGUI 2014-03-24 21:03:56 +01:00
krzys-h ffa27096c0 Removed unnecessary field in CScreenMenu 2014-03-16 17:25:12 +01:00
krzys-h 68de0cca93 Version display in CEGUI 2014-03-16 15:40:02 +01:00
krzys-h 4ff7d032ef Fixed a bug with disappearing interface textures
& updated data submodule
2014-03-15 22:08:49 +01:00
krzys-h 9c425290fb Updated INSTALL.md 2014-03-15 22:08:36 +01:00
krzys-h 77ef375b53 Menu windows in CEGUI 2014-03-15 19:54:53 +01:00
krzys-h 3f163eeda4 Disable userlevels in Release build 2014-03-15 16:08:19 +01:00
krzys-h 47542239a0 Polish translations 2014-03-15 12:46:35 +01:00
krzys-h 75805c552e Updated data submodule 2014-03-15 12:32:54 +01:00
krzys-h fe016cc924 New menu layout 2014-03-15 12:20:48 +01:00
krzys-h 6ec6576b9e Updated data submodule 2014-03-14 19:46:11 +01:00
krzys-h d0a2663478 More CEGUI in main menu 2014-03-14 19:23:31 +01:00
krzys-h aa9da9f3b5 Some code cleanup 2014-03-13 21:23:12 +01:00
krzys-h a360634295 Fixed displaying of UTF-8 characters 2014-03-13 17:03:59 +01:00
krzys-h e06c4af346 Merge remote-tracking branch 'origin/dev' into dev-ui 2014-03-13 16:32:43 +01:00
krzys-h 78df85c47e Merge remote-tracking branch 'origin/dev' into dev-ui 2014-03-09 17:25:38 +01:00
krzys-h de52443ecf Functional main menu 2014-03-09 17:25:18 +01:00
krzys-h 189ab433bc Main menu test button 2014-03-08 23:41:43 +01:00
krzys-h 03c8d06955 CScreen 2014-03-08 23:33:49 +01:00
krzys-h 54c2aec088 Merge branch 'dev' into dev-ui 2014-03-08 23:33:13 +01:00
krzys-h 0e0eae57d0 CEGUI splashscreens 2014-03-07 22:04:19 +01:00
krzys-h 273d6fa962 Better CEGUI Button 2014-03-02 18:32:38 +01:00
krzys-h ebdbc09962 Merge branch 'dev' into dev-ui 2014-03-02 18:32:29 +01:00
krzys-h 0b4b6448de CEGUI Button 2014-03-02 17:30:47 +01:00
krzys-h 21a29790f8 CEGUI initialization 2014-03-01 19:53:09 +01:00
35 changed files with 2205 additions and 613 deletions

View File

@ -30,13 +30,22 @@ if(DEFINED COLOBOT_VERSION_UNRELEASED)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
OUTPUT_VARIABLE GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%cd --date=local
OUTPUT_VARIABLE GIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(COLOBOT_VERSION_UNRELEASED "${COLOBOT_VERSION_UNRELEASED}-git-${GIT_BRANCH}~r${GIT_REVISION}")
set(COLOBOT_VERSION_DISPLAY "git-${GIT_BRANCH}~r${GIT_REVISION}")
set(COLOBOT_VERSION_DISPLAY_NOCEGUI "${GIT_BRANCH}~${GIT_REVISION}")
set(COLOBOT_VERSION_DISPLAY "C:GE git~${GIT_BRANCH}~${GIT_REVISION}")
set(COLOBOT_VERSION_DATE "${GIT_DATE}")
else()
set(COLOBOT_VERSION_DISPLAY "${COLOBOT_VERSION_CODENAME}-${COLOBOT_VERSION_UNRELEASED}")
set(COLOBOT_VERSION_DISPLAY_NOCEGUI "${COLOBOT_VERSION_CODENAME}${COLOBOT_VERSION_UNRELEASED}")
set(COLOBOT_VERSION_DISPLAY "Colobot ${COLOBOT_VERSION_CODENAME} dev")
set(COLOBOT_VERSION_DATE "${COLOBOT_VERSION_UNRELEASED}")
endif()
else()
set(COLOBOT_VERSION_DISPLAY "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_RELEASE_CODENAME}")
set(COLOBOT_VERSION_DISPLAY_NOCEGUI "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_RELEASE_CODENAME}")
set(COLOBOT_VERSION_DISPLAY "Colobot ${COLOBOT_VERSION_CODENAME}")
set(COLOBOT_VERSION_DATE "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_RELEASE_CODENAME}")
endif()
set(COLOBOT_VERSION_FULL "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_UNRELEASED}${COLOBOT_VERSION_RELEASE_CODENAME}")
@ -214,6 +223,8 @@ find_package(Boost COMPONENTS system filesystem regex REQUIRED)
find_package(GLEW REQUIRED)
find_package(CEGUI REQUIRED)
if (OPENAL_SOUND)
find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})

View File

@ -116,6 +116,7 @@ You will need:
* libogg >= 1.3.0
* OpenAL (OpenAL-Soft) >= 1.13
* po4a >= 0.45 (to generate translated data files)
* CEGUI >= 0.8.3 (with OpenGLRenderer)
Make sure you install the packages along with header files (often distributed in separate *-dev packages). If you miss any requirements,
CMake should warn you.

391
cmake/FindCEGUI.cmake Normal file
View File

@ -0,0 +1,391 @@
# - Locate CEGUI LIBRARIES
# This module defines
# CEGUI_FOUND, if false, do not try to link to CEGUI
# CEGUI_INCLUDE_DIR, where to find headers.
# CEGUI_LIBRARIES, the LIBRARIES to link against
# CEGUI_BINARY_REL - location of the main CEGUI binary (win32 non-static only, release)
# CEGUI_BINARY_DBG - location of the main CEGUI binaries (win32 non-static only, debug)
#
#
# Modules :
# CEGUI_${COMPONENT}_FOUND - ${COMPONENT} is available
# CEGUI_${COMPONENT}_INCLUDE_DIRS - additional include directories for ${COMPONENT}
# CEGUI_${COMPONENT}_LIBRARIES - link these to use ${COMPONENT}
# CEGUI_${COMPONENT}_BINARY_REL - location of the component binary (win32 non-static only, release)
# CEGUI_${COMPONENT}_BINARY_DBG - location of the component binary (win32 non-static only, debug)
#
# WindowsRenderer:
# Falagard
# Renderer:
# Direct3D9Renderer Direct3D10Renderer Direct3D11Renderer IrrlichtRenderer NullRenderer OgreRenderer OpenGLRenderer
# ImageCodec:
# CoronaImageCodec DevILImageCodec FreeImageImageCodec SILLYImageCodec STBImageCodec TGAImageCodec
# Parser:
# ExpatParser LibXMLParser RapidXMLParser TinyXMLParser XercesParser)
# Script:
# LuaScriptModule
include(FindPkgMacros)
include(PreprocessorUtils)
# Print component specific variables
macro(PRINT_COMPONENT_INFO COMPONENT)
message(
"${COMPONENT}_FOUND : " ${CEGUI_${COMPONENT}_FOUND} "\n"
"${COMPONENT}_INCLUDE_DIRS: " ${CEGUI_${COMPONENT}_INCLUDE_DIRS} "\n"
"${COMPONENT}_LIBRARIES: " ${CEGUI_${COMPONENT}_LIBRARIES} "\n"
"${COMPONENT}_BINARY_REL: " ${CEGUI_${COMPONENT}_BINARY_REL} "\n"
"${COMPONENT}_BINARY_DBG: " ${CEGUI_${COMPONENT}_BINARY_DBG} "\n"
)
endmacro(PRINT_COMPONENT_INFO)
findpkg_begin(CEGUI)
set(CEGUI_FIND_REQUIRED 1)
# Get path, convert backslashes as ${ENV_${var}}
getenv_path(CEGUI_HOME)
getenv_path(CEGUI_DIR)
getenv_path(CEGUI_ROOT)
getenv_path(PROGRAMFILES)
# Determine whether to search for a dynamic or static build
if (CEGUI_STATIC)
set(CEGUI_LIB_SUFFIX "_Static")
else ()
set(CEGUI_LIB_SUFFIX "")
endif ()
set(CEGUI_LIBRARY_NAMES "CEGUIBase${CEGUI_LIB_SUFFIX}")
get_debug_names(CEGUI_LIBRARY_NAMES)
# construct search paths from environmental hints and
# OS specific guesses
if (WIN32)
set(CEGUI_PREFIX_GUESSES
${ENV_PROGRAMFILES}/cegui
${ENV_PROGRAMFILES}/CEGUI
C:/CEGUI-SDK
C:/lib/cegui
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;CEGUI_HOME]
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;CEGUI_DIR]
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;CEGUI_ROOT]
)
elseif (UNIX)
set(CEGUI_PREFIX_GUESSES
/opt/cegui
/opt/CEGUI
/usr
/usr/local
$ENV{HOME}/cegui
$ENV{HOME}/CEGUI
)
endif ()
set(CEGUI_PREFIX_PATH
$ENV{CEGUI_HOME} $ENV{CEGUI_DIR} $ENV{CEGUI_ROOT}
${CEGUI_PREFIX_GUESSES}
)
create_search_paths(CEGUI)
# redo search if any of the environmental hints changed
set(CEGUI_WINDOWSRENDERER_COMPONENTS
CoreWindowRendererSet
)
set(CEGUI_RENDERER_COMPONENTS
Direct3D9Renderer Direct3D10Renderer Direct3D11Renderer IrrlichtRenderer NullRenderer OgreRenderer OpenGLRenderer
)
set(CEGUI_IMAGECODEC_COMPONENTS
CoronaImageCodec DevILImageCodec FreeImageImageCodec SILLYImageCodec STBImageCodec TGAImageCodec
)
set(CEGUI_PARSER_COMPONENTS
ExpatParser LibXMLParser RapidXMLParser TinyXMLParser XercesParser
)
set(CEGUI_SCRIPT_COMPONENTS
LuaScriptModule
)
set(CEGUI_COMPONENTS ${CEGUI_WINDOWSRENDERER_COMPONENTS} ${CEGUI_RENDERER_COMPONENTS} ${CEGUI_IMAGECODEC_COMPONENTS} ${CEGUI_PARSER_COMPONENTS} ${CEGUI_SCRIPT_COMPONENTS})
set(CEGUI_RESET_VARS
CEGUI_CONFIG_INCLUDE_DIR CEGUI_INCLUDE_DIR
CEGUI_LIBRARY_REL CEGUI_LIBRARY_DBG
)
foreach (comp ${CEGUI_COMPONENTS})
set(CEGUI_RESET_VARS ${CEGUI_RESET_VARS}
CEGUI_${comp}_INCLUDE_DIR CEGUI_${comp}_LIBRARY_FWK
CEGUI_${comp}_LIBRARY_DBG CEGUI_${comp}_LIBRARY_REL
)
endforeach (comp)
set(CEGUI_PREFIX_WATCH ${CEGUI_PREFIX_PATH})
clear_if_changed(CEGUI_PREFIX_WATCH ${CEGUI_RESET_VARS})
# try to locate CEGUI via pkg-config
use_pkgconfig(CEGUI_PKGC "CEGUI${CEGUI_LIB_SUFFIX}")
#message("CEGUI_INC_SEARCH_PATH:" ${CEGUI_INC_SEARCH_PATH})
#message("CEGUI_FRAMEWORK_INCLUDES:" ${CEGUI_FRAMEWORK_INCLUDES})
#message("CEGUI_PKGC_INCLUDE_DIRS:" ${CEGUI_PKGC_INCLUDE_DIRS})
# locate CEGUI include files
find_path(CEGUI_CONFIG_INCLUDE_DIR NAMES Config.h
HINTS ${CEGUI_INC_SEARCH_PATH} ${CEGUI_FRAMEWORK_INCLUDES} ${CEGUI_PKGC_INCLUDE_DIRS}
PATH_SUFFIXES "" "CEGUI" "cegui-0/CEGUI")
find_path(CEGUI_INCLUDE_DIR NAMES CEGUI.h
HINTS ${CEGUI_INC_SEARCH_PATH} ${CEGUI_FRAMEWORK_INCLUDES} ${CEGUI_PKGC_INCLUDE_DIRS}
PATH_SUFFIXES "" "CEGUI" "cegui-0/CEGUI")
set(CEGUI_INCOMPATIBLE FALSE)
if (CEGUI_INCLUDE_DIR)
# determine CEGUI version
file(READ ${CEGUI_INCLUDE_DIR}/Version.h CEGUI_TEMP_VERSION_CONTENT)
get_preprocessor_entry(CEGUI_TEMP_VERSION_CONTENT CEGUI_VERSION_MAJOR CEGUI_VERSION_MAJOR)
get_preprocessor_entry(CEGUI_TEMP_VERSION_CONTENT CEGUI_VERSION_MINOR CEGUI_VERSION_MINOR)
get_preprocessor_entry(CEGUI_TEMP_VERSION_CONTENT CEGUI_VERSION_PATCH CEGUI_VERSION_PATCH)
get_preprocessor_entry(CEGUI_TEMP_VERSION_CONTENT CEGUI_VERSION_NAME CEGUI_VERSION_NAME)
set(CEGUI_VERSION "${CEGUI_VERSION_MAJOR}.${CEGUI_VERSION_MINOR}.${CEGUI_VERSION_PATCH}")
pkg_message(CEGUI "Found CEGUI headers ${CEGUI_VERSION_NAME} (${CEGUI_VERSION})")
pkg_message(CEGUI "Include dir: " ${CEGUI_INCLUDE_DIR})
#set(CEGUI_VERSION "0.7.9")
if ((${CEGUI_VERSION} VERSION_GREATER "0.8.0") OR (${CEGUI_VERSION} VERSION_EQUAL "0.8.0"))
set(CEGUI_LIBRARY_NAMES "CEGUIBase-${CEGUI_VERSION_MAJOR}${CEGUI_LIB_SUFFIX}")
else()
set(CEGUI_INCOMPATIBLE TRUE)
message(FATAL_ERROR "CEGUI version 0.8.0 or greater required !")
endif()
# determine configuration settings
set(CEGUI_CONFIG_HEADERS
${CEGUI_CONFIG_INCLUDE_DIR}/Config.h
)
set(CEGUI_CONFIG_HEADER NOTFOUND)
foreach(CFG_FILE ${CEGUI_CONFIG_HEADERS})
if (EXISTS ${CFG_FILE})
set(CEGUI_CONFIG_HEADER ${CFG_FILE}) # take the first config header from headers
break()
endif()
endforeach()
#message("Config header:" ${CEGUI_CONFIG_HEADER})
if (CEGUI_CONFIG_HEADER)
file(READ ${CEGUI_CONFIG_HEADER} CEGUI_TEMP_CONFIG_CONTENT)
has_preprocessor_entry(CEGUI_TEMP_CONFIG_CONTENT CEGUI_STATIC_LIB CEGUI_CONFIG_STATIC)
get_preprocessor_entry(CEGUI_TEMP_CONFIG_CONTENT CEGUI_THREAD_SUPPORT CEGUI_CONFIG_THREADS)
get_preprocessor_entry(CEGUI_TEMP_CONFIG_CONTENT CEGUI_THREAD_PROVIDER CEGUI_CONFIG_THREAD_PROVIDER)
get_preprocessor_entry(CEGUI_TEMP_CONFIG_CONTENT CEGUI_NO_FREEIMAGE CEGUI_CONFIG_FREEIMAGE)
if (CEGUI_CONFIG_STATIC AND CEGUI_STATIC)
elseif (CEGUI_CONFIG_STATIC OR CEGUI_STATIC)
pkg_message(CEGUI "Build type (static, dynamic) does not match the requested one.")
set(CEGUI_INCOMPATIBLE TRUE)
endif ()
else ()
pkg_message(OGRE "Could not determine Ogre build configuration.")
set(CEGUI_INCOMPATIBLE TRUE)
endif ()
else ()
set(CEGUI_INCOMPATIBLE FALSE)
endif ()
#message("Library names: " ${CEGUI_LIBRARY_NAMES})
#message("CEGUI_LIB_SEARCH_PATH: " ${CEGUI_LIB_SEARCH_PATH})
find_library(CEGUI_LIBRARY_REL NAMES ${CEGUI_LIBRARY_NAMES}
HINTS ${CEGUI_LIB_SEARCH_PATH} ${CEGUI_PKGC_LIBRARY_DIRS} ${CEGUI_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
find_library(CEGUI_LIBRARY_DBG NAMES ${CEGUI_LIBRARY_NAMES_DBG}
HINTS ${CEGUI_LIB_SEARCH_PATH} ${CEGUI_PKGC_LIBRARY_DIRS} ${CEGUI_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "debug")
#message("CEGUI_LIBRARY_REL : " ${CEGUI_LIBRARY_REL})
#message("CEGUI_FOUND : " ${CEGUI_FOUND})
make_library_set(CEGUI_LIBRARY)
if (CEGUI_INCOMPATIBLE)
set(CEGUI_LIBRARY "NOTFOUND")
endif ()
#message("CEGUI_INCOMPATIBLE : " ${CEGUI_INCOMPATIBLE})
#message("CEGUI_LIBRARY : " ${CEGUI_LIBRARY})
set(CEGUI_INCLUDE_DIR ${CEGUI_CONFIG_INCLUDE_DIR} ${CEGUI_INCLUDE_DIR})
list(REMOVE_DUPLICATES CEGUI_INCLUDE_DIR)
findpkg_finish(CEGUI)
add_parent_dir(CEGUI_INCLUDE_DIRS CEGUI_INCLUDE_DIR)
mark_as_advanced(CEGUI_CONFIG_INCLUDE_DIR)
if (NOT CEGUI_FOUND)
return()
endif ()
get_filename_component(CEGUI_LIBRARY_DIR_REL "${CEGUI_LIBRARY_REL}" PATH)
get_filename_component(CEGUI_LIBRARY_DIR_DBG "${CEGUI_LIBRARY_DBG}" PATH)
set(CEGUI_LIBRARY_DIRS ${CEGUI_LIBRARY_DIR_REL} ${CEGUI_LIBRARY_DIR_DBG})
#message("lib dirs0:" ${CEGUI_LIBRARY_DIRS})
# find binaries WIN32
if (NOT CEGUI_STATIC)
#message("not static" ${CEGUI_BIN_SEARCH_PATH})
if (WIN32)
find_file(CEGUI_BINARY_REL NAMES "CEGUIBase-${CEGUI_VERSION_MAJOR}.dll"
HINTS ${CEGUI_BIN_SEARCH_PATH}
PATH_SUFFIXES "" release relwithdebinfo minsizerel)
find_file(CEGUI_BINARY_DBG NAMES "CEGUIBase${CEGUI_VERSION_MAJOR}_d.dll"
HINTS ${CEGUI_BIN_SEARCH_PATH}
PATH_SUFFIXES "" debug )
get_filename_component(CEGUI_BINARY_DIR_REL "${CEGUI_BINARY_REL}" PATH)
get_filename_component(CEGUI_BINARY_DIR_DBG "${CEGUI_BINARY_DBG}" PATH)
set(CEGUI_LIBRARY_DIRS ${CEGUI_BINARY_DIR_REL} ${CEGUI_BINARY_DIR_DBG})
else () # UNIX and APPLE
set(CEGUI_BINARY_REL NOTFOUND)
set(CEGUI_BINARY_DBG NOTFOUND)
set(CEGUI_BINARY_DIR_REL NOTFOUND)
set(CEGUI_BINARY_DIR_DBG NOTFOUND)
endif()
mark_as_advanced(CEGUI_BINARY_REL CEGUI_BINARY_DBG CEGUI_BINARY_DIR_REL CEGUI_BINARY_DIR_DBG)
endif()
#message("lib dirs1:" ${CEGUI_LIBRARY_DIRS})
# look for CoreWindowRendererSet component
findpkg_begin(CEGUI_CoreWindowRendererSet)
find_path(CEGUI_Falagard_INCLUDE_DIR NAMES NamedArea.h
HINTS ${CEGUI_INCLUDE_DIRS}
PATH_SUFFIXES falagard CEGUI/falagard)
find_path(CEGUI_CoreWindowRendererSet_INCLUDE_DIR NAMES Module.h
HINTS ${CEGUI_INCLUDE_DIRS}
PATH_SUFFIXES WindowRendererSets/Core CEGUI/WindowRendererSets/Core)
set(CEGUI_CoreWindowRendererSet_INCLUDE_DIR ${CEGUI_CoreWindowRendererSet_INCLUDE_DIR} ${CEGUI_Falagard_INCLUDE_DIR})
set(CEGUI_CoreWindowRendererSet_LIBRARY_NAMES "CEGUICoreWindowRendererSet${CEGUI_LIB_SUFFIX}")
get_debug_names(CEGUI_CoreWindowRendererSet_LIBRARY_NAMES)
find_library(CEGUI_CoreWindowRendererSet_LIBRARY_REL NAMES ${CEGUI_CoreWindowRendererSet_LIBRARY_NAMES}
HINTS ${CEGUI_LIBRARY_DIR_REL} ${CEGUI_LIBRARY_DIR_REL}/cegui-${CEGUI_VERSION_MAJOR}.${CEGUI_VERSION_MINOR}
PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
find_library(CEGUI_CoreWindowRendererSet_LIBRARY_DBG NAMES ${CEGUI_CoreWindowRendererSet_LIBRARY_NAMES_DBG}
HINTS ${CEGUI_LIBRARY_DIR_DBG} ${CEGUI_LIBRARY_DIR_DBG}/cegui-${CEGUI_VERSION_MAJOR}.${CEGUI_VERSION_MINOR}
PATH_SUFFIXES "" "debug")
make_library_set(CEGUI_CoreWindowRendererSet_LIBRARY)
findpkg_finish(CEGUI_CoreWindowRendererSet)
#PRINT_COMPONENT_INFO(CoreWindowRendererSet)
#Search renderer components
foreach (comp ${CEGUI_RENDERER_COMPONENTS})
findpkg_begin(CEGUI_${comp})
string(REPLACE "Renderer" "" compName ${comp})
#message("compName:" ${compName})
find_path(CEGUI_${comp}_INCLUDE_DIR NAMES Renderer.h
HINTS ${CEGUI_INCLUDE_DIRS}
PATH_SUFFIXES RendererModules/${compName} CEGUI/RendererModules/${compName})
#message("comp incl dir:" ${CEGUI_${comp}_INCLUDE_DIR})
set(CEGUI_${comp}_LIBRARY_NAMES "CEGUI${comp}-${CEGUI_VERSION_MAJOR}${CEGUI_LIB_SUFFIX}")
get_debug_names(CEGUI_${comp}_LIBRARY_NAMES)
#message("renderer stuff:" ${CEGUI_${comp}_LIBRARY_NAMES} "|" ${CEGUI_LIBRARY_DIR_REL})
find_library(CEGUI_${comp}_LIBRARY_REL NAMES ${CEGUI_${comp}_LIBRARY_NAMES}
HINTS ${CEGUI_LIBRARY_DIR_REL}
PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
find_library(CEGUI_${comp}_LIBRARY_DBG NAMES ${CEGUI_${comp}_LIBRARY_NAMES_DBG}
HINTS ${CEGUI_LIBRARY_DIR_DBG}
PATH_SUFFIXES "" "debug")
make_library_set(CEGUI_${comp}_LIBRARY)
findpkg_finish(CEGUI_${comp})
#PRINT_COMPONENT_INFO(${comp})
endforeach (comp)
#Search image codec components
foreach (comp ${CEGUI_IMAGECODEC_COMPONENTS})
findpkg_begin(CEGUI_${comp})
find_path(CEGUI_${comp}_INCLUDE_DIR NAMES ImageCodec.h
HINTS ${CEGUI_INCLUDE_DIRS}
PATH_SUFFIXES ImageCodecModules/${comp} CEGUI/ImageCodecModules/${comp})
set(CEGUI_${comp}_LIBRARY_NAMES "CEGUI${comp}${CEGUI_LIB_SUFFIX}")
get_debug_names(CEGUI_${comp}_LIBRARY_NAMES)
#message("image codec stuff: " ${CEGUI_${comp}_LIBRARY_NAMES} ${CEGUI_LIBRARY_DIR_REL})
find_library(CEGUI_${comp}_LIBRARY_REL NAMES ${CEGUI_${comp}_LIBRARY_NAMES}
HINTS ${CEGUI_LIBRARY_DIR_REL} ${CEGUI_LIBRARY_DIR_REL}/cegui-${CEGUI_VERSION_MAJOR}.${CEGUI_VERSION_MINOR}
PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
find_library(CEGUI_${comp}_LIBRARY_DBG NAMES ${CEGUI_${comp}_LIBRARY_NAMES_DBG}
HINTS ${CEGUI_LIBRARY_DIR_DBG} ${CEGUI_LIBRARY_DIR_DBG}/cegui-${CEGUI_VERSION_MAJOR}.${CEGUI_VERSION_MINOR}
PATH_SUFFIXES "" "debug")
make_library_set(CEGUI_${comp}_LIBRARY)
findpkg_finish(CEGUI_${comp})
#PRINT_COMPONENT_INFO(${comp})
endforeach (comp)
#Search parser components
foreach (comp ${CEGUI_PARSER_COMPONENTS})
findpkg_begin(CEGUI_${comp})
find_path(CEGUI_${comp}_INCLUDE_DIR NAMES XMLParser.h
HINTS ${CEGUI_INCLUDE_DIRS}
PATH_SUFFIXES XMLParserModules/${comp} CEGUI/XMLParserModules/${comp} )
set(CEGUI_${comp}_LIBRARY_NAMES "CEGUI${comp}${CEGUI_LIB_SUFFIX}")
get_debug_names(CEGUI_${comp}_LIBRARY_NAMES)
#message("parser stuff: " ${CEGUI_${comp}_LIBRARY_NAMES} )
find_library(CEGUI_${comp}_LIBRARY_REL NAMES ${CEGUI_${comp}_LIBRARY_NAMES}
HINTS ${CEGUI_LIBRARY_DIR_REL} ${CEGUI_LIBRARY_DIR_REL}/cegui-${CEGUI_VERSION_MAJOR}.${CEGUI_VERSION_MINOR}
PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
find_library(CEGUI_${comp}_LIBRARY_DBG NAMES ${CEGUI_${comp}_LIBRARY_NAMES_DBG}
HINTS ${CEGUI_LIBRARY_DIR_DBG} ${CEGUI_LIBRARY_DIR_DBG}/cegui-${CEGUI_VERSION_MAJOR}.${CEGUI_VERSION_MINOR}
PATH_SUFFIXES "" "debug")
make_library_set(CEGUI_${comp}_LIBRARY)
findpkg_finish(CEGUI_${comp})
#PRINT_COMPONENT_INFO(${comp})
endforeach (comp)
foreach (comp ${CEGUI_SCRIPT_COMPONENTS})
findpkg_begin(CEGUI_${comp})
string(REPLACE "ScriptModule" "" compName ${comp})
# message("comp: " ${comp})
# message("compName: " ${compName})
find_path(CEGUI_${comp}_INCLUDE_DIR NAMES ScriptModule.h
HINTS ${CEGUI_INCLUDE_DIRS}
PATH_SUFFIXES ScriptingModules/${compName} CEGUI/ScriptingModules/${compName})
set(CEGUI_${comp}_LIBRARY_NAMES "CEGUI${comp}-${CEGUI_VERSION_MAJOR}${CEGUI_LIB_SUFFIX}")
#message("script stuff: " ${CEGUI_${comp}_LIBRARY_NAMES} )
get_debug_names(CEGUI_${comp}_LIBRARY_NAMES)
find_library(CEGUI_${comp}_LIBRARY_REL NAMES ${CEGUI_${comp}_LIBRARY_NAMES}
HINTS ${CEGUI_LIBRARY_DIR_REL}
PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
find_library(CEGUI_${comp}_LIBRARY_DBG NAMES ${CEGUI_${comp}_LIBRARY_NAMES_DBG}
HINTS ${CEGUI_LIBRARY_DIR_DBG}
PATH_SUFFIXES "" "debug")
make_library_set(CEGUI_${comp}_LIBRARY)
findpkg_finish(CEGUI_${comp})
#PRINT_COMPONENT_INFO(${comp})
endforeach (comp)
clear_if_changed(CEGUI_PREFIX_WATCH)
#stop the build to debug FindCEGUI.cmake
#message(FATAL_ERROR "Debug FindCEGUI")

144
cmake/FindPkgMacros.cmake Normal file
View File

@ -0,0 +1,144 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
##################################################################
# Provides some common functionality for the FindPackage modules
##################################################################
# Begin processing of package
macro(findpkg_begin PREFIX)
if (NOT ${PREFIX}_FIND_QUIETLY)
message(STATUS "Looking for ${PREFIX}...")
endif ()
endmacro(findpkg_begin)
# Display a status message unless FIND_QUIETLY is set
macro(pkg_message PREFIX)
if (NOT ${PREFIX}_FIND_QUIETLY)
message(STATUS ${ARGN})
endif ()
endmacro(pkg_message)
# Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes
macro(getenv_path VAR)
set(ENV_${VAR} $ENV{${VAR}})
# replace won't work if var is blank
if (ENV_${VAR})
string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
endif ()
endmacro(getenv_path)
# Construct search paths for includes and libraries from a PREFIX_PATH
macro(create_search_paths PREFIX)
foreach(dir ${${PREFIX}_PREFIX_PATH})
set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH}
${dir}/include ${dir}/include/${PREFIX} ${dir}/Headers)
set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH}
${dir}/lib ${dir}/lib/${PREFIX} ${dir}/Libs)
set(${PREFIX}_BIN_SEARCH_PATH ${${PREFIX}_BIN_SEARCH_PATH}
${dir}/bin)
endforeach(dir)
set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH})
endmacro(create_search_paths)
# clear cache variables if a certain variable changed
macro(clear_if_changed TESTVAR)
# test against internal check variable
if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}")
message(STATUS "${TESTVAR} changed.")
foreach(var ${ARGN})
set(${var} "NOTFOUND" CACHE STRING "x" FORCE)
endforeach(var)
endif ()
set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE)
endmacro(clear_if_changed)
# Try to get some hints from pkg-config, if available
macro(use_pkgconfig PREFIX PKGNAME)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(${PREFIX} ${PKGNAME})
endif ()
endmacro (use_pkgconfig)
# Couple a set of release AND debug libraries (or frameworks)
macro(make_library_set PREFIX)
if (${PREFIX}_FWK)
set(${PREFIX} ${${PREFIX}_FWK})
elseif (${PREFIX}_REL AND ${PREFIX}_DBG)
set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG})
elseif (${PREFIX}_REL)
set(${PREFIX} ${${PREFIX}_REL})
elseif (${PREFIX}_DBG)
set(${PREFIX} ${${PREFIX}_DBG})
endif ()
endmacro(make_library_set)
# Generate debug names from given release names
macro(get_debug_names PREFIX)
foreach(i ${${PREFIX}})
set(${PREFIX}_DBG ${${PREFIX}_DBG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
endforeach(i)
endmacro(get_debug_names)
# Add the parent dir from DIR to VAR
macro(add_parent_dir VAR DIR)
get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
set(${VAR} ${${VAR}} ${${DIR}_TEMP})
endmacro(add_parent_dir)
# Do the final processing for the package find.
macro(findpkg_finish PREFIX)
# skip if already processed during this run
if (NOT ${PREFIX}_FOUND)
if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
set(${PREFIX}_FOUND TRUE)
set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
if (NOT ${PREFIX}_FIND_QUIETLY)
message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}")
endif ()
else ()
if (NOT ${PREFIX}_FIND_QUIETLY)
message(STATUS "Could not locate ${PREFIX}")
endif ()
if (${PREFIX}_FIND_REQUIRED)
message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.")
endif ()
endif ()
mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK)
endif ()
endmacro(findpkg_finish)
# Slightly customised framework finder
MACRO(findpkg_framework fwk)
IF(APPLE)
SET(${fwk}_FRAMEWORK_PATH
${${fwk}_FRAMEWORK_SEARCH_PATH}
${CMAKE_FRAMEWORK_PATH}
~/Library/Frameworks
/Library/Frameworks
/System/Library/Frameworks
/Network/Library/Frameworks
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
)
FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
SET(fwkpath ${dir}/${fwk}.framework)
IF(EXISTS ${fwkpath})
SET(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES}
${fwkpath}/Headers ${fwkpath}/PrivateHeaders)
if (NOT ${fwk}_LIBRARY_FWK)
SET(${fwk}_LIBRARY_FWK "-framework ${fwk}")
endif ()
ENDIF(EXISTS ${fwkpath})
ENDFOREACH(dir)
ENDIF(APPLE)
ENDMACRO(findpkg_framework)

View File

@ -0,0 +1,60 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE)
string(REGEX MATCH
"# *define +${KEYWORD} +((\"([^\n]*)\")|([^ \n]*))"
PREPROC_TEMP_VAR
${${CONTENTS}}
)
if (CMAKE_MATCH_3)
set(${VARIABLE} ${CMAKE_MATCH_3})
else ()
set(${VARIABLE} ${CMAKE_MATCH_4})
endif ()
endmacro()
macro(has_preprocessor_entry CONTENTS KEYWORD VARIABLE)
string(REGEX MATCH
"\n *# *define +(${KEYWORD})"
PREPROC_TEMP_VAR
${${CONTENTS}}
)
if (CMAKE_MATCH_1)
set(${VARIABLE} TRUE)
else ()
set(${VARIABLE} FALSE)
endif ()
endmacro()
macro(replace_preprocessor_entry VARIABLE KEYWORD NEW_VALUE)
string(REGEX REPLACE
"(// *)?# *define +${KEYWORD} +[^ \n]*"
"#define ${KEYWORD} ${NEW_VALUE}"
${VARIABLE}_TEMP
${${VARIABLE}}
)
set(${VARIABLE} ${${VARIABLE}_TEMP})
endmacro()
macro(set_preprocessor_entry VARIABLE KEYWORD ENABLE)
if (${ENABLE})
set(TMP_REPLACE_STR "#define ${KEYWORD}")
else ()
set(TMP_REPLACE_STR "// #define ${KEYWORD}")
endif ()
string(REGEX REPLACE
"(// *)?# *define +${KEYWORD} *\n"
${TMP_REPLACE_STR}
${VARIABLE}_TEMP
${${VARIABLE}}
)
set(${VARIABLE} ${${VARIABLE}_TEMP})
endmacro()

2
data

@ -1 +1 @@
Subproject commit 8c148a8d5dd57e3662b3422d7c50b55ce518b22e
Subproject commit d5ae8cf17083f8fc029842c098ee05c8c6dcc8d0

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2013-01-20 14:26+0100\n"
"POT-Creation-Date: 2014-03-14 16:36+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -132,4 +132,3 @@ msgstr ""
#: colobot.pod:47
msgid "This manpage was written by Didier Raboud <S<odyx@debian.org>>."
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-27 17:09+0100\n"
"POT-Creation-Date: 2014-03-24 20:46+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -53,9 +53,6 @@ msgstr ""
msgid "COLOBOT"
msgstr ""
msgid "COLOBOT: Gold Edition"
msgstr ""
msgid "Programming exercises"
msgstr ""
@ -246,6 +243,72 @@ msgstr ""
msgid "Recorder"
msgstr ""
msgid "Back\\Go back to previous menu"
msgstr ""
msgid "COLOBOT: Gold Edition"
msgstr ""
msgid "Start game\\Singleplayer"
msgstr ""
msgid "Multiplayer\\Play with friends!"
msgstr ""
msgid "Credits\\Credits"
msgstr ""
msgid "Change player\\Change player"
msgstr ""
msgid "Options\\Preferences"
msgstr ""
msgid "Start game"
msgstr ""
msgid "Missions\\Select mission"
msgstr ""
msgid "Free game\\Free game without a specific goal"
msgstr ""
msgid "Exercises\\Programming exercises"
msgstr ""
msgid "Challenges\\Programming challenges"
msgstr ""
msgid "Userlevels\\Custom missions"
msgstr ""
msgid "Multiplayer"
msgstr ""
msgid "Colobot: Gold Edition"
msgstr ""
msgid "Project director:"
msgstr ""
msgid "Programmers:"
msgstr ""
msgid "2D graphics:"
msgstr ""
msgid "3D graphics:"
msgstr ""
msgid "Original game developed by:"
msgstr ""
msgid "Gold Edition developed by:"
msgstr ""
msgid "Original version creators:"
msgstr ""
msgid "OK"
msgstr ""
@ -258,27 +321,6 @@ msgstr ""
msgid "Menu (\\key quit;)"
msgstr ""
msgid "Exercises\\Programming exercises"
msgstr ""
msgid "Challenges\\Programming challenges"
msgstr ""
msgid "Missions\\Select mission"
msgstr ""
msgid "Free game\\Free game without a specific goal"
msgstr ""
msgid "User\\User levels"
msgstr ""
msgid "Change player\\Change player"
msgstr ""
msgid "Options\\Preferences"
msgstr ""
msgid "Restart\\Restart the mission from the beginning"
msgstr ""
@ -641,6 +683,9 @@ msgstr ""
msgid "Take off to finish the mission"
msgstr ""
msgid "Destroy"
msgstr ""
msgid "Build a derrick"
msgstr ""
@ -680,6 +725,9 @@ msgstr ""
msgid "Build a exchange post"
msgstr ""
msgid "Build a destroyer"
msgstr ""
msgid "Show if the ground is flat"
msgstr ""
@ -809,6 +857,9 @@ msgstr ""
msgid "Shoot (\\key action;)"
msgstr ""
msgid "Explode (\\key action;)"
msgstr ""
msgid "Recycle (\\key action;)"
msgstr ""
@ -1280,6 +1331,9 @@ msgstr ""
msgid "Lunar Roving Vehicle"
msgstr ""
msgid "Internal error - tell the developers"
msgstr ""
msgid "Unknown command"
msgstr ""
@ -1340,6 +1394,12 @@ msgstr ""
msgid "Too close to a building"
msgstr ""
msgid "Can not produce this object in this mission"
msgstr ""
msgid "Can not produce not researched object"
msgstr ""
msgid "Ground inappropriate"
msgstr ""
@ -1445,6 +1505,12 @@ msgstr ""
msgid "No flag nearby"
msgstr ""
msgid "Not found anything to destroy"
msgstr ""
msgid "Inappropriate object"
msgstr ""
msgid ""
"The mission is not accomplished yet (press \\key help; for more details)"
msgstr ""
@ -1789,10 +1855,6 @@ msgstr ""
msgid "speed20;"
msgstr ""
#, c-format
msgid "GetResource event num out of range: %d\n"
msgstr ""
msgid "Ctrl"
msgstr ""
@ -1810,4 +1872,3 @@ msgstr ""
msgid "%1"
msgstr ""

View File

@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-27 17:09+0100\n"
"POT-Creation-Date: 2014-03-24 20:46+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@ -79,6 +79,12 @@ msgstr "1) Klicken Sie auf die neu zu definierende Taste."
msgid "2) Then press the key you want to use instead."
msgstr "2) Drücken Sie auf die neue Taste."
msgid "2D graphics:"
msgstr ""
msgid "3D graphics:"
msgstr ""
msgid "3D sound\\3D positioning of the sound"
msgstr "3D-Geräusche\\Orten der Geräusche im Raum"
@ -161,6 +167,9 @@ msgstr "Automatisches Einrücken\\Beim Bearbeiten der Programme"
msgid "Back"
msgstr "Vorherg. Seite"
msgid "Back\\Go back to previous menu"
msgstr "Zurück\\Zurück zum Hauptmenü"
msgid "Background sound :\\Volume of audio tracks on the CD"
msgstr "Geräuschkulisse:\\Lautstärke der Soundtracks der CD"
@ -203,6 +212,9 @@ msgstr "Baut einen Geschützturm"
msgid "Build a derrick"
msgstr "Baut einen Bohrturm"
msgid "Build a destroyer"
msgstr ""
msgid "Build a exchange post"
msgstr "Baut einen Infoserver"
@ -338,6 +350,12 @@ msgstr "Kamera rechts"
msgid "Can not create this; there are too many objects"
msgstr "Kein neues Objekt kann erstellt werden (zu viele vorhanden)"
msgid "Can not produce not researched object"
msgstr ""
msgid "Can not produce this object in this mission"
msgstr ""
msgid "Can't open file"
msgstr "Die Datei kann nicht geöffnet werden"
@ -380,6 +398,9 @@ msgstr "Es fehlt eine geschlossene Klammer \")\""
msgid "Colobot rules!"
msgstr "Colobot ist wunderbar!"
msgid "Colobot: Gold Edition"
msgstr "Colobot: Gold Edition"
msgid "Command line"
msgstr "Befehleingabe"
@ -413,6 +434,9 @@ msgstr "Kopieren"
msgid "Copy (Ctrl+c)"
msgstr "Kopieren (Ctrl+c)"
msgid "Credits\\Credits"
msgstr ""
msgid "Ctrl"
msgstr "Ctrl"
@ -446,6 +470,9 @@ msgstr "Bohrturm"
msgid "Descend\\Reduces the power of the jet"
msgstr "Sinken\\Leistung des Triebwerks drosseln"
msgid "Destroy"
msgstr ""
msgid "Destroy the building"
msgstr "Gebäude sprengen"
@ -525,6 +552,9 @@ msgstr "Programmieren\\Programmierübungen"
msgid "Exit film\\Film at the exit of exercises"
msgstr "Zurücksetzen \\Kleine Show beim Zurücksetzen in den Übungen"
msgid "Explode (\\key action;)"
msgstr ""
msgid "Explosive"
msgstr "Sprengstoff"
@ -622,8 +652,7 @@ msgstr "Spiel\\Gameplay Einstellungen"
msgid "Gantry crane"
msgstr "Träger"
#, c-format
msgid "GetResource event num out of range: %d\n"
msgid "Gold Edition developed by:"
msgstr ""
msgid "Goto: destination occupied"
@ -695,6 +724,9 @@ msgstr "Roboter ungeeignet"
msgid "Inappropriate cell type"
msgstr "Falscher Batterietyp"
msgid "Inappropriate object"
msgstr "Roboter ungeeignet"
msgid "Incorrect index type"
msgstr "Falscher Typ für einen Index"
@ -731,6 +763,9 @@ msgstr "Anweisungen von Houston"
msgid "Instructions\\Shows the instructions for the current mission"
msgstr "Anweisungen\\Anweisungen für die Mission oder Übung"
msgid "Internal error - tell the developers"
msgstr ""
msgid "Jet temperature"
msgstr "Triebwerktemperatur"
@ -824,6 +859,12 @@ msgstr "Umkehr Y\\Umkehr der Kameradrehung Y-Achse"
msgid "Mouse shadow\\Gives the mouse a shadow"
msgstr "Schatten unter der Maus\\Ein Schatten erscheint unter der Maus"
msgid "Multiplayer"
msgstr ""
msgid "Multiplayer\\Play with friends!"
msgstr ""
msgid "Mute\\No sound"
msgstr "Kein Ton\\Keine Geräusche und Geräuschkulisse"
@ -911,6 +952,9 @@ msgstr "Nicht genug Energie"
msgid "Not enough energy yet"
msgstr "Noch nicht genug Energie"
msgid "Not found anything to destroy"
msgstr ""
msgid "Not yet enough energy"
msgstr "Noch nicht genug Energie"
@ -992,6 +1036,12 @@ msgstr "Orgastoff"
msgid "Origin of last message\\Shows where the last message was sent from"
msgstr "Ort der Meldung\\Zeigt den Ort, von dem die letzte Meldung stammt"
msgid "Original game developed by:"
msgstr ""
msgid "Original version creators:"
msgstr ""
msgid "Parameters missing "
msgstr "Nicht genug Parameter"
@ -1094,6 +1144,9 @@ msgstr "Programm beendet"
msgid "Program infected by a virus"
msgstr "Ein Programm wurde von einem Virus infiziert"
msgid "Programmers:"
msgstr ""
msgid "Programming exercises"
msgstr "Programmieren"
@ -1109,6 +1162,9 @@ msgstr "Hilfe CBOT-Sprache\\Hilfe über die Programmiersprache CBOT"
msgid "Programs dispatched by Houston"
msgstr "Von Houston übermittelte Programme"
msgid "Project director:"
msgstr ""
msgid "Public required"
msgstr "Hier muss das Wort \"public\" stehen"
@ -1354,6 +1410,12 @@ msgstr "Standard\\Standardfarben einsetzen"
msgid "Start"
msgstr "Startfläche"
msgid "Start game"
msgstr ""
msgid "Start game\\Singleplayer"
msgstr ""
msgid "Still working ..."
msgstr "Prozess im Gang ..."
@ -1533,8 +1595,8 @@ msgstr "Joystick\\Joystick oder Tastatur"
msgid "User levels"
msgstr "Userlevels"
msgid "User\\User levels"
msgstr "User\\Userlevels"
msgid "Userlevels\\Custom missions"
msgstr ""
msgid "Variable name missing"
msgstr "Es fehlt der Name einer Variable"

View File

@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-27 17:09+0100\n"
"POT-Creation-Date: 2014-03-24 20:46+0100\n"
"PO-Revision-Date: 2012-12-27 14:07+0100\n"
"Last-Translator: Didier Raboud <odyx@debian.org>\n"
"Language: fr\n"
@ -84,6 +84,12 @@ msgstr "1) Cliquez d'abord sur la touche à redéfinir."
msgid "2) Then press the key you want to use instead."
msgstr "2) Appuyez ensuite sur la nouvelle touche souhaitée."
msgid "2D graphics:"
msgstr ""
msgid "3D graphics:"
msgstr ""
msgid "3D sound\\3D positioning of the sound"
msgstr "Bruitages 3D\\Positionnement sonore dans l'espace"
@ -165,6 +171,9 @@ msgstr "Indentation automatique\\Pendant l'édition d'un programme"
msgid "Back"
msgstr "Page précédente"
msgid "Back\\Go back to previous menu"
msgstr "Retour\\Retour au niveau précédent"
msgid "Background sound :\\Volume of audio tracks on the CD"
msgstr "Fond sonore :\\Volume des pistes audio du CD"
@ -207,6 +216,9 @@ msgstr "Construit une tour"
msgid "Build a derrick"
msgstr "Construit un derrick"
msgid "Build a destroyer"
msgstr ""
msgid "Build a exchange post"
msgstr "Construit une borne d'information"
@ -342,6 +354,12 @@ msgstr "Caméra à droite"
msgid "Can not create this; there are too many objects"
msgstr "Création impossible; il y a trop d'objets"
msgid "Can not produce not researched object"
msgstr ""
msgid "Can not produce this object in this mission"
msgstr ""
msgid "Can't open file"
msgstr "Ouverture du fichier impossible"
@ -384,6 +402,9 @@ msgstr "Il manque une parenthèse fermante"
msgid "Colobot rules!"
msgstr "Colobot est super!"
msgid "Colobot: Gold Edition"
msgstr "Colobot: Gold Edition"
msgid "Command line"
msgstr "Console de commande"
@ -417,6 +438,9 @@ msgstr "Copier"
msgid "Copy (Ctrl+c)"
msgstr "Copier (Ctrl+c)"
msgid "Credits\\Credits"
msgstr ""
msgid "Ctrl"
msgstr "Ctrl"
@ -450,6 +474,9 @@ msgstr "Derrick"
msgid "Descend\\Reduces the power of the jet"
msgstr "Descendre\\Diminuer la puissance du réacteur"
msgid "Destroy"
msgstr ""
msgid "Destroy the building"
msgstr "Démolit le bâtiment"
@ -529,6 +556,9 @@ msgstr "Programmation\\Exercices de programmation"
msgid "Exit film\\Film at the exit of exercises"
msgstr "Retour animé\\Retour animé dans les exercices"
msgid "Explode (\\key action;)"
msgstr ""
msgid "Explosive"
msgstr "Explosif"
@ -626,8 +656,7 @@ msgstr "Jeu\\Options de jouabilité"
msgid "Gantry crane"
msgstr "Portique"
#, c-format
msgid "GetResource event num out of range: %d\n"
msgid "Gold Edition developed by:"
msgstr ""
msgid "Goto: destination occupied"
@ -699,6 +728,9 @@ msgstr "Robot inadapté"
msgid "Inappropriate cell type"
msgstr "Pas le bon type de pile"
msgid "Inappropriate object"
msgstr "Robot inadapté"
msgid "Incorrect index type"
msgstr "Mauvais type d'index"
@ -735,6 +767,9 @@ msgstr "Instructions de Houston"
msgid "Instructions\\Shows the instructions for the current mission"
msgstr "Instructions mission\\Marche à suivre"
msgid "Internal error - tell the developers"
msgstr ""
msgid "Jet temperature"
msgstr "Température du réacteur"
@ -830,6 +865,12 @@ msgstr ""
msgid "Mouse shadow\\Gives the mouse a shadow"
msgstr "Souris ombrée\\Jolie souris avec une ombre"
msgid "Multiplayer"
msgstr ""
msgid "Multiplayer\\Play with friends!"
msgstr ""
msgid "Mute\\No sound"
msgstr "Silencieux\\Totalement silencieux"
@ -917,6 +958,9 @@ msgstr "Pas assez d'énergie"
msgid "Not enough energy yet"
msgstr "Pas encore assez d'énergie"
msgid "Not found anything to destroy"
msgstr ""
msgid "Not yet enough energy"
msgstr "Pas encore assez d'énergie"
@ -998,6 +1042,12 @@ msgstr "Matière organique"
msgid "Origin of last message\\Shows where the last message was sent from"
msgstr "Montrer le lieu d'un message\\Montrer le lieu du dernier message"
msgid "Original game developed by:"
msgstr ""
msgid "Original version creators:"
msgstr ""
msgid "Parameters missing "
msgstr "Pas assez de paramètres"
@ -1100,6 +1150,9 @@ msgstr "Programme terminé"
msgid "Program infected by a virus"
msgstr "Un programme est infecté par un virus"
msgid "Programmers:"
msgstr ""
msgid "Programming exercises"
msgstr "Programmation"
@ -1115,6 +1168,9 @@ msgstr "Instructions programmation\\Explication sur la programmation"
msgid "Programs dispatched by Houston"
msgstr "Programmes envoyés par Houston"
msgid "Project director:"
msgstr ""
msgid "Public required"
msgstr "Public requis"
@ -1361,6 +1417,12 @@ msgstr "Standard\\Remet les couleurs standards"
msgid "Start"
msgstr "Départ"
msgid "Start game"
msgstr ""
msgid "Start game\\Singleplayer"
msgstr ""
msgid "Still working ..."
msgstr "Travail en cours ..."
@ -1539,8 +1601,8 @@ msgstr "Utilise un joystick\\Joystick ou clavier"
msgid "User levels"
msgstr "Niveaux supplémentaires"
msgid "User\\User levels"
msgstr "Suppl.\\Niveaux supplémentaires"
msgid "Userlevels\\Custom missions"
msgstr ""
msgid "Variable name missing"
msgstr "Nom d'une variable attendu"

View File

@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-27 17:09+0100\n"
"POT-Creation-Date: 2014-03-24 20:46+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@ -80,6 +80,12 @@ msgstr "1) Najpierw kliknij klawisz, który chcesz przedefiniować."
msgid "2) Then press the key you want to use instead."
msgstr "2) Następnie naciśnij klawisz, którego chcesz używać."
msgid "2D graphics:"
msgstr "Graficy 2D:"
msgid "3D graphics:"
msgstr "Graficy 3D:"
msgid "3D sound\\3D positioning of the sound"
msgstr "Dźwięk 3D\\Przestrzenne pozycjonowanie dźwięków"
@ -161,6 +167,9 @@ msgstr "Automatyczne wcięcia\\Automatyczne wcięcia podczas edycji programu"
msgid "Back"
msgstr "Wstecz"
msgid "Back\\Go back to previous menu"
msgstr "Wstecz\\Wraca do poprzedniego ekranu"
msgid "Background sound :\\Volume of audio tracks on the CD"
msgstr "Muzyka w tle :\\Głośność ścieżek dźwiękowych z płyty CD"
@ -205,6 +214,9 @@ msgstr "Zbuduj wieżę obronną"
msgid "Build a derrick"
msgstr "Zbuduj kopalnię"
msgid "Build a destroyer"
msgstr "Zbuduj niszczarkę"
msgid "Build a exchange post"
msgstr "Zbuduj stację przekaźnikową"
@ -340,6 +352,12 @@ msgstr "Camera to right"
msgid "Can not create this; there are too many objects"
msgstr "Nie można tego utworzyć, za dużo obiektów"
msgid "Can not produce not researched object"
msgstr "Nie można stworzyć niezbadanego obiektu"
msgid "Can not produce this object in this mission"
msgstr "Nie można stworzyć tego obiektu w tej misji"
msgid "Can't open file"
msgstr "Nie można otworzyć pliku"
@ -382,6 +400,9 @@ msgstr "Brak nawiasu zamykającego"
msgid "Colobot rules!"
msgstr "Colobot rządzi!"
msgid "Colobot: Gold Edition"
msgstr "Colobot: Gold Edition"
msgid "Command line"
msgstr "Linia polecenia"
@ -415,6 +436,9 @@ msgstr "Kopiuj"
msgid "Copy (Ctrl+c)"
msgstr "Kopiuj (Ctrl+C)"
msgid "Credits\\Credits"
msgstr "Autorzy\\Informacje o autorach"
msgid "Ctrl"
msgstr "Ctrl"
@ -448,6 +472,9 @@ msgstr "Kopalnia"
msgid "Descend\\Reduces the power of the jet"
msgstr "W dół\\Zmniejsza moc silnika"
msgid "Destroy"
msgstr "Zniszcz"
msgid "Destroy the building"
msgstr "Zniszcz budynek"
@ -527,6 +554,9 @@ msgstr "Ćwiczenia\\Ćwiczenia programistyczne"
msgid "Exit film\\Film at the exit of exercises"
msgstr "Końcowy film\\Film na zakończenie ćwiczeń"
msgid "Explode (\\key action;)"
msgstr "Wybuchnij (\\key action;)"
msgid "Explosive"
msgstr "Materiały wybuchowe"
@ -624,9 +654,8 @@ msgstr "Gra\\Ustawienia gry"
msgid "Gantry crane"
msgstr "Żuraw przesuwalny"
#, c-format
msgid "GetResource event num out of range: %d\n"
msgstr ""
msgid "Gold Edition developed by:"
msgstr "Złota Edycja stworzona przez:"
msgid "Goto: destination occupied"
msgstr "Goto: miejsce docelowe zajęte"
@ -698,6 +727,9 @@ msgstr "Nieodpowiedni robot"
msgid "Inappropriate cell type"
msgstr "Nieodpowiedni rodzaj ogniw"
msgid "Inappropriate object"
msgstr "Nieodpowiedni robot"
msgid "Incorrect index type"
msgstr "Nieprawidłowy typ indeksu"
@ -734,6 +766,9 @@ msgstr "Rozkazy z Houston"
msgid "Instructions\\Shows the instructions for the current mission"
msgstr "Rozkazy\\Pokazuje rozkazy dotyczące bieżącej misji"
msgid "Internal error - tell the developers"
msgstr "Błąd wewnętrzny - powiedz developerom"
msgid "Jet temperature"
msgstr "Temperatura silnika"
@ -829,6 +864,12 @@ msgstr "Odwrócenie myszy Y\\Odwrócenie kierunków przewijania w pionie"
msgid "Mouse shadow\\Gives the mouse a shadow"
msgstr "Cień kursora myszy\\Dodaje cień kursorowi myszy"
msgid "Multiplayer"
msgstr "Tryb wieloosobowy"
msgid "Multiplayer\\Play with friends!"
msgstr "Tryb wieloosobowy\\Graj z kolegami!"
msgid "Mute\\No sound"
msgstr "Cisza\\Brak dźwięków"
@ -916,6 +957,9 @@ msgstr "Za mało energii"
msgid "Not enough energy yet"
msgstr "Wciąż za mało energii"
msgid "Not found anything to destroy"
msgstr "Nie ma nic do zniszczenia"
msgid "Not yet enough energy"
msgstr "Wciąż za mało energii"
@ -998,6 +1042,12 @@ msgid "Origin of last message\\Shows where the last message was sent from"
msgstr ""
"Miejsce nadania wiadomości\\Pokazuje skąd została wysłana ostatnia wiadomość"
msgid "Original game developed by:"
msgstr "Oryginalna gra stworzona przez:"
msgid "Original version creators:"
msgstr "Twórcy oryginalnej gry:"
msgid "Parameters missing "
msgstr "Brak wymaganego parametru"
@ -1101,6 +1151,9 @@ msgstr "Program zakończony"
msgid "Program infected by a virus"
msgstr "Program zawirusowany"
msgid "Programmers:"
msgstr "Programiści:"
msgid "Programming exercises"
msgstr "Ćwiczenia programistyczne"
@ -1116,6 +1169,9 @@ msgstr "Podręcznik programowania\\Dostarcza szczegółową pomoc w programowani
msgid "Programs dispatched by Houston"
msgstr "Program dostarczony z Houston"
msgid "Project director:"
msgstr "Kierownik projektu:"
msgid "Public required"
msgstr "Wymagany publiczny"
@ -1364,6 +1420,12 @@ msgstr "Standardowe\\Standardowe ustawienia wyglądu"
msgid "Start"
msgstr "Początek"
msgid "Start game"
msgstr "Rozpocznij grę"
msgid "Start game\\Singleplayer"
msgstr "Rozpocznij grę\\Tryb dla jednego gracza"
msgid "Still working ..."
msgstr "Wciąż pracuje..."
@ -1543,8 +1605,8 @@ msgstr "Używaj joysticka\\Joystick lub klawiatura"
msgid "User levels"
msgstr "Poziomy użytkownika"
msgid "User\\User levels"
msgstr "Poziomy\\Poziomy użytkownika"
msgid "Userlevels\\Custom missions"
msgstr "Poziomy użytkownika\\Własne misje"
msgid "Variable name missing"
msgstr "Brak nazwy zmiennej"

View File

@ -3,12 +3,11 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-27 17:09+0100\n"
"POT-Creation-Date: 2014-03-24 20:46+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -89,6 +88,12 @@ msgstr "1) Сначала нажми на клавишу, которую вы х
msgid "2) Then press the key you want to use instead."
msgstr "2) После этого нажмите на клавишу, которую вы хотите использовать."
msgid "2D graphics:"
msgstr ""
msgid "3D graphics:"
msgstr ""
msgid "3D sound\\3D positioning of the sound"
msgstr "3D-звук\\Стерео звук"
@ -168,6 +173,9 @@ msgstr "Автоматический отступ\\При редактирова
msgid "Back"
msgstr "Назад"
msgid "Back\\Go back to previous menu"
msgstr "Назад\\Вернуться на предыдущую страницу"
msgid "Background sound :\\Volume of audio tracks on the CD"
msgstr "Фоновый звук:\\Громкость звуковых дорожек на CD"
@ -210,6 +218,9 @@ msgstr "Построить защитную башню"
msgid "Build a derrick"
msgstr "Построить буровую вышку"
msgid "Build a destroyer"
msgstr ""
msgid "Build a exchange post"
msgstr "Построить пост по обмену сообщениями"
@ -345,6 +356,12 @@ msgstr "Камеру вправо"
msgid "Can not create this; there are too many objects"
msgstr "Не удается это создать, слишком много объектов"
msgid "Can not produce not researched object"
msgstr ""
msgid "Can not produce this object in this mission"
msgstr ""
msgid "Can't open file"
msgstr "Невозможно открыть файл"
@ -387,6 +404,9 @@ msgstr "Закрывающая скобка отсутствует"
msgid "Colobot rules!"
msgstr "Правила игры!"
msgid "Colobot: Gold Edition"
msgstr ""
msgid "Command line"
msgstr "Командная строка"
@ -420,6 +440,9 @@ msgstr "Копировать"
msgid "Copy (Ctrl+c)"
msgstr "Копировать (Ctrl+C)"
msgid "Credits\\Credits"
msgstr ""
msgid "Ctrl"
msgstr "Ctrl"
@ -453,6 +476,9 @@ msgstr "Космический корабль"
msgid "Descend\\Reduces the power of the jet"
msgstr "Снижение и посадка\\Понижение мощности реактивного двигателя"
msgid "Destroy"
msgstr ""
msgid "Destroy the building"
msgstr "Уничтожить здание"
@ -532,6 +558,9 @@ msgstr "Упражнения\\Упражнения по программиров
msgid "Exit film\\Film at the exit of exercises"
msgstr "Ролик при выходе\\Ролик во время выхода из упражнения"
msgid "Explode (\\key action;)"
msgstr ""
msgid "Explosive"
msgstr "Взрывчатка"
@ -629,9 +658,8 @@ msgstr "Игра\\Настройки игры"
msgid "Gantry crane"
msgstr "Козловой кран"
#, c-format
msgid "GetResource event num out of range: %d\n"
msgstr "событие GetResource, число вне диапазона: %d\n"
msgid "Gold Edition developed by:"
msgstr ""
msgid "Goto: destination occupied"
msgstr "Перейти: место занято"
@ -702,6 +730,9 @@ msgstr "Неверный бот"
msgid "Inappropriate cell type"
msgstr "Батарея не подходит"
msgid "Inappropriate object"
msgstr "Неверный бот"
msgid "Incorrect index type"
msgstr "Неверный тип индекса"
@ -738,6 +769,9 @@ msgstr "Инструкции из Хьюстона"
msgid "Instructions\\Shows the instructions for the current mission"
msgstr "Инструкции\\Показывает инструкции по текущей миссии"
msgid "Internal error - tell the developers"
msgstr ""
msgid "Jet temperature"
msgstr "Температура реактивного двигателя"
@ -831,6 +865,12 @@ msgstr "Инверсия мыши по оси Y\\Инверсия прокрут
msgid "Mouse shadow\\Gives the mouse a shadow"
msgstr "Тень мыши\\Мышь отбрасывает тень"
msgid "Multiplayer"
msgstr ""
msgid "Multiplayer\\Play with friends!"
msgstr ""
msgid "Mute\\No sound"
msgstr "Без звука\\Без звука"
@ -918,6 +958,9 @@ msgstr "Не хватает энергии"
msgid "Not enough energy yet"
msgstr "Не хватает энергии"
msgid "Not found anything to destroy"
msgstr ""
msgid "Not yet enough energy"
msgstr "Не хватает энергии"
@ -1001,6 +1044,12 @@ msgstr ""
"Источник сообщения\\Показывает место, откуда было отправлено последнеее "
"сообщение"
msgid "Original game developed by:"
msgstr ""
msgid "Original version creators:"
msgstr ""
msgid "Parameters missing "
msgstr "Отсутствуют параметры "
@ -1103,6 +1152,9 @@ msgstr "Программа выполнена"
msgid "Program infected by a virus"
msgstr "Программа заражена вирусом"
msgid "Programmers:"
msgstr ""
msgid "Programming exercises"
msgstr "Упражнения"
@ -1119,6 +1171,9 @@ msgstr ""
msgid "Programs dispatched by Houston"
msgstr "Программы переданные с Хьюстона"
msgid "Project director:"
msgstr ""
msgid "Public required"
msgstr "Требуется общественное"
@ -1365,6 +1420,12 @@ msgstr "По умолчанию\\Настройки внешнего вида п
msgid "Start"
msgstr "Начало"
msgid "Start game"
msgstr ""
msgid "Start game\\Singleplayer"
msgstr ""
msgid "Still working ..."
msgstr "Работает ..."
@ -1544,8 +1605,8 @@ msgstr "Использовать джойстик\\Джойстик или кл
msgid "User levels"
msgstr "Пользовательские уровни"
msgid "User\\User levels"
msgstr "Польз.\\Пользовательские уровни"
msgid "Userlevels\\Custom missions"
msgstr ""
msgid "Variable name missing"
msgstr "Нет имени переменной"

View File

@ -156,6 +156,9 @@ script/cbottoken.cpp
script/cmdtoken.cpp
script/script.cpp
sound/sound.cpp
ui/screen/menu.cpp
ui/screen/splash.cpp
ui/screen/credits.cpp
ui/button.cpp
ui/check.cpp
ui/color.cpp
@ -199,6 +202,8 @@ ${PNG_LIBRARIES}
${GLEW_LIBRARY}
${Boost_LIBRARIES}
${LIBSNDFILE_LIBRARY}
${CEGUI_LIBRARIES}
${CEGUI_OpenGLRenderer_LIBRARIES}
${OPTIONAL_LIBS}
${PLATFORM_LIBS}
)
@ -221,8 +226,9 @@ ${GLEW_INCLUDE_PATH}
${Boost_INCLUDE_DIRS}
${LIBSNDFILE_INCLUDE_DIR}
${LOCALENAME_INCLUDE_DIR}
${OPTIONAL_INCLUDE_DIRS}
${CLIPBOARD_INCLUDE_DIR}
${CEGUI_INCLUDE_DIRS}
${OPTIONAL_INCLUDE_DIRS}
)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/CBot)

View File

@ -48,6 +48,9 @@
#include <getopt.h>
#include <localename.h>
#include <CEGUI/CEGUI.h>
#include <GL/glew.h>
template<> CApplication* CSingleton<CApplication>::m_instance = nullptr;
@ -568,7 +571,7 @@ bool CApplication::Create()
if (! m_runSceneName.empty())
m_robotMain->LoadSceneOnStart(m_runSceneName, m_runSceneRank);
else
m_robotMain->ChangePhase(PHASE_WELCOME1);
m_robotMain->ChangePhase(PHASE_SPLASH);
return true;
}
@ -1008,10 +1011,77 @@ const std::string& CApplication::GetErrorMessage() const
return m_errorMessage;
}
void CApplication::InjectEvent()
{
SDL_Event e = m_private->currentEvent;
switch(e.type)
{
case SDL_MOUSEMOTION:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMousePosition(
static_cast<float>(e.motion.x),
static_cast<float>(e.motion.y)
);
break;
case SDL_MOUSEBUTTONDOWN:
switch(e.button.button)
{
case SDL_BUTTON_LEFT:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown(CEGUI::LeftButton);
break;
case SDL_BUTTON_MIDDLE:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown(CEGUI::MiddleButton);
break;
case SDL_BUTTON_RIGHT:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown(CEGUI::RightButton);
break;
case SDL_BUTTON_WHEELDOWN:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseWheelChange( -1 );
break;
case SDL_BUTTON_WHEELUP:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseWheelChange( +1 );
break;
}
break;
case SDL_MOUSEBUTTONUP:
switch(e.button.button)
{
case SDL_BUTTON_LEFT:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp(CEGUI::LeftButton);
break;
case SDL_BUTTON_MIDDLE:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp(CEGUI::MiddleButton);
break;
case SDL_BUTTON_RIGHT:
CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp(CEGUI::RightButton);
break;
}
break;
case SDL_KEYDOWN:
CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyDown(static_cast<CEGUI::Key::Scan>(e.key.keysym.scancode));
if ((e.key.keysym.unicode != 0))
CEGUI::System::getSingleton().getDefaultGUIContext().injectChar(e.key.keysym.unicode);
break;
case SDL_KEYUP:
CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyUp(static_cast<CEGUI::Key::Scan>(e.key.keysym.scancode));
break;
}
}
/** The SDL event parsed is stored internally.
If event is not available or is not understood, returned event is of type EVENT_NULL. */
Event CApplication::ProcessSystemEvent()
{
InjectEvent();
Event event;
if (m_private->currentEvent.type == SDL_QUIT)
@ -1482,6 +1552,10 @@ bool CApplication::ParseDebugModes(const std::string& str, int& debugModes)
{
debugModes |= DEBUG_MODELS;
}
else if (modeToken == "cegui")
{
debugModes |= DEBUG_CEGUI;
}
else if (modeToken == "all")
{
debugModes = DEBUG_ALL;

View File

@ -149,7 +149,8 @@ enum DebugMode
DEBUG_APP_EVENTS = 1 << 1,
DEBUG_EVENTS = DEBUG_SYS_EVENTS | DEBUG_APP_EVENTS,
DEBUG_MODELS = 1 << 2,
DEBUG_ALL = DEBUG_SYS_EVENTS | DEBUG_APP_EVENTS | DEBUG_MODELS
DEBUG_CEGUI = 1 << 3,
DEBUG_ALL = DEBUG_SYS_EVENTS | DEBUG_APP_EVENTS | DEBUG_MODELS | DEBUG_CEGUI
};
struct ApplicationPrivate;
@ -369,6 +370,8 @@ protected:
//! Processes the captured SDL event to Event struct
Event ProcessSystemEvent();
//! Inject an event to CEGUI
void InjectEvent();
//! If applicable, creates a virtual event to match the changed state as of new event
Event CreateVirtualEvent(const Event& sourceEvent);
//! Prepares a simulation update event

View File

@ -27,7 +27,9 @@
#define COLOBOT_VERSION "@COLOBOT_VERSION_FULL@"
#define COLOBOT_CODENAME "@COLOBOT_VERSION_CODENAME@"
#define COLOBOT_FULLNAME "Colobot @COLOBOT_VERSION_CODENAME@"
#define COLOBOT_VERSION_DISPLAY_NOCEGUI "@COLOBOT_VERSION_DISPLAY_NOCEGUI@"
#define COLOBOT_VERSION_DISPLAY "@COLOBOT_VERSION_DISPLAY@"
#define COLOBOT_VERSION_DATE "@COLOBOT_VERSION_DATE@"
#define COLOBOT_DEFAULT_DATADIR "@COLOBOT_INSTALL_DATA_DIR@"
#define COLOBOT_I18N_DIR "@COLOBOT_INSTALL_I18N_DIR@"

View File

@ -15,6 +15,7 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
#include "app/app.h"
#include "common/logger.h"
#include <stdio.h>
@ -195,3 +196,16 @@ bool CLogger::ParseLogLevel(const std::string& str, LogLevel& logLevel)
return false;
}
void CLogger::logEvent(const CEGUI::String &message, CEGUI::LoggingLevel level)
{
if(!CApplication::GetInstancePointer()->IsDebugModeActive(DEBUG_CEGUI)) return;
switch(level) {
case CEGUI::LoggingLevel::Errors: Error("%s\n", message.c_str()); break;
case CEGUI::LoggingLevel::Warnings: Warn("%s\n", message.c_str()); break;
case CEGUI::LoggingLevel::Standard: Info("%s\n", message.c_str()); break;
case CEGUI::LoggingLevel::Informative: Debug("%s\n", message.c_str()); break;
case CEGUI::LoggingLevel::Insane: Trace("%s\n", message.c_str()); break;
}
}

View File

@ -24,6 +24,7 @@
#include "common/singleton.h"
#include <CEGUI/CEGUI.h>
#include <string>
#include <cstdarg>
#include <cstdio>
@ -51,7 +52,7 @@ enum LogLevel
* @brief Class for loggin information to file or console
*
*/
class CLogger : public CSingleton<CLogger>
class CLogger : public CSingleton<CLogger>, public CEGUI::Logger
{
public:
CLogger();
@ -111,6 +112,9 @@ public:
* On invalid value, returns \c false.
*/
static bool ParseLogLevel(const std::string& str, LogLevel& logLevel);
void logEvent(const CEGUI::String &message, CEGUI::LoggingLevel level);
void setLogFilename(const CEGUI::String &filename, bool append) {}; // We don't need this
private:
std::string m_filename;

View File

@ -33,6 +33,7 @@
#include <SDL_keyboard.h>
const char* stringsText[RT_MAX] = { nullptr };
const char* stringsUi[RUIT_MAX] = { nullptr };
const char* stringsEvent[EVENT_STD_MAX] = { nullptr };
const char* stringsObject[OBJECT_MAX] = { nullptr };
const char* stringsErr[ERR_MAX] = { nullptr };
@ -56,7 +57,6 @@ void InitializeRestext()
stringsText[RT_KEY_OR] = " or ";
stringsText[RT_TITLE_BASE] = "COLOBOT";
stringsText[RT_TITLE_INIT] = "COLOBOT: Gold Edition";
stringsText[RT_TITLE_TRAINER] = "Programming exercises";
stringsText[RT_TITLE_DEFI] = "Challenges";
stringsText[RT_TITLE_MISSION] = "Missions";
@ -137,6 +137,36 @@ void InitializeRestext()
stringsUi[RUIT_BACK] = "Back\\Go back to previous menu";
stringsUi[RUIT_TITLE_INIT] = "COLOBOT: Gold Edition";
stringsUi[RUIT_STARTGAME] = "Start game\\Singleplayer";
stringsUi[RUIT_MULTIPLAYER] = "Multiplayer\\Play with friends!";
stringsUi[RUIT_CREDITS] = "Credits\\Credits";
stringsUi[RUIT_NAME] = "Change player\\Change player";
stringsUi[RUIT_SETUP] = "Options\\Preferences";
stringsUi[RUIT_QUIT] = "Quit\\Quit COLOBOT";
stringsUi[RUIT_TITLE_STARTGAME] = "Start game";
stringsUi[RUIT_MISSIONS] = "Missions\\Select mission";
stringsUi[RUIT_FREEGAME] = "Free game\\Free game without a specific goal";
stringsUi[RUIT_EXERCISES] = "Exercises\\Programming exercises";
stringsUi[RUIT_CHALLENGES] = "Challenges\\Programming challenges";
stringsUi[RUIT_USERLVL] = "Userlevels\\Custom missions";
stringsUi[RUIT_TITLE_MULTIPLAYER] = "Multiplayer";
stringsUi[RUIT_GAMENAME] = "Colobot: Gold Edition";
stringsUi[RUIT_DIRECTOR] = "Project director:";
stringsUi[RUIT_PROGRAMMERS] = "Programmers:";
stringsUi[RUIT_2DGRAPHICS] = "2D graphics:";
stringsUi[RUIT_3DGRAPHICS] = "3D graphics:";
stringsUi[RUIT_GOLD_BY] = "Gold Edition developed by:";
stringsUi[RUIT_ORIGINAL_BY] = "Original game developed by:";
stringsUi[RUIT_ORIGINAL_CREATORS] = "Original version creators:";
stringsEvent[EVENT_BUTTON_OK] = "OK";
stringsEvent[EVENT_BUTTON_CANCEL] = "Cancel";
stringsEvent[EVENT_BUTTON_NEXT] = "Next";
@ -146,19 +176,10 @@ void InitializeRestext()
stringsEvent[EVENT_DIALOG_OK] = "OK";
stringsEvent[EVENT_DIALOG_CANCEL] = "Cancel";
stringsEvent[EVENT_INTERFACE_TRAINER] = "Exercises\\Programming exercises";
stringsEvent[EVENT_INTERFACE_DEFI] = "Challenges\\Programming challenges";
stringsEvent[EVENT_INTERFACE_MISSION] = "Missions\\Select mission";
stringsEvent[EVENT_INTERFACE_FREE] = "Free game\\Free game without a specific goal";
stringsEvent[EVENT_INTERFACE_TEEN] = "Free game\\Free game without a specific goal";
stringsEvent[EVENT_INTERFACE_USER] = "User\\User levels";
stringsEvent[EVENT_INTERFACE_NAME] = "Change player\\Change player";
stringsEvent[EVENT_INTERFACE_SETUP] = "Options\\Preferences";
stringsEvent[EVENT_INTERFACE_AGAIN] = "Restart\\Restart the mission from the beginning";
stringsEvent[EVENT_INTERFACE_WRITE] = "Save\\Save the current mission ";
stringsEvent[EVENT_INTERFACE_READ] = "Load\\Load a saved mission";
stringsEvent[EVENT_INTERFACE_ABORT] = "\\Return to COLOBOT";
stringsEvent[EVENT_INTERFACE_QUIT] = "Quit\\Quit COLOBOT";
stringsEvent[EVENT_INTERFACE_BACK] = "<< Back \\Back to the previous screen";
stringsEvent[EVENT_INTERFACE_PLAY] = "Play\\Start mission!";
stringsEvent[EVENT_INTERFACE_SETUPd] = "Device\\Driver and resolution settings";
@ -833,6 +854,11 @@ static const char* GetResourceBase(ResType type, int num)
assert(num < RT_MAX);
str = stringsText[num];
break;
case RES_UI:
assert(num < RUIT_MAX);
str = stringsUi[num];
break;
case RES_EVENT:
if (num >= EVENT_STD_MAX)

View File

@ -34,11 +34,12 @@
enum ResType
{
RES_TEXT = 0, //! < RT_*
RES_EVENT = 1, //! < EVENT_* (EventMsg)
RES_OBJECT = 2, //! < OBJECT_* (ObjectType)
RES_ERR = 3, //! < ERR_* (Error)
RES_KEY = 4, //! < KEY() (keys)
RES_CBOT = 5, //! < TX_* (CBot)
RES_UI = 1, //! < RUIT_*
RES_EVENT = 2, //! < EVENT_* (EventMsg)
RES_OBJECT = 3, //! < OBJECT_* (ObjectType)
RES_ERR = 4, //! < ERR_* (Error)
RES_KEY = 5, //! < KEY() (keys)
RES_CBOT = 6, //! < TX_* (CBot)
};
/**
@ -147,6 +148,43 @@ enum ResTextType
RT_MAX //! < number of values
};
/**
* \enum ResUiTextType
* \brief Interface text resources available for translation
*/
enum ResUiTextType
{
RUIT_BACK = 1,
RUIT_TITLE_INIT = 10,
RUIT_STARTGAME = 11,
RUIT_MULTIPLAYER = 12,
RUIT_CREDITS = 13,
RUIT_NAME = 14,
RUIT_SETUP = 15,
RUIT_QUIT = 16,
RUIT_TITLE_STARTGAME = 20,
RUIT_MISSIONS = 21,
RUIT_FREEGAME = 22,
RUIT_EXERCISES = 23,
RUIT_CHALLENGES = 24,
RUIT_USERLVL = 25,
RUIT_TITLE_MULTIPLAYER = 30,
RUIT_GAMENAME = 40,
RUIT_DIRECTOR = 41,
RUIT_PROGRAMMERS = 42,
RUIT_2DGRAPHICS = 43,
RUIT_3DGRAPHICS = 44,
RUIT_GOLD_BY = 45,
RUIT_ORIGINAL_BY = 46,
RUIT_ORIGINAL_CREATORS = 47,
RUIT_MAX //! < number of values
};
// TODO: move to CRobotMain

View File

@ -44,6 +44,8 @@
#include <iomanip>
#include <CEGUI/CEGUI.h>
template<> Gfx::CEngine* CSingleton<Gfx::CEngine>::m_instance = nullptr;
// Graphics module namespace
@ -3408,6 +3410,9 @@ void CEngine::DrawInterface()
{
interface->Draw();
}
m_device->SetTextureEnabled(0, false);
CEGUI::System::getSingleton().renderAllGUIContexts();
m_interfaceMode = false;
m_lastState = -1;
@ -3505,7 +3510,7 @@ void CEngine::DrawInterface()
DrawOverColor();
// At the end to not overlap
DrawMouse();
//DrawMouse();
DrawHighlight();
DrawStats();
}

View File

@ -1203,7 +1203,7 @@ void CRobotMain::ChangePhase(Phase phase)
m_fixScene = false;
}
if (m_phase == PHASE_INIT)
if (m_phase == PHASE_MENU)
{
m_engine->DeleteTexture("generic.png");
}
@ -1792,7 +1792,7 @@ bool CRobotMain::ProcessEvent(Event &event)
event.key.key == KEY(RETURN))
{
if (m_winTerminate)
ChangePhase(PHASE_INIT);
ChangePhase(PHASE_MENU);
else
ChangePhase(PHASE_TERM);
}
@ -1800,7 +1800,7 @@ bool CRobotMain::ProcessEvent(Event &event)
case EVENT_BUTTON_OK:
if (m_winTerminate)
ChangePhase(PHASE_INIT);
ChangePhase(PHASE_MENU);
else
ChangePhase(PHASE_TERM);

View File

@ -36,7 +36,7 @@
enum Phase
{
PHASE_INIT,
PHASE_MENU,
PHASE_TERM,
PHASE_NAME,
PHASE_PERSO,
@ -65,10 +65,8 @@ enum Phase
PHASE_READs,
PHASE_WIN,
PHASE_LOST,
PHASE_WELCOME1,
PHASE_WELCOME2,
PHASE_WELCOME3,
PHASE_GENERIC,
PHASE_SPLASH,
PHASE_CREDITS,
};

View File

@ -59,6 +59,8 @@ void CSoundInterface::AddMusicFiles(const std::string &path)
CacheMusic("Intro2.ogg");
CacheMusic("music010.ogg");
CacheMusic("music011.ogg");
CacheMusic("music012.ogg");
CacheMusic("Prototype.ogg");
}
bool CSoundInterface::Cache(Sound bSound, const std::string &bFile)

View File

@ -17,6 +17,7 @@
#include "ui/maindialog.h"
#include "app/app.h"
#include "app/system.h"
@ -34,6 +35,10 @@
#include "script/cmdtoken.h"
#include "sound/sound.h"
#include "ui/screen/menu.h"
#include "ui/screen/splash.h"
#include "ui/screen/credits.h"
#include "ui/interface.h"
#include "ui/button.h"
#include "ui/color.h"
@ -57,6 +62,10 @@
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <CEGUI/CEGUI.h>
#include <CEGUI/RendererModules/OpenGL/GLRenderer.h>
#include <CEGUI/DefaultResourceProvider.h>
//TODO Get rid of all sprintf's
namespace Ui {
@ -191,12 +200,77 @@ CMainDialog::CMainDialog()
m_setupFull = m_app->GetVideoConfig().fullScreen;
m_bDialog = false;
InitCEGUI();
RegisterScreen(new CScreenSplash());
RegisterScreen(new CScreenMenu());
RegisterScreen(new CScreenCredits());
}
// Initialise CEGUI
void CMainDialog::InitCEGUI()
{
CEGUI::OpenGLRenderer& renderer = CEGUI::OpenGLRenderer::create();
renderer.enableExtraStateSettings(true);
CEGUI::System::create( renderer );
CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());
std::string dataDir = CApplication::GetInstancePointer()->GetDataDirPath();
std::string interfaceDir = dataDir+"/interface";
// XML files
rp->setResourceGroupDirectory("schemes", interfaceDir+"/schemes/");
rp->setResourceGroupDirectory("imagesets", interfaceDir+"/imagesets/");
rp->setResourceGroupDirectory("fonts", interfaceDir+"/fonts/");
rp->setResourceGroupDirectory("layouts", interfaceDir+"/layouts/");
rp->setResourceGroupDirectory("looknfeels", interfaceDir+"/looknfeel/");
rp->setResourceGroupDirectory("animations", interfaceDir+"/animations/");
// data files
rp->setResourceGroupDirectory("textures", dataDir+"/textures/");
rp->setResourceGroupDirectory("ttf", dataDir+"/fonts/");
CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");
CEGUI::Font::setDefaultResourceGroup("fonts");
CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");
CEGUI::AnimationManager::setDefaultResourceGroup("animations");
CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("colobot.scheme");
CEGUI::AnimationManager::getSingleton().loadAnimationsFromXML("colobot.animations");
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("ColobotMouse/Normal");
CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultFont("dvu_sans-11");
CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultTooltipType("WindowsLook/Tooltip");
CEGUI::Window *rootWindow = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "root");
CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(rootWindow);
#if DEV_BUILD
CEGUI::Window *testWindow = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("debug.layout");
testWindow->setAlwaysOnTop(true);
rootWindow->addChild(testWindow);
#endif
}
// Destructor of robot application.
CMainDialog::~CMainDialog()
{
for(auto s : m_screens)
{
delete s;
}
}
// Registers a screen.
void CMainDialog::RegisterScreen(CScreen* screen)
{
m_screens.insert(screen);
}
@ -221,6 +295,7 @@ void CMainDialog::ChangePhase(Phase phase)
std::string name;
char* gamer;
int res, i, j;
Phase fromPhase = m_phase;
m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
m_engine->SetOverFront(false);
@ -239,162 +314,23 @@ void CMainDialog::ChangePhase(Phase phase)
oy = 3.0f/480.0f;
sx = (32.0f+2.0f)/640.0f;
sy = (32.0f+2.0f)/480.0f;
if ( m_phase == PHASE_INIT )
for ( auto s : m_screens )
{
pos.x = 0.35f;
pos.y = 0.10f;
ddim.x = 0.30f;
ddim.y = 0.80f;
/* TODO: #if _TEEN
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
#else*/
pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5);
GetResource(RES_TEXT, RT_TITLE_INIT, name);
pw->SetName(name);
pos.x = 0.35f;
pos.y = 0.60f;
ddim.x = 0.30f;
ddim.y = 0.30f;
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
pos.x = 0.35f;
pos.y = 0.10f;
ddim.x = 0.30f;
ddim.y = 0.30f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
/* TODO: #if _SCHOOL
ddim.x = 0.20f;
ddim.y = dim.y*2.4f;
pos.x = 0.40f;
pos.y = oy+sy*7.9f;
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // orange
pg->SetState(STATE_SHADOW);
pos.y = oy+sy*3.9f;
pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // orange
pg->SetState(STATE_SHADOW);
ddim.y = dim.y*1.2f;
pos.y = oy+sy*1.9f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red
pg->SetState(STATE_SHADOW);
#else */
ddim.x = 0.20f;
ddim.y = dim.y*2.4f;
pos.x = 0.40f;
if ( m_accessEnable && m_accessMission )
if(s->m_enabledPhases.find(phase) != s->m_enabledPhases.end() && s->m_enabledPhases.find(fromPhase) == s->m_enabledPhases.end())
{
pos.y = oy+sy*9.1f;
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // yellow
pg->SetState(STATE_SHADOW);
s->m_enabled = true;
s->Start();
}
pos.y = oy+sy*6.8f;
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // orange
pg->SetState(STATE_SHADOW);
pos.y = oy+sy*3.9f;
pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // orange
pg->SetState(STATE_SHADOW);
ddim.y = dim.y*1.2f;
pos.y = oy+sy*1.9f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red
pg->SetState(STATE_SHADOW);
/* TODO: #if _SCHOOL
ddim.x = 0.18f;
ddim.y = dim.y*1;
pos.x = 0.41f;
pos.y = oy+sy*9.1f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TRAINER);
pb->SetState(STATE_SHADOW);
pos.y = oy+sy*8.0f;
#if _TEEN
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TEEN);
#else
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_DEFI);
#endif
#if _CEEBOTDEMO
pb->ClearState(STATE_ENABLE);
#endif
pb->SetState(STATE_SHADOW);
#else */
ddim.x = 0.18f;
ddim.y = dim.y*1;
pos.x = 0.41f;
if ( m_accessEnable && m_accessMission )
if(s->m_enabled)
s->ChangePhase(phase);
if(s->m_enabledPhases.find(phase) == s->m_enabledPhases.end() && s->m_enabledPhases.find(fromPhase) != s->m_enabledPhases.end())
{
pos.y = oy+sy*10.3f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_MISSION);
pb->SetState(STATE_SHADOW);
pos.y = oy+sy*9.2f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_FREE);
pb->SetState(STATE_SHADOW);
s->Stop();
s->m_enabled = false;
}
pos.y = oy+sy*8.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TRAINER);
pb->SetState(STATE_SHADOW);
pos.y = oy+sy*6.9f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_DEFI);
pb->SetState(STATE_SHADOW);
pos.y = oy+sy*5.1f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUP);
pb->SetState(STATE_SHADOW);
pos.y = oy+sy*4.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NAME);
pb->SetState(STATE_SHADOW);
pos.y = oy+sy*2.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_QUIT);
pb->SetState(STATE_SHADOW);
#if DEV_BUILD
// TODO: #if !_DEMO & !_SCHOOL
if ( m_accessEnable && m_accessUser )
{
pos.x = 447.0f/640.0f;
pos.y = 313.0f/480.0f;
ddim.x = 0.09f;
/*#if _POLISH
pos.x -= 5.0f/640.0f;
ddim.x += 10.0f/640.0f;
#endif*/
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER);
pb->SetState(STATE_SHADOW);
}
// #endif
#endif
/*pos.x = 139.0f/640.0f;
pos.y = 313.0f/480.0f;
ddim.x = 0.09f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PROTO);
pb->SetState(STATE_SHADOW);*/
pos.x = 0.40f;
ddim.x = 0.20f;
pos.y = 26.0f/480.0f;
ddim.y = 12.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 1, EVENT_LABEL1);
pg->SetState(STATE_SHADOW);
pos.y -= 5.0f/480.0f;
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "PPC Team");
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
m_engine->SetBackground("interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
true);
m_engine->SetBackForce(true);
}
if ( m_phase == PHASE_NAME )
@ -1750,191 +1686,7 @@ pos.y -= 0.048f;
m_loadingCounter = 1; // enough time to display!
}
if ( m_phase == PHASE_WELCOME1 )
{
pos.x = 0.0f;
pos.y = 0.0f;
ddim.x = 0.0f;
ddim.y = 0.0f;
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
m_engine->SetOverColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok?
m_engine->SetOverFront(true);
m_engine->SetBackground("ppc.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
true);
m_engine->SetBackForce(true);
}
if ( m_phase == PHASE_WELCOME2 )
{
pos.x = 0.0f;
pos.y = 0.0f;
ddim.x = 0.0f;
ddim.y = 0.0f;
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok?
m_engine->SetOverFront(true);
m_engine->SetBackground("colobot.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
true);
m_engine->SetBackForce(true);
}
if ( m_phase == PHASE_WELCOME3 )
{
pos.x = 0.0f;
pos.y = 0.0f;
ddim.x = 0.0f;
ddim.y = 0.0f;
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok?
m_engine->SetOverFront(true);
m_engine->SetBackground("epsitec.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
true);
m_engine->SetBackForce(true);
}
if ( m_phase == PHASE_GENERIC )
{
pos.x = 0.0f;
pos.y = 0.0f;
ddim.x = 0.0f;
ddim.y = 0.0f;
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
// TODO: #if _FULL | _NET
pos.x = 80.0f/640.0f;
pos.y = 240.0f/480.0f;
ddim.x = 490.0f/640.0f;
ddim.y = 110.0f/480.0f;
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
pe->SetGenericMode(true);
pe->SetEditCap(false);
pe->SetHighlightCap(false);
pe->SetFontType(Gfx::FONT_COURIER);
pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt"));
// #endif
/* TODO: #if _SCHOOL
#if _CEEBOTDEMO
pos.x = 80.0f/640.0f;
pos.y = 210.0f/480.0f;
ddim.x = 490.0f/640.0f;
ddim.y = 150.0f/480.0f;
#else
pos.x = 80.0f/640.0f;
pos.y = 200.0f/480.0f;
ddim.x = 490.0f/640.0f;
ddim.y = 150.0f/480.0f;
#endif
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
pe->SetGenericMode(true);
pe->SetEditCap(false);
pe->SetHighlightCap(false);
pe->SetFontType(Gfx::FONT_COURIER);
pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
pe->ReadText("help/authors.txt");*/
/* #if _DEMO
//? pos.x = 80.0f/640.0f;
//? pos.y = 240.0f/480.0f;
//? ddim.x = 490.0f/640.0f;
//? ddim.y = 110.0f/480.0f;
//? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
//? pe->SetGenericMode(true);
//? pe->SetEditCap(false);
//? pe->SetHiliteCap(false);
//? pe->SetFontType(Gfx::FONT_COURIER);
//? pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
//? pe->ReadText("help/demo.txt");
//? pos.x = 80.0f/640.0f;
//? pos.y = 140.0f/480.0f;
//? ddim.x = 490.0f/640.0f;
//? ddim.y = 100.0f/480.0f;
//? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2);
//? pe->SetGenericMode(true);
//? pe->SetEditCap(false);
//? pe->SetHiliteCap(false);
//? pe->SetFontType(Gfx::FONT_COURIER);
//? pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
//? pe->ReadText("help/authors.txt");
#endif */
// TODO: #if !_DEMO
pos.x = 40.0f/640.0f;
pos.y = 83.0f/480.0f;
ddim.x = 246.0f/640.0f;
ddim.y = 16.0f/480.0f;
GetResource(RES_TEXT, RT_GENERIC_DEV1, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
pos.y = 13.0f/480.0f;
GetResource(RES_TEXT, RT_GENERIC_DEV2, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
pos.x = 355.0f/640.0f;
pos.y = 83.0f/480.0f;
ddim.x = 246.0f/640.0f;
ddim.y = 16.0f/480.0f;
GetResource(RES_TEXT, RT_GENERIC_EDIT1, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL3, name);
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
pos.y = 13.0f/480.0f;
GetResource(RES_TEXT, RT_GENERIC_EDIT2, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL4, name);
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
// #endif
/* TODO: #if _DEMO
pos.x = 481.0f/640.0f;
pos.y = 51.0f/480.0f;
ddim.x = 30.0f/640.0f;
ddim.y = 30.0f/480.0f;
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
pb->SetState(STATE_SHADOW);
#else */
pos.x = 306.0f/640.0f;
pos.y = 17.0f/480.0f;
ddim.x = 30.0f/640.0f;
ddim.y = 30.0f/480.0f;
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
pb->SetState(STATE_SHADOW);
// #endif
m_engine->SetBackground("generico.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
true);
m_engine->SetBackForce(true);
}
if ( m_phase == PHASE_INIT ||
m_phase == PHASE_NAME ||
if ( m_phase == PHASE_NAME ||
m_phase == PHASE_TRAINER ||
m_phase == PHASE_DEFI ||
m_phase == PHASE_MISSION ||
@ -1968,7 +1720,7 @@ ddim.y = 9.0f/480.0f;
ddim.y = 10.0f/480.0f;
//#endif
//GetResource(RES_TEXT, RT_VERSION_ID, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY_NOCEGUI);
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(9.0f);
}
@ -1987,15 +1739,43 @@ bool CMainDialog::EventProcess(const Event &event)
CButton* pb;
CCheck* pc;
Event newEvent;
float welcomeLength;
for ( auto s : m_screens )
{
if(s->m_enabled)
s->EventProcess(event);
}
if ( event.type == EVENT_FRAME )
{
m_phaseTime += event.rTime;
//? if ( m_phase == PHASE_WELCOME1 ) welcomeLength = WELCOME_LENGTH+2.0f;
//? else welcomeLength = WELCOME_LENGTH;
welcomeLength = WELCOME_LENGTH;
CEGUI::System::getSingleton().injectTimePulse(event.rTime);
CEGUI::String mouseImage;
switch(m_engine->GetMouseType())
{
default:
case Gfx::ENG_MOUSE_NORM: mouseImage = "ColobotMouse/Normal"; break;
case Gfx::ENG_MOUSE_WAIT: mouseImage = "ColobotMouse/Wait"; break;
case Gfx::ENG_MOUSE_EDIT: mouseImage = "ColobotMouse/Edit"; break;
case Gfx::ENG_MOUSE_HAND: mouseImage = "ColobotMouse/Hand"; break;
case Gfx::ENG_MOUSE_CROSS: mouseImage = "ColobotMouse/Cross"; break;
//? case Gfx::ENG_MOUSE_SHOW: mouseImage = "ColobotMouse/?"; break;
case Gfx::ENG_MOUSE_NO: mouseImage = "ColobotMouse/No"; break;
case Gfx::ENG_MOUSE_MOVE: mouseImage = "ColobotMouse/Resize"; break;
case Gfx::ENG_MOUSE_MOVEH: mouseImage = "ColobotMouse/ResizeH"; break;
case Gfx::ENG_MOUSE_MOVEV: mouseImage = "ColobotMouse/ResizeV"; break;
case Gfx::ENG_MOUSE_MOVED: mouseImage = "ColobotMouse/ResizeDL"; break;
case Gfx::ENG_MOUSE_MOVEI: mouseImage = "ColobotMouse/ResizeDR"; break;
case Gfx::ENG_MOUSE_SCROLLL: mouseImage = "ColobotMouse/ScrollL"; break;
case Gfx::ENG_MOUSE_SCROLLR: mouseImage = "ColobotMouse/ScrollR"; break;
case Gfx::ENG_MOUSE_SCROLLU: mouseImage = "ColobotMouse/ScrollU"; break;
case Gfx::ENG_MOUSE_SCROLLD: mouseImage = "ColobotMouse/ScrollD"; break;
case Gfx::ENG_MOUSE_TARGET: mouseImage = "ColobotMouse/Target"; break;
}
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage(mouseImage);
if(CEGUI::System::getSingleton().getDefaultGUIContext().getWindowContainingMouse()->getMouseCursor(true) == CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().getDefaultImage())
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setImage(mouseImage);
if ( m_phase != PHASE_SIMUL &&
m_phase != PHASE_WIN &&
@ -2015,61 +1795,6 @@ bool CMainDialog::EventProcess(const Event &event)
}
}
if ( m_phase == PHASE_WELCOME1 ||
m_phase == PHASE_WELCOME2 ||
m_phase == PHASE_WELCOME3 )
{
float intensity;
int mode = Gfx::ENG_RSTATE_TCOLOR_WHITE;
// 1/4 of display time is animating
float animatingTime = welcomeLength / 4.0f;
if ( m_phaseTime < animatingTime )
{
//appearing
intensity = m_phaseTime / animatingTime;
}
else if ( m_phaseTime < welcomeLength - animatingTime )
{
//showing
intensity = 1.0f;
}
else
{
//hiding
intensity = (welcomeLength - m_phaseTime) / animatingTime;
}
if ( intensity < 0.0f ) intensity = 0.0f;
if ( intensity > 1.0f ) intensity = 1.0f;
//white first, others -> black fadding
if ( (m_phase == PHASE_WELCOME1) && ( m_phaseTime < welcomeLength/2.0f))
{
intensity = 1.0f - intensity;
mode = Gfx::ENG_RSTATE_TCOLOR_BLACK;
}
m_engine->SetOverColor(Gfx::Color(intensity, intensity, intensity, intensity), mode); // TODO: color ok?
}
if ( m_phase == PHASE_WELCOME1 && m_phaseTime >= welcomeLength )
{
ChangePhase(PHASE_WELCOME2);
return true;
}
if ( m_phase == PHASE_WELCOME2 && m_phaseTime >= welcomeLength )
{
ChangePhase(PHASE_WELCOME3);
return true;
}
if ( m_phase == PHASE_WELCOME3 && m_phaseTime >= welcomeLength )
{
ChangePhase(PHASE_NAME);
return true;
}
if ( m_shotDelay > 0 && !m_bDialog ) // screenshot done?
{
m_shotDelay --;
@ -2121,12 +1846,6 @@ bool CMainDialog::EventProcess(const Event &event)
{
NameDelete();
}
if ( m_phase == PHASE_INIT )
{
//? m_eventQueue->MakeEvent(newEvent, EVENT_QUIT);
//? m_eventQueue->AddEvent(newEvent);
m_main->ChangePhase(PHASE_GENERIC);
}
if ( m_phase == PHASE_SIMUL )
{
if ( m_bDialogDelete )
@ -2181,63 +1900,6 @@ bool CMainDialog::EventProcess(const Event &event)
return false;
}
if ( m_phase == PHASE_INIT )
{
switch( event.type )
{
case EVENT_KEY_DOWN:
if ( event.key.key == KEY(ESCAPE) )
{
//? StartQuit(); // would you leave?
m_sound->Play(SOUND_TZOING);
m_main->ChangePhase(PHASE_GENERIC);
}
break;
case EVENT_INTERFACE_QUIT:
//? StartQuit(); // would you leave?
m_sound->Play(SOUND_TZOING);
m_main->ChangePhase(PHASE_GENERIC);
break;
case EVENT_INTERFACE_TRAINER:
m_main->ChangePhase(PHASE_TRAINER);
break;
case EVENT_INTERFACE_DEFI:
m_main->ChangePhase(PHASE_DEFI);
break;
case EVENT_INTERFACE_MISSION:
m_main->ChangePhase(PHASE_MISSION);
break;
case EVENT_INTERFACE_FREE:
m_main->ChangePhase(PHASE_FREE);
break;
case EVENT_INTERFACE_TEEN:
m_main->ChangePhase(PHASE_TEEN);
break;
case EVENT_INTERFACE_USER:
m_main->ChangePhase(PHASE_USER);
break;
case EVENT_INTERFACE_SETUP:
m_main->ChangePhase(m_phaseSetup);
break;
case EVENT_INTERFACE_NAME:
m_main->ChangePhase(PHASE_NAME);
break;
default:
break;
}
return false;
}
if ( m_phase == PHASE_NAME )
{
switch( event.type )
@ -2255,7 +1917,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( pb == 0 ) break;
if ( pb->TestState(STATE_ENABLE) )
{
m_main->ChangePhase(PHASE_INIT);
m_main->ChangePhase(PHASE_MENU);
}
}
break;
@ -2279,7 +1941,7 @@ bool CMainDialog::EventProcess(const Event &event)
break;
case EVENT_INTERFACE_NCANCEL:
m_main->ChangePhase(PHASE_INIT);
m_main->ChangePhase(PHASE_MENU);
break;
case EVENT_INTERFACE_NDELETE:
@ -2302,7 +1964,7 @@ bool CMainDialog::EventProcess(const Event &event)
case EVENT_KEY_DOWN:
if ( event.key.key == KEY(RETURN) )
{
m_main->ChangePhase(PHASE_INIT);
m_main->ChangePhase(PHASE_MENU);
}
if ( event.key.key == KEY(ESCAPE) )
{
@ -2408,7 +2070,7 @@ bool CMainDialog::EventProcess(const Event &event)
break;
case EVENT_INTERFACE_POK:
m_main->ChangePhase(PHASE_INIT);
m_main->ChangePhase(PHASE_MENU);
break;
case EVENT_INTERFACE_PCANCEL:
@ -2436,7 +2098,7 @@ bool CMainDialog::EventProcess(const Event &event)
event.type == EVENT_INTERFACE_BACK ||
(event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
{
m_main->ChangePhase(PHASE_INIT);
m_main->ChangePhase(PHASE_MENU);
return false;
}
}
@ -2504,7 +2166,7 @@ bool CMainDialog::EventProcess(const Event &event)
{
SetupMemorize();
m_engine->ApplyChange();
m_main->ChangePhase(PHASE_INIT);
m_main->ChangePhase(PHASE_MENU);
return false;
}
@ -2983,59 +2645,6 @@ bool CMainDialog::EventProcess(const Event &event)
return false;
}
if ( m_phase == PHASE_WELCOME1 )
{
if ( event.type == EVENT_KEY_DOWN ||
event.type == EVENT_MOUSE_BUTTON_DOWN )
{
ChangePhase(PHASE_WELCOME2);
return true;
}
}
if ( m_phase == PHASE_WELCOME2 )
{
if ( event.type == EVENT_KEY_DOWN ||
event.type == EVENT_MOUSE_BUTTON_DOWN )
{
ChangePhase(PHASE_WELCOME3);
return true;
}
}
if ( m_phase == PHASE_WELCOME3 )
{
if ( event.type == EVENT_KEY_DOWN ||
event.type == EVENT_MOUSE_BUTTON_DOWN )
{
ChangePhase(PHASE_NAME);
return true;
}
}
if ( m_phase == PHASE_GENERIC )
{
if ( event.type == EVENT_INTERFACE_ABORT )
{
ChangePhase(PHASE_INIT);
}
if ( event.type == EVENT_KEY_DOWN )
{
if ( event.key.key == KEY(ESCAPE) )
{
ChangePhase(PHASE_INIT);
}
else
{
m_eventQueue->AddEvent(Event(EVENT_QUIT));
}
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN )
{
m_eventQueue->AddEvent(Event(EVENT_QUIT));
}
}
return true;
}
@ -3053,7 +2662,7 @@ void CMainDialog::GlintMove()
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
if ( m_phase == PHASE_INIT )
if ( m_phase == PHASE_MENU )
{
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl));
if ( pg != 0 )
@ -3305,7 +2914,7 @@ void CMainDialog::FrameParticle(float rTime)
if ( m_bDialog || !m_bRain ) return;
if ( m_phase == PHASE_INIT )
if ( m_phase == PHASE_MENU )
{
pParti = partiPosInit;
pGlint = glintPosInit;
@ -3822,7 +3431,7 @@ void CMainDialog::NameSelect()
else
{
m_main->SetGamerName(pl->GetItemName(sel));
m_main->ChangePhase(PHASE_INIT);
m_main->ChangePhase(PHASE_MENU);
}
GetGamerFace(m_main->GetGamerName());
@ -3898,7 +3507,7 @@ void CMainDialog::NameCreate()
SetGamerFace(name, 0);
m_main->SetGamerName(name);
m_main->ChangePhase(PHASE_INIT);
m_main->ChangePhase(PHASE_MENU);
}
// Deletes a folder and all its offspring.

View File

@ -14,20 +14,20 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
// maindialog.h
#pragma once
#include "app/pausemanager.h"
#include "graphics/core/color.h"
#include "object/robotmain.h"
#include "app/pausemanager.h"
#include "ui/screen/screen.h"
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <set>
#include <vector>
namespace fs = boost::filesystem;
@ -77,6 +77,8 @@ public:
bool EventProcess(const Event &event);
void ChangePhase(Phase phase);
void RegisterScreen(CScreen* screen);
void SetSceneRead(const char* name);
void SetStackRead(const char* name);
@ -142,6 +144,7 @@ public:
void ShowSoluceUpdate();
protected:
void InitCEGUI();
void GlintMove();
void FrameParticle(float rTime);
void NiceParticle(Math::Point mouse, bool bPress);
@ -267,6 +270,8 @@ protected:
SceneInfo m_sceneInfo[MAXSCENE];
std::vector<fs::path> m_saveList;
std::set<CScreen*> m_screens;
};
} // namespace Ui

142
src/ui/screen/credits.cpp Normal file
View File

@ -0,0 +1,142 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#include "ui/screen/credits.h"
#include "app/app.h"
#include "common/logger.h"
namespace Ui {
CScreenCredits::CScreenCredits()
{
m_window = nullptr;
m_currentWindow = nullptr;
m_currentWindowAnim = nullptr;
m_currentWindowIdx = 0;
CEGUI::AnimationManager::getSingleton().loadAnimationsFromXML("credits.animations");
m_enabledPhases.insert(PHASE_CREDITS);
}
CScreenCredits::~CScreenCredits()
{
Stop();
}
void CScreenCredits::Start()
{
m_window = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("credits.layout");
CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(m_window);
CApplication::GetInstancePointer()->GetSound()->PlayMusic("Prototype.ogg", false, 1.5f);
InitText("credits0_title", RUIT_GAMENAME);
InitText("credits1_title", RUIT_DIRECTOR);
InitText("credits2_title", RUIT_PROGRAMMERS);
InitText("credits3_title", RUIT_2DGRAPHICS);
InitText("credits4_title", RUIT_3DGRAPHICS);
InitText("credits5_title", RUIT_GOLD_BY);
InitText("credits6_title", RUIT_ORIGINAL_BY);
InitText("credits7_title", RUIT_ORIGINAL_CREATORS);
Next();
}
void CScreenCredits::Stop()
{
if(m_currentWindowAnim != nullptr) {
CEGUI::AnimationManager::getSingleton().destroyAnimationInstance(m_currentWindowAnim);
m_currentWindowAnim = nullptr;
}
if(m_window != nullptr) {
CEGUI::WindowManager::getSingleton().destroyWindow(m_window);
m_window = nullptr;
}
m_currentWindow = nullptr;
m_currentWindowIdx = 0;
}
void CScreenCredits::InitText(std::string name, ResUiTextType text)
{
std::string translated;
GetResource(RES_UI, text, translated);
m_window->getChildRecursive(name)->setText(reinterpret_cast<const CEGUI::utf8*>(translated.c_str()));
}
void CScreenCredits::Next()
{
if(m_currentWindowAnim != nullptr && m_currentWindowAnim->isRunning())
{
CEGUI::AnimationManager::getSingleton().destroyAnimationInstance(m_currentWindowAnim);
m_currentWindowAnim = nullptr;
}
if(m_currentWindowIdx == m_window->getChildCount()-1) {
m_currentWindow = nullptr;
return;
}
m_currentWindow = m_window->getChildAtIdx(++m_currentWindowIdx);
m_currentWindowAnim = CEGUI::AnimationManager::getSingleton().instantiateAnimation(m_currentWindow->getName()+ANIMATION_SUFFIX);
m_currentWindowAnim->setTargetWindow(m_currentWindow);
m_currentWindow->subscribeEvent(CEGUI::AnimationInstance::EventAnimationEnded, CEGUI::Event::Subscriber(&CScreenCredits::OnAnimationEnded, this));
m_currentWindowAnim->start();
}
bool CScreenCredits::OnAnimationEnded(const CEGUI::EventArgs& e)
{
Next();
return true;
}
bool CScreenCredits::EventProcess(const Event &event)
{
if ( event.type == EVENT_KEY_DOWN )
{
if ( event.key.key == KEY(ESCAPE) )
{
CApplication::GetInstancePointer()->GetSound()->PlayMusic("Intro1.ogg", false, 1.5f);
CRobotMain::GetInstancePointer()->ChangePhase(PHASE_MENU);
}
return true;
}
if ( event.type == EVENT_FRAME )
{
if( m_currentWindow == nullptr )
{
CApplication::GetInstancePointer()->GetSound()->PlayMusic("Intro1.ogg", false, 1.5f);
CRobotMain::GetInstancePointer()->ChangePhase(PHASE_MENU);
}
}
return true;
}
void CScreenCredits::ChangePhase(Phase phase)
{
}
}

52
src/ui/screen/credits.h Normal file
View File

@ -0,0 +1,52 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#pragma once
#include "common/restext.h"
#include "ui/screen/screen.h"
#include <CEGUI/CEGUI.h>
namespace Ui {
class CScreenCredits : public CScreen
{
public:
CScreenCredits();
~CScreenCredits();
void Start();
void Stop();
bool EventProcess(const Event &event);
void ChangePhase(Phase phase);
protected:
void Next();
void InitText(std::string name, ResUiTextType text);
bool OnAnimationEnded(const CEGUI::EventArgs& e);
protected:
const std::string ANIMATION_SUFFIX = "_anim";
CEGUI::Window* m_window;
CEGUI::Window* m_currentWindow;
unsigned int m_currentWindowIdx;
CEGUI::AnimationInstance* m_currentWindowAnim;
};
}

234
src/ui/screen/menu.cpp Normal file
View File

@ -0,0 +1,234 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#include "ui/screen/menu.h"
#include "app/app.h"
#include "common/config.h"
#include "common/logger.h"
#include "graphics/engine/engine.h"
#include "ui/maindialog.h"
#include <boost/algorithm/string/split.hpp>
namespace Ui {
CScreenMenu::CScreenMenu()
{
m_page = MENUPAGE_INIT;
m_oldMusicVol = m_oldAudioVol = MAXVOLUME;
m_window = nullptr;
m_enabledPhases.insert(PHASE_MENU);
}
CScreenMenu::~CScreenMenu()
{
Stop();
}
void CScreenMenu::Start()
{
m_window = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("menu.layout");
CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(m_window);
if(m_page == MENUPAGE_INIT)
{
LoadLayout("mainmenu");
InitWindow(WINDOW_INIT, RUIT_TITLE_INIT);
InitButton(BUTTON_STARTGAME, RUIT_STARTGAME);
InitButton(BUTTON_MULTIPLAYER, RUIT_MULTIPLAYER);
InitButton(BUTTON_CREDITS, RUIT_CREDITS);
InitButton(BUTTON_SETUP, RUIT_SETUP);
InitButton(BUTTON_NAME, RUIT_NAME);
InitButton(BUTTON_QUIT, RUIT_QUIT);
}
if(m_page == MENUPAGE_STARTGAME)
{
LoadLayout("startgame");
InitWindow(WINDOW_STARTGAME, RUIT_TITLE_STARTGAME);
InitButton(BUTTON_MISSIONS, RUIT_MISSIONS);
InitButton(BUTTON_FREEGAME, RUIT_FREEGAME);
InitButton(BUTTON_EXERCISES, RUIT_EXERCISES);
InitButton(BUTTON_CHALLENGES, RUIT_CHALLENGES);
InitButton(BUTTON_USERLVL, RUIT_USERLVL);
InitButton(BUTTON_BACK, RUIT_BACK);
#if !DEV_BUILD
m_window->getChildRecursive(BUTTON_USERLVL)->setEnabled(false);
#endif
}
if(m_page == MENUPAGE_MULTIPLAYER)
{
LoadLayout("multiplayer");
InitWindow(WINDOW_MULTIPLAYER, RUIT_TITLE_MULTIPLAYER);
InitButton(BUTTON_BACK, RUIT_BACK);
m_oldAudioVol = CApplication::GetInstancePointer()->GetSound()->GetAudioVolume();
m_oldMusicVol = CApplication::GetInstancePointer()->GetSound()->GetMusicVolume();
CApplication::GetInstancePointer()->GetSound()->SetAudioVolume(0);
CApplication::GetInstancePointer()->GetSound()->SetMusicVolume(MAXVOLUME);
CApplication::GetInstancePointer()->GetSound()->PlayMusic("music012.ogg", true, 1.f); // Easter egg? Why not! :D
}
/* TODO: What does this do? Is it needed?
pos.x = 0.35f;
pos.y = 0.60f;
ddim.x = 0.30f;
ddim.y = 0.30f;
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
pos.x = 0.35f;
pos.y = 0.10f;
ddim.x = 0.30f;
ddim.y = 0.30f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
*/
m_window->getChildRecursive(LABEL_VERSION)->setText(COLOBOT_VERSION_DISPLAY+CEGUI::String("\n")+COLOBOT_VERSION_DATE);
Gfx::CEngine* engine = Gfx::CEngine::GetInstancePointer();
engine->SetBackground("interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
true);
engine->SetBackForce(true);
}
void CScreenMenu::InitButton(std::string name, ResUiTextType textId)
{
m_window->getChildRecursive(name)->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&CScreenMenu::OnClick, this));
std::string translated;
GetResource(RES_UI, textId, translated);
std::vector<std::string> strings;
boost::split(strings, translated, boost::is_any_of("\\"));
m_window->getChildRecursive(name)->setText(reinterpret_cast<const CEGUI::utf8*>(strings[0].c_str()));
m_window->getChildRecursive(name)->setTooltipText(reinterpret_cast<const CEGUI::utf8*>(strings[1].c_str())); //TODO: For some reason tooltips don't work
}
void CScreenMenu::InitWindow(std::string name, ResUiTextType textId)
{
std::string translated;
GetResource(RES_UI, textId, translated);
m_window->getChildRecursive(name)->setProperty("LabelText", reinterpret_cast<const CEGUI::utf8*>(translated.c_str()));
}
void CScreenMenu::Stop()
{
if(m_window != nullptr) {
CEGUI::WindowManager::getSingleton().destroyWindow(m_window);
m_window = nullptr;
}
}
void CScreenMenu::ChangePage(MenuPage page)
{
Stop();
m_page = page;
Start();
}
void CScreenMenu::LoadLayout(CEGUI::String name)
{
CEGUI::Window* menuContent = CEGUI::WindowManager::getSingleton().loadLayoutFromFile(name+".layout");
m_window->addChild(menuContent);
}
bool CScreenMenu::OnClick(const CEGUI::EventArgs& e)
{
const CEGUI::WindowEventArgs* args = static_cast<const CEGUI::WindowEventArgs*>(&e);
CEGUI::Window* target = static_cast<CEGUI::Window*>(args->window);
CEGUI::String targetName = target->getName();
if(m_page == MENUPAGE_INIT)
{
if(targetName == BUTTON_STARTGAME) ChangePage(MENUPAGE_STARTGAME);
if(targetName == BUTTON_MULTIPLAYER) ChangePage(MENUPAGE_MULTIPLAYER);
if(targetName == BUTTON_CREDITS) CRobotMain::GetInstancePointer()->ChangePhase(PHASE_CREDITS);
if(targetName == BUTTON_SETUP) CRobotMain::GetInstancePointer()->ChangePhase(PHASE_SETUPg);
if(targetName == BUTTON_NAME) CRobotMain::GetInstancePointer()->ChangePhase(PHASE_NAME);
if(targetName == BUTTON_QUIT) CApplication::GetInstancePointer()->GetEventQueue()->AddEvent(Event(EVENT_QUIT));
}
if(m_page == MENUPAGE_STARTGAME)
{
if(targetName == BUTTON_MISSIONS) CRobotMain::GetInstancePointer()->ChangePhase(PHASE_MISSION);
if(targetName == BUTTON_FREEGAME) CRobotMain::GetInstancePointer()->ChangePhase(PHASE_FREE);
if(targetName == BUTTON_EXERCISES) CRobotMain::GetInstancePointer()->ChangePhase(PHASE_TRAINER);
if(targetName == BUTTON_CHALLENGES) CRobotMain::GetInstancePointer()->ChangePhase(PHASE_DEFI);
if(targetName == BUTTON_USERLVL) CRobotMain::GetInstancePointer()->ChangePhase(PHASE_USER);
if(targetName == BUTTON_BACK) ChangePage(MENUPAGE_INIT);
}
if(m_page == MENUPAGE_MULTIPLAYER)
{
if(targetName == BUTTON_BACK)
{
ChangePage(MENUPAGE_INIT);
CApplication::GetInstancePointer()->GetSound()->SetAudioVolume(m_oldAudioVol);
CApplication::GetInstancePointer()->GetSound()->SetMusicVolume(m_oldMusicVol);
CApplication::GetInstancePointer()->GetSound()->PlayMusic("Intro1.ogg", false, 1.f);
}
}
return true;
}
bool CScreenMenu::EventProcess(const Event &event)
{
switch( event.type )
{
case EVENT_KEY_DOWN:
if ( event.key.key == KEY(ESCAPE) )
{
if(m_page == MENUPAGE_INIT) {
CApplication::GetInstancePointer()->GetEventQueue()->AddEvent(Event(EVENT_QUIT));
} else {
if(m_page == MENUPAGE_MULTIPLAYER)
{
CApplication::GetInstancePointer()->GetSound()->SetAudioVolume(m_oldAudioVol);
CApplication::GetInstancePointer()->GetSound()->SetMusicVolume(m_oldMusicVol);
CApplication::GetInstancePointer()->GetSound()->PlayMusic("Intro1.ogg", false, 1.f);
}
ChangePage(MENUPAGE_INIT);
}
}
return false;
default:
return true;
}
}
void CScreenMenu::ChangePhase(Phase phase)
{
}
}

82
src/ui/screen/menu.h Normal file
View File

@ -0,0 +1,82 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#pragma once
#include "ui/screen/screen.h"
#include "common/restext.h"
#include <CEGUI/CEGUI.h>
#include <string>
namespace Ui {
enum MenuPage
{
MENUPAGE_INIT,
MENUPAGE_STARTGAME,
MENUPAGE_MULTIPLAYER
};
class CScreenMenu : public CScreen
{
public:
CScreenMenu();
~CScreenMenu();
void Start();
void Stop();
bool EventProcess(const Event &event);
void ChangePhase(Phase phase);
protected:
const std::string WINDOW_INIT = "mainmenu_window";
const std::string WINDOW_STARTGAME = "startgame_window";
const std::string WINDOW_MULTIPLAYER = "multiplayer_window";
const std::string BUTTON_BACK = "back_button";
const std::string BUTTON_STARTGAME = "startgame_button";
const std::string BUTTON_MULTIPLAYER = "multiplayer_button";
const std::string BUTTON_CREDITS = "credits_button";
const std::string BUTTON_SETUP = "setup_button";
const std::string BUTTON_NAME = "name_button";
const std::string BUTTON_QUIT = "quit_button";
const std::string BUTTON_MISSIONS = "missions_button";
const std::string BUTTON_FREEGAME = "freegame_button";
const std::string BUTTON_EXERCISES = "exercises_button";
const std::string BUTTON_CHALLENGES = "challenges_button";
const std::string BUTTON_USERLVL = "userlvl_button";
const std::string LABEL_VERSION = "version_label";
void ChangePage(MenuPage page);
void LoadLayout(CEGUI::String name);
void InitButton(std::string name, ResUiTextType textId);
void InitWindow(std::string name, ResUiTextType textId);
bool OnClick(const CEGUI::EventArgs& e);
MenuPage m_page;
int m_oldAudioVol, m_oldMusicVol;
CEGUI::Window* m_window;
};
}

42
src/ui/screen/screen.h Normal file
View File

@ -0,0 +1,42 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#pragma once
#include "object/robotmain.h"
#include "common/event.h"
#include <set>
namespace Ui {
class CScreen
{
public:
virtual ~CScreen()
{
}
virtual void Start() = 0;
virtual void Stop() = 0;
virtual bool EventProcess(const Event &event) = 0;
virtual void ChangePhase(Phase phase) = 0;
std::set<Phase> m_enabledPhases;
bool m_enabled = false;
};
}

137
src/ui/screen/splash.cpp Normal file
View File

@ -0,0 +1,137 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#include "ui/screen/splash.h"
#include "common/logger.h"
namespace Ui {
CScreenSplash::CScreenSplash()
{
m_splashWindow = nullptr;
m_splashWindowAnim = nullptr;
m_enabledPhases.insert(PHASE_SPLASH);
}
CScreenSplash::~CScreenSplash()
{
Stop();
}
void CScreenSplash::UpdateSplashList()
{
std::set<CEGUI::String> splashes;
for(CEGUI::ImageManager::ImageIterator images = CEGUI::ImageManager::getSingleton().getIterator(); !images.isAtEnd(); images++)
{
CEGUI::String currentImage = images.getCurrentKey();
if(currentImage.compare(0, SPLASH_IMAGESET.length()+1, SPLASH_IMAGESET+"/") == 0)
{
m_splashes.insert(currentImage);
}
}
for(auto s : m_splashes)
CLogger::GetInstancePointer()->Trace("Found splash image: %s\n", s.c_str());
}
void CScreenSplash::Start()
{
UpdateSplashList();
Next();
}
void CScreenSplash::Stop()
{
if(m_splashWindowAnim != nullptr) {
CEGUI::AnimationManager::getSingleton().destroyAnimationInstance(m_splashWindowAnim);
m_splashWindowAnim = nullptr;
}
if(m_splashWindow != nullptr) {
CEGUI::WindowManager::getSingleton().destroyWindow(m_splashWindow);
m_splashWindow = nullptr;
}
}
void CScreenSplash::Next()
{
if(m_splashWindowAnim != nullptr && m_splashWindowAnim->isRunning())
{
CEGUI::AnimationManager::getSingleton().destroyAnimationInstance(m_splashWindowAnim);
m_splashWindowAnim = nullptr;
}
if(m_splashWindow != nullptr)
{
CEGUI::WindowManager::getSingleton().destroyWindow(m_splashWindow);
m_splashWindow = nullptr;
}
if(IsFinished()) return;
CEGUI::String nextImage = *(m_splashes.begin());
m_splashes.erase(nextImage);
CLogger::GetInstancePointer()->Debug("Now showing splash: %s\n", nextImage.c_str());
m_splashWindow = CEGUI::WindowManager::getSingleton().createWindow("Colobot/StaticImage", "splash");
m_splashWindow->setProperty("Image", nextImage);
m_splashWindow->moveToBack();
CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(m_splashWindow);
m_splashWindowAnim = CEGUI::AnimationManager::getSingleton().instantiateAnimation(SPLASH_ANIMATION);
m_splashWindowAnim->setTargetWindow(m_splashWindow);
m_splashWindow->subscribeEvent(CEGUI::AnimationInstance::EventAnimationEnded, CEGUI::Event::Subscriber(&CScreenSplash::OnAnimationEnded, this));
m_splashWindowAnim->start();
}
bool CScreenSplash::OnAnimationEnded(const CEGUI::EventArgs& e)
{
Next();
return true;
}
bool CScreenSplash::IsFinished()
{
return (m_splashes.empty() && m_splashWindow == nullptr);
}
bool CScreenSplash::EventProcess(const Event &event)
{
if ( event.type == EVENT_KEY_DOWN ||
event.type == EVENT_MOUSE_BUTTON_DOWN )
{
Next();
return true;
}
if ( event.type == EVENT_FRAME )
{
if( IsFinished() )
CRobotMain::GetInstancePointer()->ChangePhase(PHASE_NAME);
}
return true;
}
void CScreenSplash::ChangePhase(Phase phase)
{
}
}

53
src/ui/screen/splash.h Normal file
View File

@ -0,0 +1,53 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#pragma once
#include "ui/screen/screen.h"
#include <CEGUI/CEGUI.h>
#include <set>
namespace Ui {
class CScreenSplash : public CScreen
{
public:
CScreenSplash();
~CScreenSplash();
void Start();
void Stop();
bool EventProcess(const Event &event);
void ChangePhase(Phase phase);
protected:
void UpdateSplashList();
void Next();
bool OnAnimationEnded(const CEGUI::EventArgs& e);
bool IsFinished();
protected:
const std::string SPLASH_IMAGESET = "ColobotSplash";
const std::string SPLASH_ANIMATION = "Colobot/Splash";
CEGUI::Window* m_splashWindow;
CEGUI::AnimationInstance* m_splashWindowAnim;
std::set<CEGUI::String> m_splashes;
};
}

103
src/ui/splash.cpp Normal file
View File

@ -0,0 +1,103 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#include "ui/splash.h"
#include "common/logger.h"
namespace Ui {
CSplash::CSplash()
{
m_splashWindow = nullptr;
m_splashWindowAnim = nullptr;
UpdateSplashList();
}
CSplash::~CSplash()
{
if(m_splashWindowAnim != nullptr)
CEGUI::AnimationManager::getSingleton().destroyAnimationInstance(m_splashWindowAnim);
if(m_splashWindow != nullptr)
CEGUI::WindowManager::getSingleton().destroyWindow(m_splashWindow);
}
void CSplash::UpdateSplashList()
{
std::set<CEGUI::String> splashes;
for(CEGUI::ImageManager::ImageIterator images = CEGUI::ImageManager::getSingleton().getIterator(); !images.isAtEnd(); images++)
{
CEGUI::String currentImage = images.getCurrentKey();
if(currentImage.compare(0, SPLASH_IMAGESET.length()+1, SPLASH_IMAGESET+"/") == 0)
{
m_splashes.insert(currentImage);
}
}
for(auto s : m_splashes)
CLogger::GetInstancePointer()->Trace("Found splash image: %s\n", s.c_str());
}
void CSplash::Start()
{
Next();
}
void CSplash::Next()
{
if(m_splashWindowAnim != nullptr && m_splashWindowAnim->isRunning())
{
CEGUI::AnimationManager::getSingleton().destroyAnimationInstance(m_splashWindowAnim);
m_splashWindowAnim = nullptr;
}
if(m_splashWindow != nullptr)
{
CEGUI::WindowManager::getSingleton().destroyWindow(m_splashWindow);
m_splashWindow = nullptr;
}
if(IsFinished()) return;
CEGUI::String nextImage = *(m_splashes.begin());
m_splashes.erase(nextImage);
CLogger::GetInstancePointer()->Debug("Now showing splash: %s\n", nextImage.c_str());
m_splashWindow = CEGUI::WindowManager::getSingleton().createWindow("Colobot/StaticImage", "splash");
m_splashWindow->setProperty("Image", nextImage);
m_splashWindow->moveToBack();
CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(m_splashWindow);
m_splashWindowAnim = CEGUI::AnimationManager::getSingleton().instantiateAnimation(SPLASH_ANIMATION);
m_splashWindowAnim->setTargetWindow(m_splashWindow);
m_splashWindow->subscribeEvent(CEGUI::AnimationInstance::EventAnimationEnded, CEGUI::Event::Subscriber(&CSplash::OnAnimationEnded, this));
m_splashWindowAnim->start();
}
bool CSplash::OnAnimationEnded(const CEGUI::EventArgs& e)
{
Next();
return true;
}
bool CSplash::IsFinished()
{
return (m_splashes.empty() && m_splashWindow == nullptr);
}
}

47
src/ui/splash.h Normal file
View File

@ -0,0 +1,47 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014 Polish Portal of Colobot (PPC)
// *
// * This program 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 3 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, see http://www.gnu.org/licenses/.
#pragma once
#include <CEGUI/CEGUI.h>
#include <set>
namespace Ui {
class CSplash
{
public:
CSplash();
~CSplash();
void UpdateSplashList();
void Start();
void Next();
bool OnAnimationEnded(const CEGUI::EventArgs& e);
bool IsFinished();
protected:
const std::string SPLASH_IMAGESET = "ColobotSplash";
const std::string SPLASH_ANIMATION = "Colobot/Splash";
CEGUI::Window* m_splashWindow;
CEGUI::AnimationInstance* m_splashWindowAnim;
std::set<CEGUI::String> m_splashes;
};
}