diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d0357e08..39e0b82e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) project(emulationstation) @@ -50,22 +50,6 @@ if(DEFINED BCMHOST) add_definitions(-D_RPI_) endif() -#------------------------------------------------------------------------------- -#set up _WIN32_WINNT variable (used by boost::asio) on Windows -macro(get_WIN32_WINNT version) - if (WIN32 AND CMAKE_SYSTEM_VERSION) - set(ver ${CMAKE_SYSTEM_VERSION}) - string(REPLACE "." "" ver ${ver}) - string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver}) - - set(${version} "0x${ver}") - endif() -endmacro() - -if(WIN32) - get_WIN32_WINNT(ver) - add_definitions(-D_WIN32_WINNT=${ver}) -endif() #------------------------------------------------------------------------------- if(MSVC) @@ -82,6 +66,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) if (G++_VERSION VERSION_LESS 4.7) message(SEND_ERROR "You need at least G++ 4.7 to compile EmulationStation!") endif() + #set up compiler flags for GCC set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -O3") #support C++11 for std::, optimize set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O3") #-s = strip binary @@ -97,24 +82,26 @@ add_definitions(-DEIGEN_DONT_ALIGN) #------------------------------------------------------------------------------- #add include directories -set(ES_INCLUDE_DIRS +set(COMMON_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FreeImage_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR} ${CURL_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/external + ${CMAKE_CURRENT_SOURCE_DIR}/core/src ) #add ALSA for Linux if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - LIST(APPEND ES_INCLUDE_DIRS + LIST(APPEND COMMON_INCLUDE_DIRS ${ALSA_INCLUDE_DIRS} ) endif() if(DEFINED BCMHOST) - LIST(APPEND ES_INCLUDE_DIRS + LIST(APPEND COMMON_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos" "/opt/vc/include/interface/vmcs_host/linux" @@ -122,263 +109,16 @@ if(DEFINED BCMHOST) ) else() if(${GLSystem} MATCHES "Desktop OpenGL") - LIST(APPEND ES_INCLUDE_DIRS + LIST(APPEND COMMON_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR} ) else() - LIST(APPEND ES_INCLUDE_DIRS + LIST(APPEND COMMON_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR} ) endif() endif() -#------------------------------------------------------------------------------- -#define basic sources and headers -set(ES_HEADERS - ${CMAKE_CURRENT_SOURCE_DIR}/src/AsyncHandle.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/EmulationStation.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/FileData.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/FileSorts.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/GuiComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/HelpStyle.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/HttpReq.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/ImageIO.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/InputConfig.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/InputManager.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/Log.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/MathExp.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/ThemeData.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/Util.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/Window.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.h - - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AsyncReqComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentList.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/IList.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageGridComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/MenuComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/NinePatchComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/OptionListComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScraperSearchComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScrollableContainer.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/SliderComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/SwitchComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextEditComponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextListComponent.h - - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiFastSelect.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettings.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperMulti.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperStart.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiTextEditPopup.h - - ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/Scraper.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/GamesDBScraper.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/TheArchiveScraper.h - - ${CMAKE_CURRENT_SOURCE_DIR}/src/pugiXML/pugiconfig.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/pugiXML/pugixml.hpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/nanosvg/nanosvg.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/nanosvg/nanosvgrast.h - - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGameListView.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGameListView.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGameListView.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGameListView.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGameListView.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/ViewController.h - - ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/Animation.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/AnimationController.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/LambdaAnimation.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/LaunchAnimation.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/MoveCameraAnimation.h - - ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/Font.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/ResourceManager.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/SVGResource.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/TextureResource.h - ${CMAKE_CURRENT_SOURCE_DIR}/data/Resources.h -) -set(ES_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/FileData.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/FileSorts.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/GuiComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/HelpStyle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/HttpReq.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ImageIO.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/InputConfig.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/InputManager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/Log.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/MameNameMap.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/MathExp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_draw_gl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ThemeData.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/Util.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/Window.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AsyncReqComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentList.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/MenuComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/NinePatchComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScraperSearchComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScrollableContainer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/SliderComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/SwitchComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextComponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextEditComponent.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiFastSelect.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettings.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperMulti.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperStart.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiTextEditPopup.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/Scraper.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/GamesDBScraper.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/TheArchiveScraper.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/pugiXML/pugixml.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/nanosvg/nanosvg_impl.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/Font.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/ResourceManager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/SVGResource.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/TextureResource.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGameListView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGameListView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGameListView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGameListView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGameListView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/views/ViewController.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/AnimationController.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/data/ResourceUtil.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/splash_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/window_icon_256_png.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/button_png.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/button_filled_png.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/textinput_ninepatch_png.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/textinput_ninepatch_active_png.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/frame_png.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/scroll_gradient_png.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_button_a_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_button_b_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_button_x_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_button_y_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_button_l_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_button_r_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_button_start_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_button_select_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_up_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_down_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_left_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_right_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_updown_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_leftright_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_all_svg.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_regular_ttf.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_light_ttf.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/arrow_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/option_arrow_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/checkbox_checked_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/checkbox_unchecked_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/star_filled_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/star_unfilled_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/on_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/off_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/fav_add_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/fav_remove_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/slider_knob_svg.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/busy_0_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/busy_1_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/busy_2_svg.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/busy_3_svg.cpp -) - -#SOURCE_GROUP(resources FILES ResourceUtil.cpp) - -#add open gl specific sources -#if(${GLSystem} MATCHES "Desktop OpenGL") - LIST(APPEND ES_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init_sdlgl.cpp - ) -#else() -# LIST(APPEND ES_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init_rpi.cpp -# ) -#endif() - -#------------------------------------------------------------------------------- -#define OS specific sources and headers -if(MSVC) - LIST(APPEND ES_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/EmulationStation.rc - ) -endif() - #------------------------------------------------------------------------------- #define libraries and directories if(DEFINED BCMHOST) @@ -392,96 +132,57 @@ else() ) endif() -set(ES_LIBRARIES +set(COMMON_LIBRARIES ${Boost_LIBRARIES} ${FREETYPE_LIBRARIES} ${FreeImage_LIBRARIES} ${SDL2_LIBRARY} ${SDL2MAIN_LIBRARY} ${CURL_LIBRARIES} + pugixml + nanosvg ) #add ALSA for Linux if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - LIST(APPEND ES_LIBRARIES + LIST(APPEND COMMON_LIBRARIES ${ALSA_LIBRARY} ) endif() if(DEFINED BCMHOST) - LIST(APPEND ES_LIBRARIES + LIST(APPEND COMMON_LIBRARIES bcm_host EGL ${OPENGLES_LIBRARIES} ) else() if(MSVC) - LIST(APPEND ES_LIBRARIES + LIST(APPEND COMMON_LIBRARIES winmm ) endif() if(${GLSystem} MATCHES "Desktop OpenGL") - LIST(APPEND ES_LIBRARIES + LIST(APPEND COMMON_LIBRARIES ${OPENGL_LIBRARIES} ) else() - LIST(APPEND ES_LIBRARIES + LIST(APPEND COMMON_LIBRARIES ${OPENGLES_LIBRARIES} ) endif() endif() #------------------------------------------------------------------------------- -#set up build directories +# set up build directories set(dir ${CMAKE_CURRENT_SOURCE_DIR}) set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE) set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE) + #------------------------------------------------------------------------------- -#define target -include_directories(${ES_INCLUDE_DIRS}) -add_executable(emulationstation ${ES_SOURCES} ${ES_HEADERS}) -target_link_libraries(emulationstation ${ES_LIBRARIES}) - -#special properties for windows builds -if(MSVC) - #show console in debug builds, but not in proper release builds - #Note that up to CMake 2.8.10 this feature is broken: http://public.kitware.com/Bug/view.php?id=12566 - set_target_properties(emulationstation PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE") - set_target_properties(emulationstation PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE") - set_target_properties(emulationstation PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE") - set_target_properties(emulationstation PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE") - set_target_properties(emulationstation PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") - set_target_properties(emulationstation PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS") -endif() - -install(TARGETS emulationstation - RUNTIME - DESTINATION bin) - -INCLUDE(InstallRequiredSystemLibraries) - -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A flexible graphical emulator front-end") -SET(CPACK_PACKAGE_DESCRIPTION "EmulationStation is a flexible, graphical front-end designed for keyboardless navigation of your multi-platform retro game collection.") - -SET(CPACK_RESOURCE_FILE LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md") -SET(CPACK_RESOURCE_FILE README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") - -SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Alec Lofquist ") -SET(CPACK_DEBIAN_PACKAGE_SECTION "misc") -SET(CPACK_DEBIAN_PACKAGE_PRIORITY "extra") -SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libsdl2-2.0-0, libboost-system1.54.0, libboost-filesystem1.54.0, libfreeimage3, libfreetype6, libcurl3, libasound2") -SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS "debhelper (>= 8.0.0), cmake, g++ (>= 4.8), libsdl2-dev, libboost-system-dev, libboost-filesystem-dev, libboost-date-time-dev, libfreeimage-dev, libfreetype6-dev, libeigen3-dev, libcurl4-openssl-dev, libasound2-dev, libgl1-mesa-dev") - -SET(CPACK_PACKAGE_VENDOR "emulationstation.org") -SET(CPACK_PACKAGE_VERSION "2.0.0~rc1") -SET(CPACK_PACKAGE_VERSION_MAJOR "2") -SET(CPACK_PACKAGE_VERSION_MINOR "0") -SET(CPACK_PACKAGE_VERSION_PATCH "0") -SET(CPACK_PACKAGE_INSTALL_DIRECTORY "emulationstation_${CMAKE_PACKAGE_VERSION}") -SET(CPACK_PACKAGE_EXECUTABLES "emulationstation" "emulationstation") - -SET(CPACK_GENERATOR "TGZ;DEB") - -INCLUDE(CPack) +# add each component +add_subdirectory("external") +add_subdirectory("core") +add_subdirectory("es") diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt new file mode 100644 index 000000000..182e811be --- /dev/null +++ b/core/CMakeLists.txt @@ -0,0 +1,165 @@ +project("core") + +set(CORE_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/src/AsyncHandle.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/GuiComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/HelpStyle.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/HttpReq.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/ImageIO.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/InputConfig.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/InputManager.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/Log.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/ThemeData.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/Util.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/Window.h + + # Animations + ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/Animation.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/AnimationController.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/LambdaAnimation.h + + # GuiComponents + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentList.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/IList.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageGridComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/MenuComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/NinePatchComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/OptionListComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScrollableContainer.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/SliderComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/SwitchComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextEditComponent.h + + # Guis + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiTextEditPopup.h + + # Resources + ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/Font.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/ResourceManager.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/SVGResource.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/TextureResource.h +) + +set(CORE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/GuiComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/HelpStyle.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/HttpReq.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ImageIO.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/InputConfig.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/InputManager.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Log.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_draw_gl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init_sdlgl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ThemeData.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Util.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Window.cpp + + # Animations + ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/AnimationController.cpp + + # GuiComponents + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentList.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/MenuComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/NinePatchComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScrollableContainer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/SliderComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/SwitchComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextEditComponent.cpp + + # Guis + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiTextEditPopup.cpp + + # Resources + ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/Font.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/ResourceManager.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/SVGResource.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/TextureResource.cpp + + # Embedded assets (needed by ResourceManager) + ${emulationstation_SOURCE_DIR}/data/Resources.h +) + +set(EMBEDDED_ASSET_SOURCES + ${emulationstation_SOURCE_DIR}/data/ResourceUtil.cpp + ${emulationstation_SOURCE_DIR}/data/converted/splash_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/window_icon_256_png.cpp + ${emulationstation_SOURCE_DIR}/data/converted/button_png.cpp + ${emulationstation_SOURCE_DIR}/data/converted/button_filled_png.cpp + ${emulationstation_SOURCE_DIR}/data/converted/textinput_ninepatch_png.cpp + ${emulationstation_SOURCE_DIR}/data/converted/textinput_ninepatch_active_png.cpp + ${emulationstation_SOURCE_DIR}/data/converted/frame_png.cpp + ${emulationstation_SOURCE_DIR}/data/converted/scroll_gradient_png.cpp + + ${emulationstation_SOURCE_DIR}/data/converted/help_button_a_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_button_b_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_button_x_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_button_y_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_button_l_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_button_r_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_button_start_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_button_select_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_dpad_up_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_dpad_down_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_dpad_left_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_dpad_right_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_dpad_updown_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_dpad_leftright_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/help_dpad_all_svg.cpp + + ${emulationstation_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_regular_ttf.cpp + ${emulationstation_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_light_ttf.cpp + ${emulationstation_SOURCE_DIR}/data/converted/arrow_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/option_arrow_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/checkbox_checked_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/checkbox_unchecked_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/star_filled_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/star_unfilled_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/on_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/off_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/fav_add_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/fav_remove_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/slider_knob_svg.cpp + + ${emulationstation_SOURCE_DIR}/data/converted/busy_0_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/busy_1_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/busy_2_svg.cpp + ${emulationstation_SOURCE_DIR}/data/converted/busy_3_svg.cpp +) + +list(APPEND CORE_SOURCES ${EMBEDDED_ASSET_SOURCES}) + +include_directories(${COMMON_INCLUDE_DIRS}) +add_library(es-core STATIC ${CORE_SOURCES} ${CORE_HEADERS}) +target_link_libraries(es-core ${COMMON_LIBRARIES}) diff --git a/src/AsyncHandle.h b/core/src/AsyncHandle.h similarity index 100% rename from src/AsyncHandle.h rename to core/src/AsyncHandle.h diff --git a/src/AudioManager.cpp b/core/src/AudioManager.cpp similarity index 94% rename from src/AudioManager.cpp rename to core/src/AudioManager.cpp index 2c6af704b..c75d3c4ca 100644 --- a/src/AudioManager.cpp +++ b/core/src/AudioManager.cpp @@ -2,8 +2,6 @@ #include #include "Log.h" -#include "VolumeControl.h" - std::vector> AudioManager::sSoundVector; SDL_AudioSpec AudioManager::sAudioFormat; @@ -54,9 +52,6 @@ void AudioManager::mixAudio(void *unused, Uint8 *stream, int len) AudioManager::AudioManager() { init(); - - //set internal volume - //VolumeControl::getInstance()->setVolume(50); } AudioManager::~AudioManager() @@ -138,9 +133,6 @@ void AudioManager::play() { getInstance(); - //set internal audio volume. important after launching a game and returning here - //VolumeControl::getInstance()->setVolume(50); - //unpause audio, the mixer will figure out if samples need to be played... SDL_PauseAudio(0); } diff --git a/src/AudioManager.h b/core/src/AudioManager.h similarity index 100% rename from src/AudioManager.h rename to core/src/AudioManager.h diff --git a/src/GuiComponent.cpp b/core/src/GuiComponent.cpp similarity index 100% rename from src/GuiComponent.cpp rename to core/src/GuiComponent.cpp diff --git a/src/GuiComponent.h b/core/src/GuiComponent.h similarity index 100% rename from src/GuiComponent.h rename to core/src/GuiComponent.h diff --git a/src/HelpStyle.cpp b/core/src/HelpStyle.cpp similarity index 100% rename from src/HelpStyle.cpp rename to core/src/HelpStyle.cpp diff --git a/src/HelpStyle.h b/core/src/HelpStyle.h similarity index 100% rename from src/HelpStyle.h rename to core/src/HelpStyle.h diff --git a/src/HttpReq.cpp b/core/src/HttpReq.cpp similarity index 100% rename from src/HttpReq.cpp rename to core/src/HttpReq.cpp diff --git a/src/HttpReq.h b/core/src/HttpReq.h similarity index 100% rename from src/HttpReq.h rename to core/src/HttpReq.h diff --git a/src/ImageIO.cpp b/core/src/ImageIO.cpp similarity index 100% rename from src/ImageIO.cpp rename to core/src/ImageIO.cpp diff --git a/src/ImageIO.h b/core/src/ImageIO.h similarity index 99% rename from src/ImageIO.h rename to core/src/ImageIO.h index 8d4a1916b..ca48d70ab 100644 --- a/src/ImageIO.h +++ b/core/src/ImageIO.h @@ -3,7 +3,6 @@ #include #include - class ImageIO { public: diff --git a/src/InputConfig.cpp b/core/src/InputConfig.cpp similarity index 100% rename from src/InputConfig.cpp rename to core/src/InputConfig.cpp diff --git a/src/InputConfig.h b/core/src/InputConfig.h similarity index 98% rename from src/InputConfig.h rename to core/src/InputConfig.h index b007f008a..4fa3980ac 100644 --- a/src/InputConfig.h +++ b/core/src/InputConfig.h @@ -6,7 +6,7 @@ #include #include #include -#include "pugiXML/pugixml.hpp" +#include "pugixml/pugixml.hpp" #define DEVICE_KEYBOARD -1 diff --git a/src/InputManager.cpp b/core/src/InputManager.cpp similarity index 100% rename from src/InputManager.cpp rename to core/src/InputManager.cpp diff --git a/src/InputManager.h b/core/src/InputManager.h similarity index 100% rename from src/InputManager.h rename to core/src/InputManager.h diff --git a/src/Log.cpp b/core/src/Log.cpp similarity index 100% rename from src/Log.cpp rename to core/src/Log.cpp diff --git a/src/Log.h b/core/src/Log.h similarity index 100% rename from src/Log.h rename to core/src/Log.h diff --git a/src/Renderer.h b/core/src/Renderer.h similarity index 100% rename from src/Renderer.h rename to core/src/Renderer.h diff --git a/src/Renderer_draw_gl.cpp b/core/src/Renderer_draw_gl.cpp similarity index 100% rename from src/Renderer_draw_gl.cpp rename to core/src/Renderer_draw_gl.cpp diff --git a/src/Renderer_init.cpp b/core/src/Renderer_init.cpp similarity index 100% rename from src/Renderer_init.cpp rename to core/src/Renderer_init.cpp diff --git a/src/Renderer_init_sdlgl.cpp b/core/src/Renderer_init_sdlgl.cpp similarity index 99% rename from src/Renderer_init_sdlgl.cpp rename to core/src/Renderer_init_sdlgl.cpp index 65abd0dad..dcc13ebfd 100644 --- a/src/Renderer_init_sdlgl.cpp +++ b/core/src/Renderer_init_sdlgl.cpp @@ -7,7 +7,6 @@ #include "Log.h" #include "ImageIO.h" #include "../data/Resources.h" -#include "EmulationStation.h" #include "Settings.h" #ifdef USE_OPENGL_ES diff --git a/src/Settings.cpp b/core/src/Settings.cpp similarity index 99% rename from src/Settings.cpp rename to core/src/Settings.cpp index 36abc5de4..34c82773c 100644 --- a/src/Settings.cpp +++ b/core/src/Settings.cpp @@ -1,6 +1,6 @@ #include "Settings.h" #include "Log.h" -#include "pugiXML/pugixml.hpp" +#include "pugixml/pugixml.hpp" #include "platform.h" #include #include diff --git a/src/Settings.h b/core/src/Settings.h similarity index 100% rename from src/Settings.h rename to core/src/Settings.h diff --git a/src/Sound.cpp b/core/src/Sound.cpp similarity index 100% rename from src/Sound.cpp rename to core/src/Sound.cpp diff --git a/src/Sound.h b/core/src/Sound.h similarity index 100% rename from src/Sound.h rename to core/src/Sound.h diff --git a/src/ThemeData.cpp b/core/src/ThemeData.cpp similarity index 99% rename from src/ThemeData.cpp rename to core/src/ThemeData.cpp index 513a26c8c..fce86628f 100644 --- a/src/ThemeData.cpp +++ b/core/src/ThemeData.cpp @@ -5,7 +5,7 @@ #include "resources/TextureResource.h" #include "Log.h" #include "Settings.h" -#include "pugiXML/pugixml.hpp" +#include "pugixml/pugixml.hpp" #include #include "components/ImageComponent.h" diff --git a/src/ThemeData.h b/core/src/ThemeData.h similarity index 99% rename from src/ThemeData.h rename to core/src/ThemeData.h index eea92e67f..268f0753f 100644 --- a/src/ThemeData.h +++ b/core/src/ThemeData.h @@ -9,7 +9,7 @@ #include #include #include -#include "pugiXML/pugixml.hpp" +#include "pugixml/pugixml.hpp" #include "GuiComponent.h" template diff --git a/src/Util.cpp b/core/src/Util.cpp similarity index 91% rename from src/Util.cpp rename to core/src/Util.cpp index efc805ae0..1a9693bc9 100644 --- a/src/Util.cpp +++ b/core/src/Util.cpp @@ -171,3 +171,13 @@ fs::path makeRelativePath(const fs::path& path, const fs::path& relativeTo, bool // nothing could be resolved return path; } + +boost::posix_time::ptime string_to_ptime(const std::string& str, const std::string& fmt) +{ + std::istringstream ss(str); + ss.imbue(std::locale(std::locale::classic(), new boost::posix_time::time_input_facet(fmt))); //std::locale handles deleting the facet + boost::posix_time::ptime time; + ss >> time; + + return time; +} diff --git a/src/Util.h b/core/src/Util.h similarity index 89% rename from src/Util.h rename to core/src/Util.h index d72677839..5bf2a1275 100644 --- a/src/Util.h +++ b/core/src/Util.h @@ -1,6 +1,9 @@ +#pragma once + #include #include #include +#include std::string strToUpper(const char* from); std::string& strToUpper(std::string& str); @@ -26,3 +29,5 @@ boost::filesystem::path makeRelativePath(const boost::filesystem::path& path, co // expands "./my/path.sfc" to "[relativeTo]/my/path.sfc" // if allowHome is true, also expands "~/my/path.sfc" to "/home/pi/my/path.sfc" boost::filesystem::path resolvePath(const boost::filesystem::path& path, const boost::filesystem::path& relativeTo, bool allowHome); + +boost::posix_time::ptime string_to_ptime(const std::string& str, const std::string& fmt = "%Y%m%dT%H%M%S%F%q"); diff --git a/src/Window.cpp b/core/src/Window.cpp similarity index 93% rename from src/Window.cpp rename to core/src/Window.cpp index b2c2ccc35..76bb1754e 100644 --- a/src/Window.cpp +++ b/core/src/Window.cpp @@ -2,32 +2,25 @@ #include #include "Renderer.h" #include "AudioManager.h" -#include "VolumeControl.h" #include "Log.h" #include "Settings.h" #include -#include "views/ViewController.h" #include "components/HelpComponent.h" #include "components/ImageComponent.h" Window::Window() : mNormalizeNextUpdate(false), mFrameTimeElapsed(0), mFrameCountElapsed(0), mAverageDeltaTime(10), mAllowSleep(true), mSleeping(false), mTimeSinceLastInput(0) { - mViewController = new ViewController(this); mHelp = new HelpComponent(this); - mBackgroundOverlay = new ImageComponent(this); mBackgroundOverlay->setImage(":/scroll_gradient.png"); - - pushGui(mViewController); } Window::~Window() { - delete mViewController; // this would get deleted down below, but just to be safe, delete it here delete mBackgroundOverlay; - //delete all our GUIs + // delete all our GUIs while(peekGui()) delete peekGui(); @@ -129,14 +122,6 @@ void Window::input(InputConfig* config, Input input) // toggle TextComponent debug view with Ctrl-T Settings::getInstance()->setBool("DebugText", !Settings::getInstance()->getBool("DebugText")); } - else if(config->isMappedTo("mastervolup", input)) - { - VolumeControl::getInstance()->setVolume(VolumeControl::getInstance()->getVolume() + 5); - } - else if(config->isMappedTo("mastervoldown", input)) - { - VolumeControl::getInstance()->setVolume(VolumeControl::getInstance()->getVolume() - 5); - } else { if(peekGui()) diff --git a/src/Window.h b/core/src/Window.h similarity index 81% rename from src/Window.h rename to core/src/Window.h index d7b527452..6576cb04a 100644 --- a/src/Window.h +++ b/core/src/Window.h @@ -1,12 +1,10 @@ -#ifndef _WINDOW_H_ -#define _WINDOW_H_ +#pragma once #include "GuiComponent.h" #include #include "resources/Font.h" #include "InputManager.h" -class ViewController; class HelpComponent; class ImageComponent; @@ -28,8 +26,6 @@ public: bool init(unsigned int width = 0, unsigned int height = 0); void deinit(); - inline ViewController* getViewController() { return mViewController; } - void normalizeNextUpdate(); inline bool isSleeping() const { return mSleeping; } @@ -38,14 +34,13 @@ public: void renderLoadingScreen(); - void renderHelpPromptsEarly(); // used by ViewController to render HelpPrompts before a fade + void renderHelpPromptsEarly(); // used to render HelpPrompts before a fade void setHelpPrompts(const std::vector& prompts, const HelpStyle& style); private: void onSleep(); void onWake(); - ViewController* mViewController; HelpComponent* mHelp; ImageComponent* mBackgroundOverlay; @@ -67,5 +62,3 @@ private: bool mRenderedHelpPrompts; }; - -#endif diff --git a/src/animations/Animation.h b/core/src/animations/Animation.h similarity index 100% rename from src/animations/Animation.h rename to core/src/animations/Animation.h diff --git a/src/animations/AnimationController.cpp b/core/src/animations/AnimationController.cpp similarity index 93% rename from src/animations/AnimationController.cpp rename to core/src/animations/AnimationController.cpp index 09f751477..245aeb926 100644 --- a/src/animations/AnimationController.cpp +++ b/core/src/animations/AnimationController.cpp @@ -1,4 +1,4 @@ -#include "AnimationController.h" +#include "animations/AnimationController.h" AnimationController::AnimationController(Animation* anim, int delay, std::function finishedCallback, bool reverse) : mAnimation(anim), mFinishedCallback(finishedCallback), mReverse(reverse), mTime(-delay), mDelay(delay) diff --git a/src/animations/AnimationController.h b/core/src/animations/AnimationController.h similarity index 96% rename from src/animations/AnimationController.h rename to core/src/animations/AnimationController.h index 7a648546d..2d14f3d8e 100644 --- a/src/animations/AnimationController.h +++ b/core/src/animations/AnimationController.h @@ -2,7 +2,7 @@ #include #include -#include "Animation.h" +#include "animations/Animation.h" class AnimationController { diff --git a/src/animations/LambdaAnimation.h b/core/src/animations/LambdaAnimation.h similarity index 93% rename from src/animations/LambdaAnimation.h rename to core/src/animations/LambdaAnimation.h index 27c5c1dc3..35e1f958a 100644 --- a/src/animations/LambdaAnimation.h +++ b/core/src/animations/LambdaAnimation.h @@ -1,6 +1,6 @@ #pragma once -#include "Animation.h" +#include "animations/Animation.h" // Useful for simple one-off animations, you can supply the animation's apply(t) method right in the constructor as a lambda. class LambdaAnimation : public Animation diff --git a/src/components/AnimatedImageComponent.cpp b/core/src/components/AnimatedImageComponent.cpp similarity index 96% rename from src/components/AnimatedImageComponent.cpp rename to core/src/components/AnimatedImageComponent.cpp index 1ef4e3073..b13415309 100644 --- a/src/components/AnimatedImageComponent.cpp +++ b/core/src/components/AnimatedImageComponent.cpp @@ -1,5 +1,5 @@ -#include "AnimatedImageComponent.h" -#include "../Log.h" +#include "components/AnimatedImageComponent.h" +#include "Log.h" AnimatedImageComponent::AnimatedImageComponent(Window* window) : GuiComponent(window), mEnabled(false) { diff --git a/src/components/AnimatedImageComponent.h b/core/src/components/AnimatedImageComponent.h similarity index 96% rename from src/components/AnimatedImageComponent.h rename to core/src/components/AnimatedImageComponent.h index 53ffc2dd6..da5918879 100644 --- a/src/components/AnimatedImageComponent.h +++ b/core/src/components/AnimatedImageComponent.h @@ -1,4 +1,4 @@ -#include "../GuiComponent.h" +#include "GuiComponent.h" #include "ImageComponent.h" struct AnimationFrame diff --git a/src/components/BusyComponent.cpp b/core/src/components/BusyComponent.cpp similarity index 93% rename from src/components/BusyComponent.cpp rename to core/src/components/BusyComponent.cpp index 68822c54f..184adcbc0 100644 --- a/src/components/BusyComponent.cpp +++ b/core/src/components/BusyComponent.cpp @@ -1,8 +1,8 @@ #include "BusyComponent.h" -#include "AnimatedImageComponent.h" -#include "TextComponent.h" -#include "../Renderer.h" +#include "components/AnimatedImageComponent.h" +#include "components/TextComponent.h" +#include "Renderer.h" // animation definition AnimationFrame BUSY_ANIMATION_FRAMES[] = { diff --git a/src/components/BusyComponent.h b/core/src/components/BusyComponent.h similarity index 77% rename from src/components/BusyComponent.h rename to core/src/components/BusyComponent.h index 44d6d4d2e..88f35dacb 100644 --- a/src/components/BusyComponent.h +++ b/core/src/components/BusyComponent.h @@ -1,6 +1,6 @@ -#include "../GuiComponent.h" -#include "ComponentGrid.h" -#include "NinePatchComponent.h" +#include "GuiComponent.h" +#include "components/ComponentGrid.h" +#include "components/NinePatchComponent.h" class AnimatedImageComponent; class TextComponent; diff --git a/src/components/ButtonComponent.cpp b/core/src/components/ButtonComponent.cpp similarity index 95% rename from src/components/ButtonComponent.cpp rename to core/src/components/ButtonComponent.cpp index 1dae3d043..33f662589 100644 --- a/src/components/ButtonComponent.cpp +++ b/core/src/components/ButtonComponent.cpp @@ -1,8 +1,8 @@ -#include "ButtonComponent.h" -#include "../Renderer.h" -#include "../Window.h" -#include "../Util.h" -#include "../Log.h" +#include "components/ButtonComponent.h" +#include "Renderer.h" +#include "Window.h" +#include "Util.h" +#include "Log.h" ButtonComponent::ButtonComponent(Window* window, const std::string& text, const std::string& helpText, const std::function& func) : GuiComponent(window), mBox(window, ":/button.png"), diff --git a/src/components/ButtonComponent.h b/core/src/components/ButtonComponent.h similarity index 92% rename from src/components/ButtonComponent.h rename to core/src/components/ButtonComponent.h index d5d053487..25cb76e4c 100644 --- a/src/components/ButtonComponent.h +++ b/core/src/components/ButtonComponent.h @@ -1,9 +1,9 @@ #pragma once -#include "../GuiComponent.h" +#include "GuiComponent.h" #include -#include "../resources/Font.h" -#include "NinePatchComponent.h" +#include "resources/Font.h" +#include "components/NinePatchComponent.h" class ButtonComponent : public GuiComponent { diff --git a/src/components/ComponentGrid.cpp b/core/src/components/ComponentGrid.cpp similarity index 99% rename from src/components/ComponentGrid.cpp rename to core/src/components/ComponentGrid.cpp index 07bc8fd83..89dd157cc 100644 --- a/src/components/ComponentGrid.cpp +++ b/core/src/components/ComponentGrid.cpp @@ -1,7 +1,7 @@ -#include "ComponentGrid.h" -#include "../Log.h" -#include "../Renderer.h" -#include "../Settings.h" +#include "components/ComponentGrid.h" +#include "Log.h" +#include "Renderer.h" +#include "Settings.h" using namespace GridFlags; diff --git a/src/components/ComponentGrid.h b/core/src/components/ComponentGrid.h similarity index 99% rename from src/components/ComponentGrid.h rename to core/src/components/ComponentGrid.h index 68a45ab1b..ee1547c1c 100644 --- a/src/components/ComponentGrid.h +++ b/core/src/components/ComponentGrid.h @@ -1,6 +1,6 @@ #pragma once -#include "../GuiComponent.h" +#include "GuiComponent.h" namespace GridFlags { diff --git a/src/components/ComponentList.cpp b/core/src/components/ComponentList.cpp similarity index 99% rename from src/components/ComponentList.cpp rename to core/src/components/ComponentList.cpp index 043fcaf60..a16bcb097 100644 --- a/src/components/ComponentList.cpp +++ b/core/src/components/ComponentList.cpp @@ -1,6 +1,6 @@ -#include "ComponentList.h" -#include "../Util.h" -#include "../Log.h" +#include "components/ComponentList.h" +#include "Util.h" +#include "Log.h" #define TOTAL_HORIZONTAL_PADDING_PX 20 diff --git a/src/components/ComponentList.h b/core/src/components/ComponentList.h similarity index 100% rename from src/components/ComponentList.h rename to core/src/components/ComponentList.h diff --git a/src/components/DateTimeComponent.cpp b/core/src/components/DateTimeComponent.cpp similarity index 98% rename from src/components/DateTimeComponent.cpp rename to core/src/components/DateTimeComponent.cpp index c9ed78ee1..6015be506 100644 --- a/src/components/DateTimeComponent.cpp +++ b/core/src/components/DateTimeComponent.cpp @@ -1,9 +1,8 @@ -#include "DateTimeComponent.h" -#include "../MetaData.h" -#include "../Renderer.h" -#include "../Window.h" -#include "../Log.h" -#include "../Util.h" +#include "components/DateTimeComponent.h" +#include "Renderer.h" +#include "Window.h" +#include "Log.h" +#include "Util.h" DateTimeComponent::DateTimeComponent(Window* window, DisplayMode dispMode) : GuiComponent(window), mEditing(false), mEditIndex(0), mDisplayMode(dispMode), mRelativeUpdateAccumulator(0), diff --git a/src/components/DateTimeComponent.h b/core/src/components/DateTimeComponent.h similarity index 97% rename from src/components/DateTimeComponent.h rename to core/src/components/DateTimeComponent.h index 17e5ee920..82cf38577 100644 --- a/src/components/DateTimeComponent.h +++ b/core/src/components/DateTimeComponent.h @@ -1,8 +1,8 @@ #pragma once -#include "../GuiComponent.h" +#include "GuiComponent.h" #include -#include "../resources/Font.h" +#include "resources/Font.h" // Used to enter or display a specific point in time. class DateTimeComponent : public GuiComponent diff --git a/src/components/HelpComponent.cpp b/core/src/components/HelpComponent.cpp similarity index 94% rename from src/components/HelpComponent.cpp rename to core/src/components/HelpComponent.cpp index c88023616..fdaecd360 100644 --- a/src/components/HelpComponent.cpp +++ b/core/src/components/HelpComponent.cpp @@ -1,12 +1,11 @@ -#include "HelpComponent.h" -#include "../Renderer.h" -#include "../Settings.h" -#include "../Log.h" -#include "../Util.h" -#include "ImageComponent.h" -#include "TextComponent.h" -#include "ComponentGrid.h" - +#include "components/HelpComponent.h" +#include "Renderer.h" +#include "Settings.h" +#include "Log.h" +#include "Util.h" +#include "components/ImageComponent.h" +#include "components/TextComponent.h" +#include "components/ComponentGrid.h" #include #define OFFSET_X 12 // move the entire thing right by this amount (px) diff --git a/src/components/HelpComponent.h b/core/src/components/HelpComponent.h similarity index 92% rename from src/components/HelpComponent.h rename to core/src/components/HelpComponent.h index cd30be666..464e353dc 100644 --- a/src/components/HelpComponent.h +++ b/core/src/components/HelpComponent.h @@ -1,7 +1,7 @@ #pragma once -#include "../GuiComponent.h" -#include "../HelpStyle.h" +#include "GuiComponent.h" +#include "HelpStyle.h" class ImageComponent; class TextureResource; diff --git a/src/components/IList.h b/core/src/components/IList.h similarity index 98% rename from src/components/IList.h rename to core/src/components/IList.h index f6bca9dc3..85d806496 100644 --- a/src/components/IList.h +++ b/core/src/components/IList.h @@ -3,10 +3,10 @@ #include #include #include -#include "../GuiComponent.h" -#include "ImageComponent.h" -#include "../resources/Font.h" -#include "../Renderer.h" +#include "GuiComponent.h" +#include "components/ImageComponent.h" +#include "resources/Font.h" +#include "Renderer.h" enum CursorState { diff --git a/src/components/ImageComponent.cpp b/core/src/components/ImageComponent.cpp similarity index 98% rename from src/components/ImageComponent.cpp rename to core/src/components/ImageComponent.cpp index 1ac2c478a..2898c6f73 100644 --- a/src/components/ImageComponent.cpp +++ b/core/src/components/ImageComponent.cpp @@ -1,12 +1,12 @@ -#include "ImageComponent.h" +#include "components/ImageComponent.h" #include #include #include -#include "../Log.h" -#include "../Renderer.h" -#include "../ThemeData.h" -#include "../Util.h" -#include "../resources/SVGResource.h" +#include "Log.h" +#include "Renderer.h" +#include "ThemeData.h" +#include "Util.h" +#include "resources/SVGResource.h" Eigen::Vector2i ImageComponent::getTextureSize() const { diff --git a/src/components/ImageComponent.h b/core/src/components/ImageComponent.h similarity index 96% rename from src/components/ImageComponent.h rename to core/src/components/ImageComponent.h index a05be6d29..939c6c7cd 100644 --- a/src/components/ImageComponent.h +++ b/core/src/components/ImageComponent.h @@ -1,13 +1,13 @@ #ifndef _IMAGECOMPONENT_H_ #define _IMAGECOMPONENT_H_ -#include "../platform.h" +#include "platform.h" #include GLHEADER -#include "../GuiComponent.h" +#include "GuiComponent.h" #include #include -#include "../resources/TextureResource.h" +#include "resources/TextureResource.h" class ImageComponent : public GuiComponent { diff --git a/src/components/ImageGridComponent.h b/core/src/components/ImageGridComponent.h similarity index 98% rename from src/components/ImageGridComponent.h rename to core/src/components/ImageGridComponent.h index d58e80cf7..b00a6c624 100644 --- a/src/components/ImageGridComponent.h +++ b/core/src/components/ImageGridComponent.h @@ -1,9 +1,9 @@ #pragma once -#include "../GuiComponent.h" -#include "IList.h" -#include "../components/ImageComponent.h" -#include "../Log.h" +#include "GuiComponent.h" +#include "components/IList.h" +#include "components/ImageComponent.h" +#include "Log.h" struct ImageGridData { diff --git a/src/components/MenuComponent.cpp b/core/src/components/MenuComponent.cpp similarity index 97% rename from src/components/MenuComponent.cpp rename to core/src/components/MenuComponent.cpp index 443b847b1..589bc6fab 100644 --- a/src/components/MenuComponent.cpp +++ b/core/src/components/MenuComponent.cpp @@ -1,5 +1,5 @@ -#include "MenuComponent.h" -#include "ButtonComponent.h" +#include "components/MenuComponent.h" +#include "components/ButtonComponent.h" #define BUTTON_GRID_VERT_PADDING 32 #define BUTTON_GRID_HORIZ_PADDING 10 diff --git a/src/components/MenuComponent.h b/core/src/components/MenuComponent.h similarity index 91% rename from src/components/MenuComponent.h rename to core/src/components/MenuComponent.h index f1f3c096a..227d8b27e 100644 --- a/src/components/MenuComponent.h +++ b/core/src/components/MenuComponent.h @@ -1,10 +1,10 @@ #pragma once -#include "NinePatchComponent.h" -#include "ComponentList.h" -#include "TextComponent.h" -#include "ComponentGrid.h" -#include "../Util.h" +#include "components/NinePatchComponent.h" +#include "components/ComponentList.h" +#include "components/TextComponent.h" +#include "components/ComponentGrid.h" +#include "Util.h" class ButtonComponent; class ImageComponent; diff --git a/src/components/NinePatchComponent.cpp b/core/src/components/NinePatchComponent.cpp similarity index 97% rename from src/components/NinePatchComponent.cpp rename to core/src/components/NinePatchComponent.cpp index eafa908bd..9d10be123 100644 --- a/src/components/NinePatchComponent.cpp +++ b/core/src/components/NinePatchComponent.cpp @@ -1,9 +1,9 @@ -#include "NinePatchComponent.h" -#include "../Window.h" -#include "../Log.h" -#include "../Renderer.h" -#include "../ThemeData.h" -#include "../Util.h" +#include "components/NinePatchComponent.h" +#include "Window.h" +#include "Log.h" +#include "Renderer.h" +#include "ThemeData.h" +#include "Util.h" NinePatchComponent::NinePatchComponent(Window* window, const std::string& path, unsigned int edgeColor, unsigned int centerColor) : GuiComponent(window), mEdgeColor(edgeColor), mCenterColor(centerColor), diff --git a/src/components/NinePatchComponent.h b/core/src/components/NinePatchComponent.h similarity index 95% rename from src/components/NinePatchComponent.h rename to core/src/components/NinePatchComponent.h index aebbcd1eb..ca99c859e 100644 --- a/src/components/NinePatchComponent.h +++ b/core/src/components/NinePatchComponent.h @@ -1,7 +1,7 @@ #pragma once -#include "../GuiComponent.h" -#include "../resources/TextureResource.h" +#include "GuiComponent.h" +#include "resources/TextureResource.h" // Display an image in a way so that edges don't get too distorted no matter the final size. Useful for UI elements like backgrounds, buttons, etc. // This is accomplished by splitting an image into 9 pieces: diff --git a/src/components/OptionListComponent.h b/core/src/components/OptionListComponent.h similarity index 97% rename from src/components/OptionListComponent.h rename to core/src/components/OptionListComponent.h index 59c46c96d..40ff34fff 100644 --- a/src/components/OptionListComponent.h +++ b/core/src/components/OptionListComponent.h @@ -1,14 +1,14 @@ #pragma once -#include "../GuiComponent.h" -#include "../resources/Font.h" -#include "../Renderer.h" -#include "../Window.h" -#include "TextComponent.h" -#include "ImageComponent.h" -#include "MenuComponent.h" +#include "GuiComponent.h" +#include "resources/Font.h" +#include "Renderer.h" +#include "Window.h" +#include "components/TextComponent.h" +#include "components/ImageComponent.h" +#include "components/MenuComponent.h" #include -#include "../Log.h" +#include "Log.h" //Used to display a list of options. //Can select one or multiple options. diff --git a/src/components/ScrollableContainer.cpp b/core/src/components/ScrollableContainer.cpp similarity index 97% rename from src/components/ScrollableContainer.cpp rename to core/src/components/ScrollableContainer.cpp index f6b41072e..f709c062f 100644 --- a/src/components/ScrollableContainer.cpp +++ b/core/src/components/ScrollableContainer.cpp @@ -1,6 +1,6 @@ -#include "ScrollableContainer.h" -#include "../Renderer.h" -#include "../Log.h" +#include "components/ScrollableContainer.h" +#include "Renderer.h" +#include "Log.h" #define AUTO_SCROLL_RESET_DELAY 10000 // ms to reset to top after we reach the bottom #define AUTO_SCROLL_DELAY 8000 // ms to wait before we start to scroll diff --git a/src/components/ScrollableContainer.h b/core/src/components/ScrollableContainer.h similarity index 95% rename from src/components/ScrollableContainer.h rename to core/src/components/ScrollableContainer.h index 486a64595..79ae94359 100644 --- a/src/components/ScrollableContainer.h +++ b/core/src/components/ScrollableContainer.h @@ -1,6 +1,6 @@ #pragma once -#include "../GuiComponent.h" +#include "GuiComponent.h" class ScrollableContainer : public GuiComponent { diff --git a/src/components/SliderComponent.cpp b/core/src/components/SliderComponent.cpp similarity index 96% rename from src/components/SliderComponent.cpp rename to core/src/components/SliderComponent.cpp index 65165cfb1..71a7fe8fa 100644 --- a/src/components/SliderComponent.cpp +++ b/core/src/components/SliderComponent.cpp @@ -1,9 +1,9 @@ -#include "SliderComponent.h" +#include "components/SliderComponent.h" #include -#include "../Renderer.h" -#include "../resources/Font.h" -#include "../Log.h" -#include "../Util.h" +#include "Renderer.h" +#include "resources/Font.h" +#include "Log.h" +#include "Util.h" #define MOVE_REPEAT_DELAY 500 #define MOVE_REPEAT_RATE 40 diff --git a/src/components/SliderComponent.h b/core/src/components/SliderComponent.h similarity index 93% rename from src/components/SliderComponent.h rename to core/src/components/SliderComponent.h index fc0d7ea68..900178c7e 100644 --- a/src/components/SliderComponent.h +++ b/core/src/components/SliderComponent.h @@ -1,7 +1,7 @@ #pragma once -#include "../GuiComponent.h" -#include "ImageComponent.h" +#include "GuiComponent.h" +#include "components/ImageComponent.h" class TextCache; class Font; diff --git a/src/components/SwitchComponent.cpp b/core/src/components/SwitchComponent.cpp similarity index 93% rename from src/components/SwitchComponent.cpp rename to core/src/components/SwitchComponent.cpp index bbf11bb09..07b425b25 100644 --- a/src/components/SwitchComponent.cpp +++ b/core/src/components/SwitchComponent.cpp @@ -1,7 +1,7 @@ #include "SwitchComponent.h" -#include "../Renderer.h" -#include "../resources/Font.h" -#include "../Window.h" +#include "Renderer.h" +#include "resources/Font.h" +#include "Window.h" SwitchComponent::SwitchComponent(Window* window, bool state) : GuiComponent(window), mImage(window), mState(state) { diff --git a/src/components/SwitchComponent.h b/core/src/components/SwitchComponent.h similarity index 89% rename from src/components/SwitchComponent.h rename to core/src/components/SwitchComponent.h index cb267f8dc..e173762a7 100644 --- a/src/components/SwitchComponent.h +++ b/core/src/components/SwitchComponent.h @@ -1,7 +1,7 @@ #pragma once -#include "../GuiComponent.h" -#include "ImageComponent.h" +#include "GuiComponent.h" +#include "components/ImageComponent.h" // A very simple "on/off" switch. // Should hopefully be switched to use images instead of text in the future. diff --git a/src/components/TextComponent.cpp b/core/src/components/TextComponent.cpp similarity index 97% rename from src/components/TextComponent.cpp rename to core/src/components/TextComponent.cpp index 63f38a4e1..06948df60 100644 --- a/src/components/TextComponent.cpp +++ b/core/src/components/TextComponent.cpp @@ -1,10 +1,10 @@ -#include "TextComponent.h" -#include "../Renderer.h" -#include "../Log.h" -#include "../Window.h" -#include "../ThemeData.h" -#include "../Util.h" -#include "../Settings.h" +#include "components/TextComponent.h" +#include "Renderer.h" +#include "Log.h" +#include "Window.h" +#include "ThemeData.h" +#include "Util.h" +#include "Settings.h" TextComponent::TextComponent(Window* window) : GuiComponent(window), mFont(Font::get(FONT_SIZE_MEDIUM)), mUppercase(false), mColor(0x000000FF), mAutoCalcExtent(true, true), mAlignment(ALIGN_LEFT), mLineSpacing(1.5f) diff --git a/src/components/TextComponent.h b/core/src/components/TextComponent.h similarity index 96% rename from src/components/TextComponent.h rename to core/src/components/TextComponent.h index 6d288c5e6..4a4a33fcd 100644 --- a/src/components/TextComponent.h +++ b/core/src/components/TextComponent.h @@ -1,8 +1,8 @@ #ifndef _TEXTCOMPONENT_H_ #define _TEXTCOMPONENT_H_ -#include "../GuiComponent.h" -#include "../resources/Font.h" +#include "GuiComponent.h" +#include "resources/Font.h" class ThemeData; diff --git a/src/components/TextEditComponent.cpp b/core/src/components/TextEditComponent.cpp similarity index 97% rename from src/components/TextEditComponent.cpp rename to core/src/components/TextEditComponent.cpp index 02bcd6f5d..b5ceada83 100644 --- a/src/components/TextEditComponent.cpp +++ b/core/src/components/TextEditComponent.cpp @@ -1,9 +1,9 @@ -#include "TextEditComponent.h" -#include "../Log.h" -#include "../resources/Font.h" -#include "../Window.h" -#include "../Renderer.h" -#include "../Util.h" +#include "components/TextEditComponent.h" +#include "Log.h" +#include "resources/Font.h" +#include "Window.h" +#include "Renderer.h" +#include "Util.h" #define TEXT_PADDING_HORIZ 10 #define TEXT_PADDING_VERT 2 diff --git a/src/components/TextEditComponent.h b/core/src/components/TextEditComponent.h similarity index 95% rename from src/components/TextEditComponent.h rename to core/src/components/TextEditComponent.h index 14fb2a01d..56179af1a 100644 --- a/src/components/TextEditComponent.h +++ b/core/src/components/TextEditComponent.h @@ -1,7 +1,7 @@ #pragma once -#include "../GuiComponent.h" -#include "NinePatchComponent.h" +#include "GuiComponent.h" +#include "components/NinePatchComponent.h" class Font; class TextCache; diff --git a/src/guis/GuiDetectDevice.cpp b/core/src/guis/GuiDetectDevice.cpp similarity index 88% rename from src/guis/GuiDetectDevice.cpp rename to core/src/guis/GuiDetectDevice.cpp index 51578705f..95deea1ea 100644 --- a/src/guis/GuiDetectDevice.cpp +++ b/core/src/guis/GuiDetectDevice.cpp @@ -1,35 +1,28 @@ -#include "GuiDetectDevice.h" -#include "../Window.h" -#include "../Renderer.h" -#include "../resources/Font.h" -#include "GuiInputConfig.h" -#include "../components/TextComponent.h" +#include "guis/GuiDetectDevice.h" +#include "Window.h" +#include "Renderer.h" +#include "resources/Font.h" +#include "guis/GuiInputConfig.h" +#include "components/TextComponent.h" #include #include #include -#include "../views/ViewController.h" -#include "../Util.h" +#include "Util.h" #define HOLD_TIME 1000 using namespace Eigen; -GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun) : GuiComponent(window), mFirstRun(firstRun), +GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun, const std::function& doneCallback) : GuiComponent(window), mFirstRun(firstRun), mBackground(window, ":/frame.png"), mGrid(window, Vector2i(1, 5)) { mHoldingConfig = NULL; mHoldTime = 0; + mDoneCallback = doneCallback; addChild(&mBackground); addChild(&mGrid); - - if(firstRun) - { - mDoneCallback = [window] { - window->getViewController()->goToStart(); - }; - } - + // title mTitle = std::make_shared(mWindow, firstRun ? "WELCOME" : "CONFIGURE INPUT", Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER); diff --git a/src/guis/GuiDetectDevice.h b/core/src/guis/GuiDetectDevice.h similarity index 75% rename from src/guis/GuiDetectDevice.h rename to core/src/guis/GuiDetectDevice.h index ebc43b7b5..f03f940ac 100644 --- a/src/guis/GuiDetectDevice.h +++ b/core/src/guis/GuiDetectDevice.h @@ -1,15 +1,15 @@ #pragma once -#include "../GuiComponent.h" -#include "../components/NinePatchComponent.h" -#include "../components/ComponentGrid.h" +#include "GuiComponent.h" +#include "components/NinePatchComponent.h" +#include "components/ComponentGrid.h" class TextComponent; class GuiDetectDevice : public GuiComponent { public: - GuiDetectDevice(Window* window, bool firstRun); + GuiDetectDevice(Window* window, bool firstRun, const std::function& doneCallback); bool input(InputConfig* config, Input input) override; void update(int deltaTime) override; diff --git a/src/guis/GuiInputConfig.cpp b/core/src/guis/GuiInputConfig.cpp similarity index 97% rename from src/guis/GuiInputConfig.cpp rename to core/src/guis/GuiInputConfig.cpp index 972b06a95..b4522709f 100644 --- a/src/guis/GuiInputConfig.cpp +++ b/core/src/guis/GuiInputConfig.cpp @@ -1,11 +1,11 @@ -#include "GuiInputConfig.h" -#include "../Window.h" -#include "../Log.h" -#include "../components/TextComponent.h" -#include "../components/ImageComponent.h" -#include "../components/MenuComponent.h" -#include "../components/ButtonComponent.h" -#include "../Util.h" +#include "guis/GuiInputConfig.h" +#include "Window.h" +#include "Log.h" +#include "components/TextComponent.h" +#include "components/ImageComponent.h" +#include "components/MenuComponent.h" +#include "components/ButtonComponent.h" +#include "Util.h" static const int inputCount = 10; static const char* inputName[inputCount] = { "Up", "Down", "Left", "Right", "A", "B", "Start", "Select", "PageUp", "PageDown" }; diff --git a/src/guis/GuiInputConfig.h b/core/src/guis/GuiInputConfig.h similarity index 90% rename from src/guis/GuiInputConfig.h rename to core/src/guis/GuiInputConfig.h index 490d69f47..20af11df8 100644 --- a/src/guis/GuiInputConfig.h +++ b/core/src/guis/GuiInputConfig.h @@ -1,9 +1,9 @@ #pragma once -#include "../GuiComponent.h" -#include "../components/NinePatchComponent.h" -#include "../components/ComponentGrid.h" -#include "../components/ComponentList.h" +#include "GuiComponent.h" +#include "components/NinePatchComponent.h" +#include "components/ComponentGrid.h" +#include "components/ComponentList.h" class TextComponent; diff --git a/src/guis/GuiMsgBox.cpp b/core/src/guis/GuiMsgBox.cpp similarity index 93% rename from src/guis/GuiMsgBox.cpp rename to core/src/guis/GuiMsgBox.cpp index abf1c430b..73f4e07a6 100644 --- a/src/guis/GuiMsgBox.cpp +++ b/core/src/guis/GuiMsgBox.cpp @@ -1,10 +1,10 @@ -#include "GuiMsgBox.h" -#include "../Renderer.h" -#include "../components/TextComponent.h" -#include "../components/ButtonComponent.h" -#include "../components/MenuComponent.h" // for makeButtonGrid -#include "../Util.h" -#include "../Log.h" +#include "guis/GuiMsgBox.h" +#include "Renderer.h" +#include "components/TextComponent.h" +#include "components/ButtonComponent.h" +#include "components/MenuComponent.h" // for makeButtonGrid +#include "Util.h" +#include "Log.h" #define HORIZONTAL_PADDING_PX 20 diff --git a/src/guis/GuiMsgBox.h b/core/src/guis/GuiMsgBox.h similarity index 88% rename from src/guis/GuiMsgBox.h rename to core/src/guis/GuiMsgBox.h index d24c23459..6da246916 100644 --- a/src/guis/GuiMsgBox.h +++ b/core/src/guis/GuiMsgBox.h @@ -1,8 +1,8 @@ #pragma once -#include "../GuiComponent.h" -#include "../components/NinePatchComponent.h" -#include "../components/ComponentGrid.h" +#include "GuiComponent.h" +#include "components/NinePatchComponent.h" +#include "components/ComponentGrid.h" class TextComponent; class ButtonComponent; diff --git a/src/guis/GuiTextEditPopup.cpp b/core/src/guis/GuiTextEditPopup.cpp similarity index 97% rename from src/guis/GuiTextEditPopup.cpp rename to core/src/guis/GuiTextEditPopup.cpp index 07bb9b2f7..dcb4a47f7 100644 --- a/src/guis/GuiTextEditPopup.cpp +++ b/core/src/guis/GuiTextEditPopup.cpp @@ -1,5 +1,5 @@ -#include "GuiTextEditPopup.h" -#include "../components/MenuComponent.h" +#include "guis/GuiTextEditPopup.h" +#include "components/MenuComponent.h" using namespace Eigen; diff --git a/src/guis/GuiTextEditPopup.h b/core/src/guis/GuiTextEditPopup.h similarity index 70% rename from src/guis/GuiTextEditPopup.h rename to core/src/guis/GuiTextEditPopup.h index aaa8a596d..9cba8df3d 100644 --- a/src/guis/GuiTextEditPopup.h +++ b/core/src/guis/GuiTextEditPopup.h @@ -1,10 +1,10 @@ -#include "../GuiComponent.h" +#include "GuiComponent.h" -#include "../components/NinePatchComponent.h" -#include "../components/ButtonComponent.h" -#include "../components/ComponentGrid.h" -#include "../components/TextEditComponent.h" -#include "../components/TextComponent.h" +#include "components/NinePatchComponent.h" +#include "components/ButtonComponent.h" +#include "components/ComponentGrid.h" +#include "components/TextEditComponent.h" +#include "components/TextComponent.h" class GuiTextEditPopup : public GuiComponent { diff --git a/src/platform.cpp b/core/src/platform.cpp similarity index 100% rename from src/platform.cpp rename to core/src/platform.cpp diff --git a/src/platform.h b/core/src/platform.h similarity index 100% rename from src/platform.h rename to core/src/platform.h diff --git a/src/resources/Font.cpp b/core/src/resources/Font.cpp similarity index 99% rename from src/resources/Font.cpp rename to core/src/resources/Font.cpp index 0bba66bc3..170701dd1 100644 --- a/src/resources/Font.cpp +++ b/core/src/resources/Font.cpp @@ -1,11 +1,11 @@ -#include "Font.h" +#include "resources/Font.h" #include #include #include -#include "../Renderer.h" #include -#include "../Log.h" -#include "../Util.h" +#include "Renderer.h" +#include "Log.h" +#include "Util.h" FT_Library Font::sLibrary = NULL; diff --git a/src/resources/Font.h b/core/src/resources/Font.h similarity index 98% rename from src/resources/Font.h rename to core/src/resources/Font.h index 070322f5d..70c889c96 100644 --- a/src/resources/Font.h +++ b/core/src/resources/Font.h @@ -1,13 +1,13 @@ #pragma once #include -#include "../platform.h" +#include "platform.h" #include GLHEADER #include #include FT_FREETYPE_H #include -#include "ResourceManager.h" -#include "../ThemeData.h" +#include "resources/ResourceManager.h" +#include "ThemeData.h" class TextCache; diff --git a/src/resources/ResourceManager.cpp b/core/src/resources/ResourceManager.cpp similarity index 97% rename from src/resources/ResourceManager.cpp rename to core/src/resources/ResourceManager.cpp index 5f2021607..b495c860f 100644 --- a/src/resources/ResourceManager.cpp +++ b/core/src/resources/ResourceManager.cpp @@ -1,6 +1,6 @@ #include "ResourceManager.h" -#include "../Log.h" -#include "../../data/Resources.h" +#include "Log.h" +#include "../data/Resources.h" #include #include diff --git a/src/resources/ResourceManager.h b/core/src/resources/ResourceManager.h similarity index 100% rename from src/resources/ResourceManager.h rename to core/src/resources/ResourceManager.h diff --git a/src/resources/SVGResource.cpp b/core/src/resources/SVGResource.cpp similarity index 94% rename from src/resources/SVGResource.cpp rename to core/src/resources/SVGResource.cpp index 2f88e170f..1a4ea16fc 100644 --- a/src/resources/SVGResource.cpp +++ b/core/src/resources/SVGResource.cpp @@ -1,9 +1,9 @@ #include "SVGResource.h" -#include "../nanosvg/nanosvg.h" -#include "../nanosvg/nanosvgrast.h" -#include "../Log.h" -#include "../Util.h" -#include "../ImageIO.h" +#include "nanosvg/nanosvg.h" +#include "nanosvg/nanosvgrast.h" +#include "Log.h" +#include "Util.h" +#include "ImageIO.h" #define DPI 96 diff --git a/src/resources/SVGResource.h b/core/src/resources/SVGResource.h similarity index 93% rename from src/resources/SVGResource.h rename to core/src/resources/SVGResource.h index c68ae4879..87479c0cf 100644 --- a/src/resources/SVGResource.h +++ b/core/src/resources/SVGResource.h @@ -1,6 +1,6 @@ #pragma once -#include "TextureResource.h" +#include "resources/TextureResource.h" struct NSVGimage; diff --git a/src/resources/TextureResource.cpp b/core/src/resources/TextureResource.cpp similarity index 96% rename from src/resources/TextureResource.cpp rename to core/src/resources/TextureResource.cpp index 120f01d19..e6657dcc2 100644 --- a/src/resources/TextureResource.cpp +++ b/core/src/resources/TextureResource.cpp @@ -1,11 +1,11 @@ -#include "TextureResource.h" -#include "../Log.h" -#include "../platform.h" +#include "resources/TextureResource.h" +#include "Log.h" +#include "platform.h" #include GLHEADER -#include "../ImageIO.h" -#include "../Renderer.h" -#include "../Util.h" -#include "SVGResource.h" +#include "ImageIO.h" +#include "Renderer.h" +#include "Util.h" +#include "resources/SVGResource.h" std::map< TextureResource::TextureKeyType, std::weak_ptr > TextureResource::sTextureMap; std::list< std::weak_ptr > TextureResource::sTextureList; diff --git a/src/resources/TextureResource.h b/core/src/resources/TextureResource.h similarity index 96% rename from src/resources/TextureResource.h rename to core/src/resources/TextureResource.h index 578fb7913..811e71de3 100644 --- a/src/resources/TextureResource.h +++ b/core/src/resources/TextureResource.h @@ -1,10 +1,10 @@ #pragma once -#include "ResourceManager.h" +#include "resources/ResourceManager.h" #include #include -#include "../platform.h" +#include "platform.h" #include GLHEADER // An OpenGL texture. diff --git a/es/CMakeLists.txt b/es/CMakeLists.txt new file mode 100644 index 000000000..3a965a1ce --- /dev/null +++ b/es/CMakeLists.txt @@ -0,0 +1,149 @@ +project("es-app") + +set(ES_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/src/EmulationStation.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/FileData.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/FileSorts.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.h + + # GuiComponents + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AsyncReqComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScraperSearchComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextListComponent.h + + # Guis + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiFastSelect.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettings.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperMulti.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperStart.h + + # Scrapers + ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/Scraper.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/GamesDBScraper.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/TheArchiveScraper.h + + # Views + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGameListView.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGameListView.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGameListView.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGameListView.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGameListView.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/ViewController.h + + # Animations + ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/LaunchAnimation.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/MoveCameraAnimation.h +) + +set(ES_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/FileData.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/FileSorts.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/MameNameMap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.cpp + + # GuiComponents + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AsyncReqComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScraperSearchComponent.cpp + + # Guis + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiFastSelect.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettings.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperMulti.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperStart.cpp + + # Scrapers + ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/Scraper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/GamesDBScraper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/TheArchiveScraper.cpp + + # Views + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGameListView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGameListView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGameListView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGameListView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGameListView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/views/ViewController.cpp +) + +#------------------------------------------------------------------------------- +# define OS specific sources and headers +if(MSVC) + LIST(APPEND ES_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/EmulationStation.rc + ) +endif() + +#------------------------------------------------------------------------------- +# define target +include_directories(${COMMON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/src) +add_executable(emulationstation ${ES_SOURCES} ${ES_HEADERS}) +target_link_libraries(emulationstation ${COMMON_LIBRARIES} es-core) + +# special properties for Windows builds +if(MSVC) + #show console in debug builds, but not in proper release builds + #Note that up to CMake 2.8.10 this feature is broken: http://public.kitware.com/Bug/view.php?id=12566 + set_target_properties(emulationstation PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE") + set_target_properties(emulationstation PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE") + set_target_properties(emulationstation PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE") + set_target_properties(emulationstation PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE") + set_target_properties(emulationstation PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") + set_target_properties(emulationstation PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS") +endif() + + +#------------------------------------------------------------------------------- +# set up CPack install stuff so `make install` does something useful + +install(TARGETS emulationstation + RUNTIME + DESTINATION bin) + +INCLUDE(InstallRequiredSystemLibraries) + +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A flexible graphical emulator front-end") +SET(CPACK_PACKAGE_DESCRIPTION "EmulationStation is a flexible, graphical front-end designed for keyboardless navigation of your multi-platform retro game collection.") + +SET(CPACK_RESOURCE_FILE LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md") +SET(CPACK_RESOURCE_FILE README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") + +SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Alec Lofquist ") +SET(CPACK_DEBIAN_PACKAGE_SECTION "misc") +SET(CPACK_DEBIAN_PACKAGE_PRIORITY "extra") +SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libsdl2-2.0-0, libboost-system1.54.0, libboost-filesystem1.54.0, libfreeimage3, libfreetype6, libcurl3, libasound2") +SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS "debhelper (>= 8.0.0), cmake, g++ (>= 4.8), libsdl2-dev, libboost-system-dev, libboost-filesystem-dev, libboost-date-time-dev, libfreeimage-dev, libfreetype6-dev, libeigen3-dev, libcurl4-openssl-dev, libasound2-dev, libgl1-mesa-dev") + +SET(CPACK_PACKAGE_VENDOR "emulationstation.org") +SET(CPACK_PACKAGE_VERSION "2.0.0~rc1") +SET(CPACK_PACKAGE_VERSION_MAJOR "2") +SET(CPACK_PACKAGE_VERSION_MINOR "0") +SET(CPACK_PACKAGE_VERSION_PATCH "0") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "emulationstation_${CMAKE_PACKAGE_VERSION}") +SET(CPACK_PACKAGE_EXECUTABLES "emulationstation" "emulationstation") + +SET(CPACK_GENERATOR "TGZ;DEB") + +INCLUDE(CPack) diff --git a/es/src/EmulationStation.aps b/es/src/EmulationStation.aps new file mode 100644 index 000000000..2fce32bb8 Binary files /dev/null and b/es/src/EmulationStation.aps differ diff --git a/src/EmulationStation.h b/es/src/EmulationStation.h similarity index 100% rename from src/EmulationStation.h rename to es/src/EmulationStation.h diff --git a/src/EmulationStation.rc b/es/src/EmulationStation.rc similarity index 100% rename from src/EmulationStation.rc rename to es/src/EmulationStation.rc diff --git a/src/FileData.cpp b/es/src/FileData.cpp similarity index 100% rename from src/FileData.cpp rename to es/src/FileData.cpp diff --git a/src/FileData.h b/es/src/FileData.h similarity index 100% rename from src/FileData.h rename to es/src/FileData.h diff --git a/src/FileSorts.cpp b/es/src/FileSorts.cpp similarity index 100% rename from src/FileSorts.cpp rename to es/src/FileSorts.cpp diff --git a/src/FileSorts.h b/es/src/FileSorts.h similarity index 100% rename from src/FileSorts.h rename to es/src/FileSorts.h diff --git a/src/Gamelist.cpp b/es/src/Gamelist.cpp similarity index 100% rename from src/Gamelist.cpp rename to es/src/Gamelist.cpp diff --git a/src/Gamelist.h b/es/src/Gamelist.h similarity index 100% rename from src/Gamelist.h rename to es/src/Gamelist.h diff --git a/src/MameNameMap.cpp b/es/src/MameNameMap.cpp similarity index 100% rename from src/MameNameMap.cpp rename to es/src/MameNameMap.cpp diff --git a/src/MetaData.cpp b/es/src/MetaData.cpp similarity index 92% rename from src/MetaData.cpp rename to es/src/MetaData.cpp index de111f9e4..2d5340bd2 100644 --- a/src/MetaData.cpp +++ b/es/src/MetaData.cpp @@ -133,14 +133,3 @@ boost::posix_time::ptime MetaDataList::getTime(const std::string& key) const { return string_to_ptime(get(key), "%Y%m%dT%H%M%S%F%q"); } - -//util function -boost::posix_time::ptime string_to_ptime(const std::string& str, const std::string& fmt) -{ - std::istringstream ss(str); - ss.imbue(std::locale(std::locale::classic(), new boost::posix_time::time_input_facet(fmt))); //std::locale handles deleting the facet - boost::posix_time::ptime time; - ss >> time; - - return time; -} diff --git a/src/MetaData.h b/es/src/MetaData.h similarity index 92% rename from src/MetaData.h rename to es/src/MetaData.h index 9cecdda2a..1143d9204 100644 --- a/src/MetaData.h +++ b/es/src/MetaData.h @@ -1,6 +1,6 @@ #pragma once -#include "pugiXML/pugixml.hpp" +#include "pugixml/pugixml.hpp" #include #include #include "GuiComponent.h" @@ -32,8 +32,6 @@ struct MetaDataDecl std::string displayPrompt; // phrase displayed in editors when prompted to enter value (currently only for strings) }; -boost::posix_time::ptime string_to_ptime(const std::string& str, const std::string& fmt = "%Y%m%dT%H%M%S%F%q"); - enum MetaDataListType { GAME_METADATA, diff --git a/src/PlatformId.cpp b/es/src/PlatformId.cpp similarity index 100% rename from src/PlatformId.cpp rename to es/src/PlatformId.cpp diff --git a/src/PlatformId.h b/es/src/PlatformId.h similarity index 100% rename from src/PlatformId.h rename to es/src/PlatformId.h diff --git a/src/ScraperCmdLine.cpp b/es/src/ScraperCmdLine.cpp similarity index 100% rename from src/ScraperCmdLine.cpp rename to es/src/ScraperCmdLine.cpp diff --git a/src/ScraperCmdLine.h b/es/src/ScraperCmdLine.h similarity index 100% rename from src/ScraperCmdLine.h rename to es/src/ScraperCmdLine.h diff --git a/src/SystemData.cpp b/es/src/SystemData.cpp similarity index 100% rename from src/SystemData.cpp rename to es/src/SystemData.cpp diff --git a/src/SystemData.h b/es/src/SystemData.h similarity index 100% rename from src/SystemData.h rename to es/src/SystemData.h diff --git a/src/VolumeControl.cpp b/es/src/VolumeControl.cpp similarity index 100% rename from src/VolumeControl.cpp rename to es/src/VolumeControl.cpp diff --git a/src/VolumeControl.h b/es/src/VolumeControl.h similarity index 100% rename from src/VolumeControl.h rename to es/src/VolumeControl.h diff --git a/src/animations/LaunchAnimation.h b/es/src/animations/LaunchAnimation.h similarity index 97% rename from src/animations/LaunchAnimation.h rename to es/src/animations/LaunchAnimation.h index 11dc29ce6..cfd9f06d0 100644 --- a/src/animations/LaunchAnimation.h +++ b/es/src/animations/LaunchAnimation.h @@ -1,7 +1,7 @@ #pragma once -#include "Animation.h" -#include "../Log.h" +#include "animations/Animation.h" +#include "Log.h" // let's look at the game launch effect: // -move camera to center on point P (interpolation method: linear) diff --git a/src/animations/MoveCameraAnimation.h b/es/src/animations/MoveCameraAnimation.h similarity index 93% rename from src/animations/MoveCameraAnimation.h rename to es/src/animations/MoveCameraAnimation.h index 9f3675980..1f1689bb2 100644 --- a/src/animations/MoveCameraAnimation.h +++ b/es/src/animations/MoveCameraAnimation.h @@ -1,6 +1,6 @@ #pragma once -#include "Animation.h" +#include "animations/Animation.h" class MoveCameraAnimation : public Animation { diff --git a/src/components/AsyncReqComponent.cpp b/es/src/components/AsyncReqComponent.cpp similarity index 95% rename from src/components/AsyncReqComponent.cpp rename to es/src/components/AsyncReqComponent.cpp index ea54c0e03..a38b58880 100644 --- a/src/components/AsyncReqComponent.cpp +++ b/es/src/components/AsyncReqComponent.cpp @@ -1,5 +1,5 @@ -#include "AsyncReqComponent.h" -#include "../Renderer.h" +#include "components/AsyncReqComponent.h" +#include "Renderer.h" AsyncReqComponent::AsyncReqComponent(Window* window, std::shared_ptr req, std::function)> onSuccess, std::function onCancel) : GuiComponent(window), diff --git a/src/components/AsyncReqComponent.h b/es/src/components/AsyncReqComponent.h similarity index 96% rename from src/components/AsyncReqComponent.h rename to es/src/components/AsyncReqComponent.h index 3c10d12cb..11478fe09 100644 --- a/src/components/AsyncReqComponent.h +++ b/es/src/components/AsyncReqComponent.h @@ -1,7 +1,7 @@ #pragma once -#include "../GuiComponent.h" -#include "../HttpReq.h" +#include "GuiComponent.h" +#include "HttpReq.h" #include #include diff --git a/src/components/RatingComponent.cpp b/es/src/components/RatingComponent.cpp similarity index 96% rename from src/components/RatingComponent.cpp rename to es/src/components/RatingComponent.cpp index daa00e863..aa09e7044 100644 --- a/src/components/RatingComponent.cpp +++ b/es/src/components/RatingComponent.cpp @@ -1,8 +1,8 @@ -#include "RatingComponent.h" -#include "../Renderer.h" -#include "../Window.h" -#include "../Util.h" -#include "../resources/SVGResource.h" +#include "components/RatingComponent.h" +#include "Renderer.h" +#include "Window.h" +#include "Util.h" +#include "resources/SVGResource.h" RatingComponent::RatingComponent(Window* window) : GuiComponent(window) { diff --git a/src/components/RatingComponent.h b/es/src/components/RatingComponent.h similarity index 94% rename from src/components/RatingComponent.h rename to es/src/components/RatingComponent.h index bd587636b..a275c2701 100644 --- a/src/components/RatingComponent.h +++ b/es/src/components/RatingComponent.h @@ -1,7 +1,7 @@ #pragma once -#include "../GuiComponent.h" -#include "../resources/TextureResource.h" +#include "GuiComponent.h" +#include "resources/TextureResource.h" #define NUM_RATING_STARS 5 diff --git a/src/components/ScraperSearchComponent.cpp b/es/src/components/ScraperSearchComponent.cpp similarity index 96% rename from src/components/ScraperSearchComponent.cpp rename to es/src/components/ScraperSearchComponent.cpp index 3ba5c8625..9cfda3de6 100644 --- a/src/components/ScraperSearchComponent.cpp +++ b/es/src/components/ScraperSearchComponent.cpp @@ -1,18 +1,18 @@ -#include "ScraperSearchComponent.h" +#include "components/ScraperSearchComponent.h" -#include "../guis/GuiMsgBox.h" -#include "TextComponent.h" -#include "ScrollableContainer.h" -#include "ImageComponent.h" -#include "RatingComponent.h" -#include "DateTimeComponent.h" -#include "AnimatedImageComponent.h" -#include "ComponentList.h" -#include "../HttpReq.h" -#include "../Settings.h" -#include "../Log.h" -#include "../Util.h" -#include "../guis/GuiTextEditPopup.h" +#include "guis/GuiMsgBox.h" +#include "components/TextComponent.h" +#include "components/ScrollableContainer.h" +#include "components/ImageComponent.h" +#include "components/RatingComponent.h" +#include "components/DateTimeComponent.h" +#include "components/AnimatedImageComponent.h" +#include "components/ComponentList.h" +#include "HttpReq.h" +#include "Settings.h" +#include "Log.h" +#include "Util.h" +#include "guis/GuiTextEditPopup.h" ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type) : GuiComponent(window), mGrid(window, Eigen::Vector2i(4, 3)), mBusyAnim(window), diff --git a/src/components/ScraperSearchComponent.h b/es/src/components/ScraperSearchComponent.h similarity index 94% rename from src/components/ScraperSearchComponent.h rename to es/src/components/ScraperSearchComponent.h index 80e339b82..f4fb43f51 100644 --- a/src/components/ScraperSearchComponent.h +++ b/es/src/components/ScraperSearchComponent.h @@ -1,13 +1,11 @@ #pragma once -#include "../GuiComponent.h" -#include "../scrapers/Scraper.h" -#include "../components/ComponentGrid.h" -#include "../components/BusyComponent.h" +#include "GuiComponent.h" +#include "scrapers/Scraper.h" +#include "components/ComponentGrid.h" +#include "components/BusyComponent.h" #include -#define MAX_SCRAPER_RESULTS 7 - class ComponentList; class ImageComponent; class RatingComponent; diff --git a/src/components/TextListComponent.h b/es/src/components/TextListComponent.h similarity index 98% rename from src/components/TextListComponent.h rename to es/src/components/TextListComponent.h index 478668bda..8067cd739 100644 --- a/src/components/TextListComponent.h +++ b/es/src/components/TextListComponent.h @@ -1,16 +1,16 @@ #pragma once -#include "IList.h" -#include "../Renderer.h" -#include "../resources/Font.h" -#include "../InputManager.h" +#include "components/IList.h" +#include "Renderer.h" +#include "resources/Font.h" +#include "InputManager.h" +#include "Sound.h" +#include "Log.h" +#include "ThemeData.h" +#include "Util.h" #include #include #include -#include "../Sound.h" -#include "../Log.h" -#include "../ThemeData.h" -#include "../Util.h" #include struct TextListData diff --git a/src/guis/GuiFastSelect.cpp b/es/src/guis/GuiFastSelect.cpp similarity index 97% rename from src/guis/GuiFastSelect.cpp rename to es/src/guis/GuiFastSelect.cpp index 50a3f1808..31db35041 100644 --- a/src/guis/GuiFastSelect.cpp +++ b/es/src/guis/GuiFastSelect.cpp @@ -1,7 +1,7 @@ -#include "GuiFastSelect.h" -#include "../ThemeData.h" -#include "../FileSorts.h" -#include "../SystemData.h" +#include "guis/GuiFastSelect.h" +#include "ThemeData.h" +#include "FileSorts.h" +#include "SystemData.h" static const std::string LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/src/guis/GuiFastSelect.h b/es/src/guis/GuiFastSelect.h similarity index 76% rename from src/guis/GuiFastSelect.h rename to es/src/guis/GuiFastSelect.h index 9c23b28bb..012c06de6 100644 --- a/src/guis/GuiFastSelect.h +++ b/es/src/guis/GuiFastSelect.h @@ -1,10 +1,10 @@ #pragma once -#include "../GuiComponent.h" -#include "../views/gamelist/IGameListView.h" +#include "GuiComponent.h" +#include "views/gamelist/IGameListView.h" -#include "../components/NinePatchComponent.h" -#include "../components/TextComponent.h" +#include "components/NinePatchComponent.h" +#include "components/TextComponent.h" class GuiFastSelect : public GuiComponent { diff --git a/src/guis/GuiGameScraper.cpp b/es/src/guis/GuiGameScraper.cpp similarity index 92% rename from src/guis/GuiGameScraper.cpp rename to es/src/guis/GuiGameScraper.cpp index 3eb336c48..a54304c77 100644 --- a/src/guis/GuiGameScraper.cpp +++ b/es/src/guis/GuiGameScraper.cpp @@ -1,13 +1,12 @@ -#include "GuiGameScraper.h" -#include "../Renderer.h" -#include "../Log.h" -#include "../scrapers/Scraper.h" -#include "../Settings.h" - -#include "../components/TextComponent.h" -#include "../components/ButtonComponent.h" -#include "../components/MenuComponent.h" -#include "GuiTextEditPopup.h" +#include "guis/GuiGameScraper.h" +#include "guis/GuiTextEditPopup.h" +#include "components/TextComponent.h" +#include "components/ButtonComponent.h" +#include "components/MenuComponent.h" +#include "scrapers/Scraper.h" +#include "Renderer.h" +#include "Log.h" +#include "Settings.h" GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::function doneFunc) : GuiComponent(window), mGrid(window, Eigen::Vector2i(1, 7)), diff --git a/src/guis/GuiGameScraper.h b/es/src/guis/GuiGameScraper.h similarity index 85% rename from src/guis/GuiGameScraper.h rename to es/src/guis/GuiGameScraper.h index d35694cd9..354aba7e1 100644 --- a/src/guis/GuiGameScraper.h +++ b/es/src/guis/GuiGameScraper.h @@ -1,8 +1,8 @@ #pragma once -#include "../GuiComponent.h" -#include "../components/ScraperSearchComponent.h" -#include "../components/NinePatchComponent.h" +#include "GuiComponent.h" +#include "components/ScraperSearchComponent.h" +#include "components/NinePatchComponent.h" class GuiGameScraper : public GuiComponent { diff --git a/src/guis/GuiGamelistOptions.cpp b/es/src/guis/GuiGamelistOptions.cpp similarity index 94% rename from src/guis/GuiGamelistOptions.cpp rename to es/src/guis/GuiGamelistOptions.cpp index 1b18d0c49..6801fa3a9 100644 --- a/src/guis/GuiGamelistOptions.cpp +++ b/es/src/guis/GuiGamelistOptions.cpp @@ -1,7 +1,7 @@ #include "GuiGamelistOptions.h" #include "GuiMetaDataEd.h" -#include "../views/gamelist/IGameListView.h" -#include "../views/ViewController.h" +#include "views/gamelist/IGameListView.h" +#include "views/ViewController.h" GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : GuiComponent(window), mSystem(system), @@ -77,5 +77,5 @@ std::vector GuiGamelistOptions::getHelpPrompts() IGameListView* GuiGamelistOptions::getGamelist() { - return mWindow->getViewController()->getGameListView(mSystem).get(); + return ViewController::get()->getGameListView(mSystem).get(); } diff --git a/src/guis/GuiGamelistOptions.h b/es/src/guis/GuiGamelistOptions.h similarity index 78% rename from src/guis/GuiGamelistOptions.h rename to es/src/guis/GuiGamelistOptions.h index fe9b477ba..9a49aacd0 100644 --- a/src/guis/GuiGamelistOptions.h +++ b/es/src/guis/GuiGamelistOptions.h @@ -1,8 +1,7 @@ -#include "../GuiComponent.h" -#include "../components/MenuComponent.h" -#include "../components/OptionListComponent.h" - -#include "../FileSorts.h" +#include "GuiComponent.h" +#include "components/MenuComponent.h" +#include "components/OptionListComponent.h" +#include "FileSorts.h" class IGameListView; diff --git a/src/guis/GuiMenu.cpp b/es/src/guis/GuiMenu.cpp similarity index 91% rename from src/guis/GuiMenu.cpp rename to es/src/guis/GuiMenu.cpp index 0a27abbab..2adca0d1b 100644 --- a/src/guis/GuiMenu.cpp +++ b/es/src/guis/GuiMenu.cpp @@ -1,24 +1,24 @@ -#include "../EmulationStation.h" -#include "GuiMenu.h" -#include "../Window.h" -#include "../Sound.h" -#include "../Log.h" -#include "../Settings.h" -#include "GuiMsgBox.h" -#include "GuiSettings.h" -#include "GuiScraperStart.h" -#include "GuiDetectDevice.h" -#include "../views/ViewController.h" +#include "EmulationStation.h" +#include "guis/GuiMenu.h" +#include "Window.h" +#include "Sound.h" +#include "Log.h" +#include "Settings.h" +#include "guis/GuiMsgBox.h" +#include "guis/GuiSettings.h" +#include "guis/GuiScraperStart.h" +#include "guis/GuiDetectDevice.h" +#include "views/ViewController.h" -#include "../components/ButtonComponent.h" -#include "../components/SwitchComponent.h" -#include "../components/SliderComponent.h" -#include "../components/TextComponent.h" -#include "../components/OptionListComponent.h" -#include "../components/MenuComponent.h" -#include "../VolumeControl.h" -#include "../scrapers/GamesDBScraper.h" -#include "../scrapers/TheArchiveScraper.h" +#include "components/ButtonComponent.h" +#include "components/SwitchComponent.h" +#include "components/SliderComponent.h" +#include "components/TextComponent.h" +#include "components/OptionListComponent.h" +#include "components/MenuComponent.h" +#include "VolumeControl.h" +#include "scrapers/GamesDBScraper.h" +#include "scrapers/TheArchiveScraper.h" GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MENU"), mVersion(window) { @@ -158,7 +158,7 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN Settings::getInstance()->setString("ThemeSet", theme_set->getSelected()); if(needReload) - window->getViewController()->reloadAll(); // TODO - replace this with some sort of signal-based implementation + ViewController::get()->reloadAll(); // TODO - replace this with some sort of signal-based implementation }); } @@ -167,7 +167,7 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN addEntry("CONFIGURE INPUT", 0x777777FF, true, [this] { - mWindow->pushGui(new GuiDetectDevice(mWindow, false)); + mWindow->pushGui(new GuiDetectDevice(mWindow, false, nullptr)); }); addEntry("QUIT", 0x777777FF, true, diff --git a/src/guis/GuiMenu.h b/es/src/guis/GuiMenu.h similarity index 85% rename from src/guis/GuiMenu.h rename to es/src/guis/GuiMenu.h index bf686897e..eff9ebd3f 100644 --- a/src/guis/GuiMenu.h +++ b/es/src/guis/GuiMenu.h @@ -1,7 +1,7 @@ #pragma once -#include "../GuiComponent.h" -#include "../components/MenuComponent.h" +#include "GuiComponent.h" +#include "components/MenuComponent.h" #include class GuiMenu : public GuiComponent diff --git a/src/guis/GuiMetaDataEd.cpp b/es/src/guis/GuiMetaDataEd.cpp similarity index 94% rename from src/guis/GuiMetaDataEd.cpp rename to es/src/guis/GuiMetaDataEd.cpp index 990e81b7d..11367c2ad 100644 --- a/src/guis/GuiMetaDataEd.cpp +++ b/es/src/guis/GuiMetaDataEd.cpp @@ -1,17 +1,17 @@ -#include "GuiMetaDataEd.h" -#include "../Renderer.h" -#include "../Log.h" -#include "../components/AsyncReqComponent.h" -#include "../Settings.h" -#include "../views/ViewController.h" -#include "GuiGameScraper.h" -#include "GuiMsgBox.h" +#include "guis/GuiMetaDataEd.h" +#include "Renderer.h" +#include "Log.h" +#include "components/AsyncReqComponent.h" +#include "Settings.h" +#include "views/ViewController.h" +#include "guis/GuiGameScraper.h" +#include "guis/GuiMsgBox.h" #include -#include "../components/TextEditComponent.h" -#include "../components/DateTimeComponent.h" -#include "../components/RatingComponent.h" -#include "GuiTextEditPopup.h" +#include "components/TextEditComponent.h" +#include "components/DateTimeComponent.h" +#include "components/RatingComponent.h" +#include "guis/GuiTextEditPopup.h" using namespace Eigen; @@ -221,7 +221,7 @@ void GuiMetaDataEd::close(bool closeAllWindows) }else{ Window* window = mWindow; closeFunc = [window, this] { - while(window->peekGui() != window->getViewController()) + while(window->peekGui() != ViewController::get()) delete window->peekGui(); }; } diff --git a/src/guis/GuiMetaDataEd.h b/es/src/guis/GuiMetaDataEd.h similarity index 89% rename from src/guis/GuiMetaDataEd.h rename to es/src/guis/GuiMetaDataEd.h index be9727a4c..923696428 100644 --- a/src/guis/GuiMetaDataEd.h +++ b/es/src/guis/GuiMetaDataEd.h @@ -1,9 +1,9 @@ #pragma once -#include "../GuiComponent.h" -#include "../components/MenuComponent.h" -#include "../MetaData.h" -#include "../scrapers/Scraper.h" +#include "GuiComponent.h" +#include "components/MenuComponent.h" +#include "MetaData.h" +#include "scrapers/Scraper.h" #include diff --git a/src/guis/GuiScraperMulti.cpp b/es/src/guis/GuiScraperMulti.cpp similarity index 91% rename from src/guis/GuiScraperMulti.cpp rename to es/src/guis/GuiScraperMulti.cpp index 20ef3a146..afbfe0a3d 100644 --- a/src/guis/GuiScraperMulti.cpp +++ b/es/src/guis/GuiScraperMulti.cpp @@ -1,14 +1,14 @@ -#include "GuiScraperMulti.h" -#include "../Renderer.h" -#include "../Log.h" -#include "../views/ViewController.h" -#include "../Gamelist.h" +#include "guis/GuiScraperMulti.h" +#include "Renderer.h" +#include "Log.h" +#include "views/ViewController.h" +#include "Gamelist.h" -#include "../components/TextComponent.h" -#include "../components/ButtonComponent.h" -#include "../components/ScraperSearchComponent.h" -#include "../components/MenuComponent.h" // for makeButtonGrid -#include "GuiMsgBox.h" +#include "components/TextComponent.h" +#include "components/ButtonComponent.h" +#include "components/ScraperSearchComponent.h" +#include "components/MenuComponent.h" // for makeButtonGrid +#include "guis/GuiMsgBox.h" using namespace Eigen; @@ -73,7 +73,7 @@ GuiScraperMulti::~GuiScraperMulti() { // view type probably changed (basic -> detailed) for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++) - mWindow->getViewController()->reloadGameListView(*it, false); + ViewController::get()->reloadGameListView(*it, false); } void GuiScraperMulti::onSizeChanged() diff --git a/src/guis/GuiScraperMulti.h b/es/src/guis/GuiScraperMulti.h similarity index 86% rename from src/guis/GuiScraperMulti.h rename to es/src/guis/GuiScraperMulti.h index 37a0b02f5..ff18c12c0 100644 --- a/src/guis/GuiScraperMulti.h +++ b/es/src/guis/GuiScraperMulti.h @@ -1,9 +1,9 @@ #pragma once -#include "../GuiComponent.h" -#include "../components/NinePatchComponent.h" -#include "../components/ComponentGrid.h" -#include "../scrapers/Scraper.h" +#include "GuiComponent.h" +#include "components/NinePatchComponent.h" +#include "components/ComponentGrid.h" +#include "scrapers/Scraper.h" #include diff --git a/src/guis/GuiScraperStart.cpp b/es/src/guis/GuiScraperStart.cpp similarity index 91% rename from src/guis/GuiScraperStart.cpp rename to es/src/guis/GuiScraperStart.cpp index 915a5c707..7d1ebab43 100644 --- a/src/guis/GuiScraperStart.cpp +++ b/es/src/guis/GuiScraperStart.cpp @@ -1,11 +1,11 @@ -#include "GuiScraperStart.h" -#include "GuiScraperMulti.h" -#include "GuiMsgBox.h" -#include "../views/ViewController.h" +#include "guis/GuiScraperStart.h" +#include "guis/GuiScraperMulti.h" +#include "guis/GuiMsgBox.h" +#include "views/ViewController.h" -#include "../components/TextComponent.h" -#include "../components/OptionListComponent.h" -#include "../components/SwitchComponent.h" +#include "components/TextComponent.h" +#include "components/OptionListComponent.h" +#include "components/SwitchComponent.h" GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window), mMenu(window, "SCRAPE NOW") @@ -110,7 +110,7 @@ bool GuiScraperStart::input(InputConfig* config, Input input) { // close everything Window* window = mWindow; - while(window->peekGui() && window->peekGui() != window->getViewController()) + while(window->peekGui() && window->peekGui() != ViewController::get()) delete window->peekGui(); } diff --git a/src/guis/GuiScraperStart.h b/es/src/guis/GuiScraperStart.h similarity index 88% rename from src/guis/GuiScraperStart.h rename to es/src/guis/GuiScraperStart.h index d6d854f8a..0d453ca0f 100644 --- a/src/guis/GuiScraperStart.h +++ b/es/src/guis/GuiScraperStart.h @@ -1,9 +1,9 @@ #pragma once -#include "../GuiComponent.h" -#include "../SystemData.h" -#include "../scrapers/Scraper.h" -#include "../components/MenuComponent.h" +#include "GuiComponent.h" +#include "SystemData.h" +#include "scrapers/Scraper.h" +#include "components/MenuComponent.h" #include typedef std::function GameFilterFunc; diff --git a/src/guis/GuiSettings.cpp b/es/src/guis/GuiSettings.cpp similarity index 86% rename from src/guis/GuiSettings.cpp rename to es/src/guis/GuiSettings.cpp index 8b5d777d0..806dae2c9 100644 --- a/src/guis/GuiSettings.cpp +++ b/es/src/guis/GuiSettings.cpp @@ -1,7 +1,7 @@ -#include "GuiSettings.h" -#include "../Window.h" -#include "../Settings.h" -#include "../views/ViewController.h" +#include "guis/GuiSettings.h" +#include "Window.h" +#include "Settings.h" +#include "views/ViewController.h" GuiSettings::GuiSettings(Window* window, const char* title) : GuiComponent(window), mMenu(window, title) { @@ -41,7 +41,7 @@ bool GuiSettings::input(InputConfig* config, Input input) { // close everything Window* window = mWindow; - while(window->peekGui() && window->peekGui() != window->getViewController()) + while(window->peekGui() && window->peekGui() != ViewController::get()) delete window->peekGui(); return true; } diff --git a/src/guis/GuiSettings.h b/es/src/guis/GuiSettings.h similarity index 91% rename from src/guis/GuiSettings.h rename to es/src/guis/GuiSettings.h index f0f31dd1a..06e88d322 100644 --- a/src/guis/GuiSettings.h +++ b/es/src/guis/GuiSettings.h @@ -1,5 +1,5 @@ -#include "../GuiComponent.h" -#include "../components/MenuComponent.h" +#include "GuiComponent.h" +#include "components/MenuComponent.h" // This is just a really simple template for a GUI that calls some save functions when closed. class GuiSettings : public GuiComponent diff --git a/src/main.cpp b/es/src/main.cpp similarity index 96% rename from src/main.cpp rename to es/src/main.cpp index 8393b6d8f..88aec5cbe 100644 --- a/src/main.cpp +++ b/es/src/main.cpp @@ -155,6 +155,9 @@ int main(int argc, char* argv[]) atexit(&onExit); Window window; + ViewController::init(&window); + window.pushGui(ViewController::get()); + if(!scrape_cmdline) { if(!window.init(width, height)) @@ -199,17 +202,16 @@ int main(int argc, char* argv[]) // preload what we can right away instead of waiting for the user to select it // this makes for no delays when accessing content, but a longer startup time - window.getViewController()->preload(); + ViewController::get()->preload(); //choose which GUI to open depending on if an input configuration already exists if(errorMsg == NULL) { if(fs::exists(InputManager::getConfigPath()) && InputManager::getInstance()->getNumConfiguredDevices() > 0) { - window.getViewController()->goToStart(); - } - else{ - window.pushGui(new GuiDetectDevice(&window, true)); + ViewController::get()->goToStart(); + }else{ + window.pushGui(new GuiDetectDevice(&window, true, [] { ViewController::get()->goToStart(); })); } } @@ -266,7 +268,7 @@ int main(int argc, char* argv[]) Log::flush(); } - while(window.peekGui() != window.getViewController()) + while(window.peekGui() != ViewController::get()) delete window.peekGui(); window.deinit(); diff --git a/src/scrapers/GamesDBScraper.cpp b/es/src/scrapers/GamesDBScraper.cpp similarity index 96% rename from src/scrapers/GamesDBScraper.cpp rename to es/src/scrapers/GamesDBScraper.cpp index db3c6635a..7a597512c 100644 --- a/src/scrapers/GamesDBScraper.cpp +++ b/es/src/scrapers/GamesDBScraper.cpp @@ -1,10 +1,9 @@ -#include "GamesDBScraper.h" -#include "../components/ScraperSearchComponent.h" -#include "Scraper.h" -#include "../Log.h" -#include "../pugiXML/pugixml.hpp" -#include "../MetaData.h" -#include "../Settings.h" +#include "scrapers/GamesDBScraper.h" +#include "Log.h" +#include "pugixml/pugixml.hpp" +#include "MetaData.h" +#include "Settings.h" +#include "Util.h" #include using namespace PlatformIds; diff --git a/src/scrapers/GamesDBScraper.h b/es/src/scrapers/GamesDBScraper.h similarity index 94% rename from src/scrapers/GamesDBScraper.h rename to es/src/scrapers/GamesDBScraper.h index 0d9e49cf5..cf5f69ede 100644 --- a/src/scrapers/GamesDBScraper.h +++ b/es/src/scrapers/GamesDBScraper.h @@ -1,6 +1,6 @@ #pragma once -#include "Scraper.h" +#include "scrapers/Scraper.h" void thegamesdb_generate_scraper_requests(const ScraperSearchParams& params, std::queue< std::unique_ptr >& requests, std::vector& results); diff --git a/src/scrapers/Scraper.cpp b/es/src/scrapers/Scraper.cpp similarity index 98% rename from src/scrapers/Scraper.cpp rename to es/src/scrapers/Scraper.cpp index 6f468c257..c827a4755 100644 --- a/src/scrapers/Scraper.cpp +++ b/es/src/scrapers/Scraper.cpp @@ -1,7 +1,6 @@ -#include "Scraper.h" -#include "../components/AsyncReqComponent.h" -#include "../Log.h" -#include "../Settings.h" +#include "scrapers/Scraper.h" +#include "Log.h" +#include "Settings.h" #include #include #include diff --git a/src/scrapers/Scraper.h b/es/src/scrapers/Scraper.h similarity index 97% rename from src/scrapers/Scraper.h rename to es/src/scrapers/Scraper.h index 1e87f4c5d..87ab2502a 100644 --- a/src/scrapers/Scraper.h +++ b/es/src/scrapers/Scraper.h @@ -1,13 +1,15 @@ #pragma once -#include "../MetaData.h" -#include "../SystemData.h" -#include "../HttpReq.h" -#include "../AsyncHandle.h" +#include "MetaData.h" +#include "SystemData.h" +#include "HttpReq.h" +#include "AsyncHandle.h" #include #include #include +#define MAX_SCRAPER_RESULTS 7 + struct ScraperSearchParams { SystemData* system; diff --git a/src/scrapers/TheArchiveScraper.cpp b/es/src/scrapers/TheArchiveScraper.cpp similarity index 93% rename from src/scrapers/TheArchiveScraper.cpp rename to es/src/scrapers/TheArchiveScraper.cpp index 336de2346..fe490ca55 100644 --- a/src/scrapers/TheArchiveScraper.cpp +++ b/es/src/scrapers/TheArchiveScraper.cpp @@ -1,8 +1,6 @@ #include "TheArchiveScraper.h" -#include "../guis/GuiGameScraper.h" -#include "../components/AsyncReqComponent.h" -#include "../Log.h" -#include "../pugiXML/pugixml.hpp" +#include "Log.h" +#include "pugixml/pugixml.hpp" void thearchive_generate_scraper_requests(const ScraperSearchParams& params, std::queue< std::unique_ptr >& requests, std::vector& results) diff --git a/src/scrapers/TheArchiveScraper.h b/es/src/scrapers/TheArchiveScraper.h similarity index 95% rename from src/scrapers/TheArchiveScraper.h rename to es/src/scrapers/TheArchiveScraper.h index 93f640770..9837539a4 100644 --- a/src/scrapers/TheArchiveScraper.h +++ b/es/src/scrapers/TheArchiveScraper.h @@ -1,6 +1,6 @@ #pragma once -#include "Scraper.h" +#include "scrapers/Scraper.h" void thearchive_generate_scraper_requests(const ScraperSearchParams& params, std::queue< std::unique_ptr >& requests, std::vector& results); diff --git a/src/views/SystemView.cpp b/es/src/views/SystemView.cpp similarity index 96% rename from src/views/SystemView.cpp rename to es/src/views/SystemView.cpp index 9e844726d..54987fdf8 100644 --- a/src/views/SystemView.cpp +++ b/es/src/views/SystemView.cpp @@ -1,13 +1,13 @@ -#include "SystemView.h" -#include "../SystemData.h" -#include "../Renderer.h" -#include "../Log.h" -#include "../Window.h" -#include "ViewController.h" -#include "../animations/LambdaAnimation.h" -#include "../SystemData.h" -#include "../Settings.h" -#include "../Util.h" +#include "views/SystemView.h" +#include "SystemData.h" +#include "Renderer.h" +#include "Log.h" +#include "Window.h" +#include "views/ViewController.h" +#include "animations/LambdaAnimation.h" +#include "SystemData.h" +#include "Settings.h" +#include "Util.h" #define SELECTED_SCALE 1.5f #define LOGO_PADDING ((logoSize().x() * (SELECTED_SCALE - 1)/2) + (mSize.x() * 0.06f)) @@ -119,7 +119,7 @@ bool SystemView::input(InputConfig* config, Input input) if(config->isMappedTo("a", input)) { stopScrolling(); - mWindow->getViewController()->goToGameList(getSelected()); + ViewController::get()->goToGameList(getSelected()); return true; } }else{ diff --git a/src/views/SystemView.h b/es/src/views/SystemView.h similarity index 80% rename from src/views/SystemView.h rename to es/src/views/SystemView.h index 6916227e5..15200b903 100644 --- a/src/views/SystemView.h +++ b/es/src/views/SystemView.h @@ -1,11 +1,11 @@ #pragma once -#include "../GuiComponent.h" -#include "../components/ImageComponent.h" -#include "../components/TextComponent.h" -#include "../components/ScrollableContainer.h" -#include "../components/IList.h" -#include "../resources/TextureResource.h" +#include "GuiComponent.h" +#include "components/ImageComponent.h" +#include "components/TextComponent.h" +#include "components/ScrollableContainer.h" +#include "components/IList.h" +#include "resources/TextureResource.h" class SystemData; class AnimatedImageComponent; diff --git a/src/views/ViewController.cpp b/es/src/views/ViewController.cpp similarity index 93% rename from src/views/ViewController.cpp rename to es/src/views/ViewController.cpp index 68086b780..5a94d97c2 100644 --- a/src/views/ViewController.cpp +++ b/es/src/views/ViewController.cpp @@ -1,16 +1,30 @@ -#include "ViewController.h" -#include "../Log.h" -#include "../SystemData.h" -#include "../Settings.h" +#include "views/ViewController.h" +#include "Log.h" +#include "SystemData.h" +#include "Settings.h" -#include "gamelist/BasicGameListView.h" -#include "gamelist/DetailedGameListView.h" -#include "gamelist/GridGameListView.h" -#include "../guis/GuiMenu.h" -#include "../guis/GuiMsgBox.h" -#include "../animations/LaunchAnimation.h" -#include "../animations/MoveCameraAnimation.h" -#include "../animations/LambdaAnimation.h" +#include "views/gamelist/BasicGameListView.h" +#include "views/gamelist/DetailedGameListView.h" +#include "views/gamelist/GridGameListView.h" +#include "guis/GuiMenu.h" +#include "guis/GuiMsgBox.h" +#include "animations/LaunchAnimation.h" +#include "animations/MoveCameraAnimation.h" +#include "animations/LambdaAnimation.h" + +ViewController* ViewController::sInstance = NULL; + +ViewController* ViewController::get() +{ + assert(sInstance); + return sInstance; +} + +void ViewController::init(Window* window) +{ + assert(!sInstance); + sInstance = new ViewController(window); +} ViewController::ViewController(Window* window) : GuiComponent(window), mCurrentView(nullptr), mCamera(Eigen::Affine3f::Identity()), mFadeOpacity(0), mLockInput(false) @@ -18,6 +32,12 @@ ViewController::ViewController(Window* window) mState.viewing = NOTHING; } +ViewController::~ViewController() +{ + assert(sInstance == this); + sInstance = NULL; +} + void ViewController::goToStart() { // TODO diff --git a/src/views/ViewController.h b/es/src/views/ViewController.h similarity index 92% rename from src/views/ViewController.h rename to es/src/views/ViewController.h index c706dbb41..2658f44a9 100644 --- a/src/views/ViewController.h +++ b/es/src/views/ViewController.h @@ -1,7 +1,7 @@ #pragma once -#include "gamelist/IGameListView.h" -#include "SystemView.h" +#include "views/gamelist/IGameListView.h" +#include "views/SystemView.h" class SystemData; @@ -9,7 +9,10 @@ class SystemData; class ViewController : public GuiComponent { public: - ViewController(Window* window); + static void init(Window* window); + static ViewController* get(); + + virtual ~ViewController(); // Try to completely populate the GameListView map. // Caches things so there's no pauses during transitions. @@ -66,6 +69,9 @@ public: std::shared_ptr getSystemListView(); private: + ViewController(Window* window); + static ViewController* sInstance; + void playViewTransition(); int getSystemId(SystemData* system); diff --git a/src/views/gamelist/BasicGameListView.cpp b/es/src/views/gamelist/BasicGameListView.cpp similarity index 87% rename from src/views/gamelist/BasicGameListView.cpp rename to es/src/views/gamelist/BasicGameListView.cpp index 3cf3eccc0..af4ccbfe4 100644 --- a/src/views/gamelist/BasicGameListView.cpp +++ b/es/src/views/gamelist/BasicGameListView.cpp @@ -1,10 +1,10 @@ -#include "BasicGameListView.h" -#include "../ViewController.h" -#include "../../Renderer.h" -#include "../../Window.h" -#include "../../ThemeData.h" -#include "../../SystemData.h" -#include "../../Settings.h" +#include "views/gamelist/BasicGameListView.h" +#include "views/ViewController.h" +#include "Renderer.h" +#include "Window.h" +#include "ThemeData.h" +#include "SystemData.h" +#include "Settings.h" BasicGameListView::BasicGameListView(Window* window, FileData* root) : ISimpleGameListView(window, root), mList(window) @@ -28,7 +28,7 @@ void BasicGameListView::onFileChanged(FileData* file, FileChangeType change) if(change == FILE_METADATA_CHANGED) { // might switch to a detailed view - mWindow->getViewController()->reloadGameListView(this); + ViewController::get()->reloadGameListView(this); return; } @@ -83,7 +83,7 @@ void BasicGameListView::setCursor(FileData* cursor) void BasicGameListView::launch(FileData* game) { - mWindow->getViewController()->launch(game); + ViewController::get()->launch(game); } std::vector BasicGameListView::getHelpPrompts() diff --git a/src/views/gamelist/BasicGameListView.h b/es/src/views/gamelist/BasicGameListView.h similarity index 89% rename from src/views/gamelist/BasicGameListView.h rename to es/src/views/gamelist/BasicGameListView.h index 4cd7ef347..23145f5cb 100644 --- a/src/views/gamelist/BasicGameListView.h +++ b/es/src/views/gamelist/BasicGameListView.h @@ -1,7 +1,7 @@ #pragma once -#include "ISimpleGameListView.h" -#include "../../components/TextListComponent.h" +#include "views/gamelist/ISimpleGameListView.h" +#include "components/TextListComponent.h" class BasicGameListView : public ISimpleGameListView { diff --git a/src/views/gamelist/DetailedGameListView.cpp b/es/src/views/gamelist/DetailedGameListView.cpp similarity index 97% rename from src/views/gamelist/DetailedGameListView.cpp rename to es/src/views/gamelist/DetailedGameListView.cpp index a81fc1c91..de1611014 100644 --- a/src/views/gamelist/DetailedGameListView.cpp +++ b/es/src/views/gamelist/DetailedGameListView.cpp @@ -1,7 +1,7 @@ -#include "DetailedGameListView.h" -#include "../../Window.h" -#include "../ViewController.h" -#include "../../animations/LambdaAnimation.h" +#include "views/gamelist/DetailedGameListView.h" +#include "views/ViewController.h" +#include "Window.h" +#include "animations/LambdaAnimation.h" DetailedGameListView::DetailedGameListView(Window* window, FileData* root) : BasicGameListView(window, root), @@ -238,7 +238,7 @@ void DetailedGameListView::launch(FileData* game) if(mImage.hasImage()) target << mImage.getCenter().x(), mImage.getCenter().y(), 0; - mWindow->getViewController()->launch(game, target); + ViewController::get()->launch(game, target); } std::vector DetailedGameListView::getMDLabels() diff --git a/src/views/gamelist/DetailedGameListView.h b/es/src/views/gamelist/DetailedGameListView.h similarity index 84% rename from src/views/gamelist/DetailedGameListView.h rename to es/src/views/gamelist/DetailedGameListView.h index 28756e698..30396e04c 100644 --- a/src/views/gamelist/DetailedGameListView.h +++ b/es/src/views/gamelist/DetailedGameListView.h @@ -1,9 +1,9 @@ #pragma once -#include "BasicGameListView.h" -#include "../../components/ScrollableContainer.h" -#include "../../components/RatingComponent.h" -#include "../../components/DateTimeComponent.h" +#include "views/gamelist/BasicGameListView.h" +#include "components/ScrollableContainer.h" +#include "components/RatingComponent.h" +#include "components/DateTimeComponent.h" class DetailedGameListView : public BasicGameListView { diff --git a/src/views/gamelist/GridGameListView.cpp b/es/src/views/gamelist/GridGameListView.cpp similarity index 88% rename from src/views/gamelist/GridGameListView.cpp rename to es/src/views/gamelist/GridGameListView.cpp index bebd20c67..c34b4b8ba 100644 --- a/src/views/gamelist/GridGameListView.cpp +++ b/es/src/views/gamelist/GridGameListView.cpp @@ -1,7 +1,7 @@ -#include "GridGameListView.h" -#include "../../ThemeData.h" -#include "../../Window.h" -#include "../ViewController.h" +#include "views/gamelist/GridGameListView.h" +#include "ThemeData.h" +#include "Window.h" +#include "views/ViewController.h" GridGameListView::GridGameListView(Window* window, FileData* root) : ISimpleGameListView(window, root), mGrid(window) @@ -46,7 +46,7 @@ void GridGameListView::populateList(const std::vector& files) void GridGameListView::launch(FileData* game) { - mWindow->getViewController()->launch(game); + ViewController::get()->launch(game); } std::vector GridGameListView::getHelpPrompts() diff --git a/src/views/gamelist/GridGameListView.h b/es/src/views/gamelist/GridGameListView.h similarity index 83% rename from src/views/gamelist/GridGameListView.h rename to es/src/views/gamelist/GridGameListView.h index 7c744e943..81bf45585 100644 --- a/src/views/gamelist/GridGameListView.h +++ b/es/src/views/gamelist/GridGameListView.h @@ -1,8 +1,8 @@ #pragma once -#include "ISimpleGameListView.h" -#include "../../components/ImageGridComponent.h" -#include "../../components/ImageComponent.h" +#include "views/gamelist/ISimpleGameListView.h" +#include "components/ImageGridComponent.h" +#include "components/ImageComponent.h" #include class GridGameListView : public ISimpleGameListView diff --git a/src/views/gamelist/IGameListView.cpp b/es/src/views/gamelist/IGameListView.cpp similarity index 72% rename from src/views/gamelist/IGameListView.cpp rename to es/src/views/gamelist/IGameListView.cpp index 9b9f59dba..69799cdd9 100644 --- a/src/views/gamelist/IGameListView.cpp +++ b/es/src/views/gamelist/IGameListView.cpp @@ -1,12 +1,12 @@ -#include "IGameListView.h" -#include "../../Window.h" -#include "../../guis/GuiMetaDataEd.h" -#include "../../guis/GuiMenu.h" -#include "../../guis/GuiGamelistOptions.h" -#include "../ViewController.h" -#include "../../Settings.h" -#include "../../Log.h" -#include "../../Sound.h" +#include "views/gamelist/IGameListView.h" +#include "Window.h" +#include "guis/GuiMetaDataEd.h" +#include "guis/GuiMenu.h" +#include "guis/GuiGamelistOptions.h" +#include "views/ViewController.h" +#include "Settings.h" +#include "Log.h" +#include "Sound.h" bool IGameListView::input(InputConfig* config, Input input) { @@ -22,7 +22,7 @@ bool IGameListView::input(InputConfig* config, Input input) (SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)) && input.id == SDLK_r && input.value != 0) { LOG(LogDebug) << "reloading view"; - mWindow->getViewController()->reloadGameListView(this, true); + ViewController::get()->reloadGameListView(this, true); return true; } diff --git a/src/views/gamelist/IGameListView.h b/es/src/views/gamelist/IGameListView.h similarity index 95% rename from src/views/gamelist/IGameListView.h rename to es/src/views/gamelist/IGameListView.h index 930affa35..6f9ef054d 100644 --- a/src/views/gamelist/IGameListView.h +++ b/es/src/views/gamelist/IGameListView.h @@ -1,7 +1,7 @@ #pragma once -#include "../../FileData.h" -#include "../../Renderer.h" +#include "FileData.h" +#include "Renderer.h" class Window; class GuiComponent; diff --git a/src/views/gamelist/ISimpleGameListView.cpp b/es/src/views/gamelist/ISimpleGameListView.cpp similarity index 87% rename from src/views/gamelist/ISimpleGameListView.cpp rename to es/src/views/gamelist/ISimpleGameListView.cpp index 974ab459e..dd6df5b63 100644 --- a/src/views/gamelist/ISimpleGameListView.cpp +++ b/es/src/views/gamelist/ISimpleGameListView.cpp @@ -1,9 +1,9 @@ -#include "ISimpleGameListView.h" -#include "../../ThemeData.h" -#include "../../Window.h" -#include "../ViewController.h" -#include "../../Sound.h" -#include "../../Settings.h" +#include "views/gamelist/ISimpleGameListView.h" +#include "ThemeData.h" +#include "Window.h" +#include "views/ViewController.h" +#include "Sound.h" +#include "Settings.h" ISimpleGameListView::ISimpleGameListView(Window* window, FileData* root) : IGameListView(window, root), mHeaderText(window), mHeaderImage(window), mBackground(window), mThemeExtras(window) @@ -82,7 +82,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input) Sound::getFromTheme(getTheme(), getName(), "back")->play(); }else{ onFocusLost(); - mWindow->getViewController()->goToSystemView(getCursor()->getSystem()); + ViewController::get()->goToSystemView(getCursor()->getSystem()); } return true; @@ -91,7 +91,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input) if(Settings::getInstance()->getBool("QuickSystemSelect")) { onFocusLost(); - mWindow->getViewController()->goToNextGameList(); + ViewController::get()->goToNextGameList(); return true; } }else if(config->isMappedTo("left", input)) @@ -99,7 +99,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input) if(Settings::getInstance()->getBool("QuickSystemSelect")) { onFocusLost(); - mWindow->getViewController()->goToPrevGameList(); + ViewController::get()->goToPrevGameList(); return true; } } diff --git a/src/views/gamelist/ISimpleGameListView.h b/es/src/views/gamelist/ISimpleGameListView.h similarity index 89% rename from src/views/gamelist/ISimpleGameListView.h rename to es/src/views/gamelist/ISimpleGameListView.h index b4dcf2c8a..9022cde73 100644 --- a/src/views/gamelist/ISimpleGameListView.h +++ b/es/src/views/gamelist/ISimpleGameListView.h @@ -1,9 +1,9 @@ #pragma once -#include "IGameListView.h" +#include "views/gamelist/IGameListView.h" -#include "../../components/TextComponent.h" -#include "../../components/ImageComponent.h" +#include "components/TextComponent.h" +#include "components/ImageComponent.h" class ISimpleGameListView : public IGameListView { diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt new file mode 100644 index 000000000..9b09143ad --- /dev/null +++ b/external/CMakeLists.txt @@ -0,0 +1,5 @@ +# set up the external libraries that aren't popular enough to be found on most +# package managers are included with the project (in the 'external' folder) + +add_subdirectory("nanosvg") +add_subdirectory("pugixml") diff --git a/external/nanosvg/CMakeLists.txt b/external/nanosvg/CMakeLists.txt new file mode 100644 index 000000000..1a2538726 --- /dev/null +++ b/external/nanosvg/CMakeLists.txt @@ -0,0 +1,13 @@ +project("nanosvg") + +set(NSVG_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/nanosvg.h + ${CMAKE_CURRENT_SOURCE_DIR}/nanosvgrast.h +) + +set(NSVG_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/nanosvg_impl.cpp +) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +add_library(nanosvg STATIC ${NSVG_SOURCES} ${NSVG_HEADERS}) diff --git a/src/nanosvg/nanosvg.h b/external/nanosvg/nanosvg.h similarity index 100% rename from src/nanosvg/nanosvg.h rename to external/nanosvg/nanosvg.h diff --git a/src/nanosvg/nanosvg_license.txt b/external/nanosvg/nanosvg_license.txt similarity index 100% rename from src/nanosvg/nanosvg_license.txt rename to external/nanosvg/nanosvg_license.txt diff --git a/src/nanosvg/nanosvgrast.h b/external/nanosvg/nanosvgrast.h similarity index 100% rename from src/nanosvg/nanosvgrast.h rename to external/nanosvg/nanosvgrast.h diff --git a/src/nanosvg/nanosvg_impl.cpp b/external/nanosvg/src/nanosvg_impl.cpp similarity index 100% rename from src/nanosvg/nanosvg_impl.cpp rename to external/nanosvg/src/nanosvg_impl.cpp diff --git a/external/pugixml/CMakeLists.txt b/external/pugixml/CMakeLists.txt new file mode 100644 index 000000000..fb01783b1 --- /dev/null +++ b/external/pugixml/CMakeLists.txt @@ -0,0 +1,13 @@ +project("pugixml") + +set(PUGI_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/pugiconfig.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/pugixml.hpp +) + +set(PUGI_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/pugixml.cpp +) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +add_library(pugixml STATIC ${PUGI_SOURCES} ${PUG_HEADERS}) diff --git a/src/pugiXML/pugiconfig.hpp b/external/pugixml/pugiconfig.hpp similarity index 100% rename from src/pugiXML/pugiconfig.hpp rename to external/pugixml/pugiconfig.hpp diff --git a/src/pugiXML/pugixml.hpp b/external/pugixml/pugixml.hpp similarity index 100% rename from src/pugiXML/pugixml.hpp rename to external/pugixml/pugixml.hpp diff --git a/src/pugiXML/pugiXML_license.txt b/external/pugixml/pugixml_license.txt similarity index 100% rename from src/pugiXML/pugiXML_license.txt rename to external/pugixml/pugixml_license.txt diff --git a/src/pugiXML/pugixml.cpp b/external/pugixml/src/pugixml.cpp similarity index 100% rename from src/pugiXML/pugixml.cpp rename to external/pugixml/src/pugixml.cpp diff --git a/src/MathExp.cpp b/src/MathExp.cpp deleted file mode 100644 index be5d42d6f..000000000 --- a/src/MathExp.cpp +++ /dev/null @@ -1,163 +0,0 @@ -#include "MathExp.h" -#include -#include - -bool MathExp::isOperator(const char c) -{ - if(c == *"+" || c == *"-" || c == *"*" || c == *"/" || c == *"(") - return true; - else - return false; -} - -bool MathExp::isRParen(const char c) -{ - if(c == *")") - return true; - else - return false; -} - -int MathExp::getPrecedence(const char c) -{ - if(c == *"(") - return -5; - - if(c == *"+" || c == *"-") - return 0; - - if(c == *"*" || c == *"/") - return 1; - - std::cout << "Error - getPrecedence(): unknown character '" << c << "'\n"; - return -1; -} - -float MathExp::eval() -{ - unsigned int start = 0; - for(unsigned int i = 0; i < mExpression.length(); i++) - { - if(isOperator(mExpression.at(i))) - { - //the string from start to i is an operand, and i is an operator - if(start != i) //if we actually do have an operand - mOperands.push(strToVal(mExpression.substr(start, i - start))); - else - std::cout << "skipping operand, start == i\n"; - - //now we must decide what to do with the operator - const char op = mExpression.at(i); - - if(op != *"(") - { - while(mOperators.size() && getPrecedence(mOperators.top()) >= getPrecedence(op)) - { - doNextOperation(); - } - } - - mOperators.push(op); - - start = i + 1; - }else{ - if(isRParen(mExpression.at(i))) - { - while(mOperators.top() != *"(") - { - doNextOperation(); - } - - mOperators.pop(); - } - } - } - - mOperands.push(strToVal(mExpression.substr(start, mExpression.length() - start))); - - - while(mOperators.size() > 0) - doNextOperation(); - - - if(mOperands.size() != 1) - { - std::cout << "Error - mOperands.size() = " << mOperands.size() << " at the end of evaluation!\n"; - return 0; - } - - float final = mOperands.top(); - mOperands.pop(); - - return final; -} - -void MathExp::doNextOperation() -{ - //pop operator off and apply it, then push the value onto the operand stack - const char top = mOperators.top(); - float val = 0; - - if(top == *"+") - { - val = mOperands.top(); - mOperands.pop(); - val += mOperands.top(); - mOperands.pop(); - } - if(top == *"-") - { - val = mOperands.top(); - mOperands.pop(); - val = mOperands.top() - val; - mOperands.pop(); - } - if(top == *"*") - { - val = mOperands.top(); - mOperands.pop(); - val *= mOperands.top(); - mOperands.pop(); - } - if(top == *"/") - { - val = mOperands.top(); - mOperands.pop(); - val = mOperands.top() / val; - mOperands.pop(); - } - - mOperands.push(val); - - mOperators.pop(); -} - -void MathExp::setExpression(std::string str) -{ - mExpression = str; -} - -void MathExp::setVariable(std::string name, float val) -{ - mVariables[name] = val; -} - -float MathExp::getVariable(std::string name) -{ - return mVariables[name]; -} - -float MathExp::strToVal(std::string str) -{ - if(str[0] == *"$") - return getVariable(str.substr(1, str.length() - 1)); //it's a variable! - - //it's a value! - std::stringstream stream; - stream << str; - - float value; - stream >> value; - - return value; -} diff --git a/src/MathExp.h b/src/MathExp.h deleted file mode 100644 index a8d76f461..000000000 --- a/src/MathExp.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _MATHEXP_H_ -#define _MATHEXP_H_ - -#include -#include -#include - -//A reusable class that evaluates simple mathematical expressions. -//Includes variable support - just use setVariable(name, value), and any instance of $name will be replaced with value. -class MathExp { -public: - - void setExpression(std::string str); - void setVariable(std::string name, float val); - float getVariable(std::string name); - - float eval(); - -private: - //float apply(const char operatorChar, std::string operand); - void doNextOperation(); - - bool isOperator(const char c); - bool isRParen(const char c); - int getPrecedence(const char c); - - float strToVal(std::string str); - - std::string mExpression; - - std::stack mOperands; - std::stack mOperators; - std::map mVariables; - -}; - -#endif