diff --git a/Package/Environment/Common/collections/Arcade/system_artwork/logo.png b/Package/Environment/Common/collections/Arcade/system_artwork/logo.png new file mode 100644 index 0000000..94c1481 Binary files /dev/null and b/Package/Environment/Common/collections/Arcade/system_artwork/logo.png differ diff --git a/Package/Environment/Common/collections/Arcade/system_artwork/story.txt b/Package/Environment/Common/collections/Arcade/system_artwork/story.txt new file mode 100644 index 0000000..f1e503e --- /dev/null +++ b/Package/Environment/Common/collections/Arcade/system_artwork/story.txt @@ -0,0 +1 @@ +Multiple Arcade Machine Emulator (MAME) is an emulator application designed to recreate the hardware of arcade game systems in software on modern personal computers and other platforms. The intention is to preserve gaming history by preventing vintage games from being lost or forgotten. The goal of MAME is to be a reference to the inner workings of the emulated arcade machines; the ability to actually play the games is considered "a nice side effect". Joystiq has listed MAME as an application that every gamer should have. diff --git a/Package/Environment/Common/collections/Arcade/system_artwork/video.mp4 b/Package/Environment/Common/collections/Arcade/system_artwork/video.mp4 new file mode 100644 index 0000000..c3133de Binary files /dev/null and b/Package/Environment/Common/collections/Arcade/system_artwork/video.mp4 differ diff --git a/Package/Environment/Common/collections/Main/medium_artwork/fanart/Arcade.png b/Package/Environment/Common/collections/Main/medium_artwork/fanart/Arcade.png new file mode 100644 index 0000000..e9cd644 Binary files /dev/null and b/Package/Environment/Common/collections/Main/medium_artwork/fanart/Arcade.png differ diff --git a/Package/Environment/Common/collections/Main/medium_artwork/fanart/Sega Genesis.png b/Package/Environment/Common/collections/Main/medium_artwork/fanart/Sega Genesis.png new file mode 100644 index 0000000..dc8be4b Binary files /dev/null and b/Package/Environment/Common/collections/Main/medium_artwork/fanart/Sega Genesis.png differ diff --git a/Package/Environment/Common/collections/Main/medium_artwork/fanart/default.png b/Package/Environment/Common/collections/Main/medium_artwork/fanart/default.png new file mode 100644 index 0000000..c38c1ae Binary files /dev/null and b/Package/Environment/Common/collections/Main/medium_artwork/fanart/default.png differ diff --git a/Package/Environment/Common/collections/Main/medium_artwork/system_info/Arcade.png b/Package/Environment/Common/collections/Main/medium_artwork/system_info/Arcade.png new file mode 100644 index 0000000..5f0e592 Binary files /dev/null and b/Package/Environment/Common/collections/Main/medium_artwork/system_info/Arcade.png differ diff --git a/Package/Environment/Common/collections/Main/medium_artwork/system_info/Sega Genesis.png b/Package/Environment/Common/collections/Main/medium_artwork/system_info/Sega Genesis.png new file mode 100644 index 0000000..b9cb4a7 Binary files /dev/null and b/Package/Environment/Common/collections/Main/medium_artwork/system_info/Sega Genesis.png differ diff --git a/Package/Environment/Common/collections/Main/settings.conf b/Package/Environment/Common/collections/Main/settings.conf index c481326..f50714a 100644 --- a/Package/Environment/Common/collections/Main/settings.conf +++ b/Package/Environment/Common/collections/Main/settings.conf @@ -1,14 +1,20 @@ ############################################################################### # This main collection is intended to be a menu for navigating to other # collections (although this can also be configured to list and launch items). -# See Menu.xml to configure the menu +# See menu.txt to configure the menu ############################################################################### ############################################################################### -# If a menu.xml file exists, it will display the menu alphabetically. To -# not auto-sort the menu items alphabetically, set the following to false. -# This does not apply to how your ROMs are sorted. +# Extensions are comma separated without spaces ############################################################################### -list.menuSort = true +list.extensions = exe,bat,sh +############################################################################### +# Sort menu items alphabetically +############################################################################### +list.menuSort = yes +############################################################################### +# The executable to run when an item in a collection item is selected +############################################################################### +launcher = Main diff --git a/Package/Environment/Common/collections/Sega Genesis/medium_artwork/fanart/default.png b/Package/Environment/Common/collections/Sega Genesis/medium_artwork/fanart/default.png new file mode 100644 index 0000000..dc8be4b Binary files /dev/null and b/Package/Environment/Common/collections/Sega Genesis/medium_artwork/fanart/default.png differ diff --git a/Package/Environment/Common/collections/Sega Genesis/medium_artwork/story/Zero Tolerance (USA, Europe).txt b/Package/Environment/Common/collections/Sega Genesis/medium_artwork/story/Zero Tolerance (USA, Europe).txt new file mode 100644 index 0000000..e742124 --- /dev/null +++ b/Package/Environment/Common/collections/Sega Genesis/medium_artwork/story/Zero Tolerance (USA, Europe).txt @@ -0,0 +1,4 @@ +The space station Europe-1 has been overrun by aliens. During one of the fights the nuclear cooling system has been damaged, resulting in a meltdown within hours. Your mission, as a team of five of the toughest persons in the Corps, is to infiltrate and gain control of Europe-1. You must sweep the entire station clean of aliens. + +One of a few first-person-shooters on this console. It is required that you kill every single alien on each of the levels (hence the name). The five members of your team, who have different skills, start out with different weapons, are your five chances of seeing this through. This adds a level of strategy to the game. + diff --git a/Package/Environment/Common/collections/Sega Genesis/system_artwork/story.txt b/Package/Environment/Common/collections/Sega Genesis/system_artwork/story.txt new file mode 100644 index 0000000..fc67ebc --- /dev/null +++ b/Package/Environment/Common/collections/Sega Genesis/system_artwork/story.txt @@ -0,0 +1 @@ +The Sega Genesis, a.k.a the Sega Megadrive, is a 16-bit video game console developed by Sega and released in August 1989. It is the third console from Sega, and is the successor to Sega Master System. the hardware was based on Sega's system 16 arcade board. The Genesis primarily competed with the Super Nintendo during its life cycle. By the end of its life, it had sold an estimated 40 million units, and its games continued to be popular among gamers even to these days. diff --git a/Package/Environment/Common/collections/_common/medium_artwork/manufacturer/Accolade, Inc..png b/Package/Environment/Common/collections/_common/medium_artwork/manufacturer/Accolade, Inc..png new file mode 100644 index 0000000..aff22ec Binary files /dev/null and b/Package/Environment/Common/collections/_common/medium_artwork/manufacturer/Accolade, Inc..png differ diff --git a/Package/Environment/Common/collections/_manufacturer/Technopop.png b/Package/Environment/Common/collections/_common/medium_artwork/manufacturer/Technopop, Inc..png similarity index 100% rename from Package/Environment/Common/collections/_manufacturer/Technopop.png rename to Package/Environment/Common/collections/_common/medium_artwork/manufacturer/Technopop, Inc..png diff --git a/Package/Environment/Common/collections/_common/medium_artwork/numberPlayers/1.png b/Package/Environment/Common/collections/_common/medium_artwork/numberPlayers/1.png new file mode 100644 index 0000000..641e5e8 Binary files /dev/null and b/Package/Environment/Common/collections/_common/medium_artwork/numberPlayers/1.png differ diff --git a/Package/Environment/Common/collections/_common/medium_artwork/rating/HSRS - GA (General Audience).png b/Package/Environment/Common/collections/_common/medium_artwork/rating/HSRS - GA (General Audience).png new file mode 100644 index 0000000..8fc3b32 Binary files /dev/null and b/Package/Environment/Common/collections/_common/medium_artwork/rating/HSRS - GA (General Audience).png differ diff --git a/Package/Environment/Common/collections/_common/medium_artwork/score/3.1.png b/Package/Environment/Common/collections/_common/medium_artwork/score/3.1.png new file mode 100644 index 0000000..54cadca Binary files /dev/null and b/Package/Environment/Common/collections/_common/medium_artwork/score/3.1.png differ diff --git a/Package/Environment/Common/controls.conf b/Package/Environment/Common/controls.conf index 1d0dbc4..b24885b 100644 --- a/Package/Environment/Common/controls.conf +++ b/Package/Environment/Common/controls.conf @@ -14,6 +14,8 @@ select = Space back = Escape quit = Q +# Define controller analogue dead zone. Default (when not configured) is 3%. +# deadZone = 3 ############################################################################## # MOUSE CODES diff --git a/Package/Environment/Common/launchers/Main.conf b/Package/Environment/Common/launchers/Main.conf new file mode 100644 index 0000000..e38aed4 --- /dev/null +++ b/Package/Environment/Common/launchers/Main.conf @@ -0,0 +1,2 @@ +executable = %ITEM_FILEPATH% +arguments = diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/Credits.txt b/Package/Environment/Common/layouts/Aeon Nox 16x9/Credits.txt new file mode 100644 index 0000000..7e6d087 --- /dev/null +++ b/Package/Environment/Common/layouts/Aeon Nox 16x9/Credits.txt @@ -0,0 +1,11 @@ +Aeon Nox Theme by David Horowitz (c) 2016) +Based on Aeon Nox skin from Kodi +--------------------------------------------------------------------------------- +Intro.mp4 +Music +Discovery Hit Kevin MacLeod (incompetech.com) +Licensed under Creative Commons: By Attribution 3.0 License +http://creativecommons.org/licenses/by/3.0/ + + + diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/BebasNeue.ttf b/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/BebasNeue.ttf new file mode 100644 index 0000000..202ccd3 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/BebasNeue.ttf differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/MC360.ttf b/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/MC360.ttf new file mode 100644 index 0000000..e2b7a58 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/MC360.ttf differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/OpenSans.ttf b/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/OpenSans.ttf new file mode 100644 index 0000000..9872769 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/OpenSans.ttf differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/RobotoCondensed-Regular.ttf b/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/RobotoCondensed-Regular.ttf new file mode 100644 index 0000000..c2304c1 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/fonts/RobotoCondensed-Regular.ttf differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/images/bar.png b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/bar.png new file mode 100644 index 0000000..8a79f13 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/bar.png differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/images/floor.png b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/floor.png new file mode 100644 index 0000000..0dbcb84 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/floor.png differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/images/infobar1.png b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/infobar1.png new file mode 100644 index 0000000..f166bb8 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/infobar1.png differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/images/infobar2.png b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/infobar2.png new file mode 100644 index 0000000..0fd4dee Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/infobar2.png differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/images/topbar.png b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/topbar.png new file mode 100644 index 0000000..9e3ce6c Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/topbar.png differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/images/video_overlay.png b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/video_overlay.png new file mode 100644 index 0000000..34412d8 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/video_overlay.png differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/images/wall.png b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/wall.png new file mode 100644 index 0000000..437fd04 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/images/wall.png differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/layout.xml b/Package/Environment/Common/layouts/Aeon Nox 16x9/layout.xml new file mode 100644 index 0000000..2ac6636 --- /dev/null +++ b/Package/Environment/Common/layouts/Aeon Nox 16x9/layout.xml @@ -0,0 +1,1054 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/highlight.wav b/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/highlight.wav new file mode 100644 index 0000000..105a57e Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/highlight.wav differ diff --git a/Package/Environment/Common/layouts/Default 16x9/load.wav b/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/load.wav similarity index 100% rename from Package/Environment/Common/layouts/Default 16x9/load.wav rename to Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/load.wav diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/select.wav b/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/select.wav new file mode 100644 index 0000000..3151dee Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/select.wav differ diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/unload.wav b/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/unload.wav new file mode 100644 index 0000000..af089a7 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/sounds/unload.wav differ diff --git a/Package/Environment/Common/layouts/Default 16x9/splash.xml b/Package/Environment/Common/layouts/Aeon Nox 16x9/splash.xml similarity index 80% rename from Package/Environment/Common/layouts/Default 16x9/splash.xml rename to Package/Environment/Common/layouts/Aeon Nox 16x9/splash.xml index 5f777f0..d9a2edb 100644 --- a/Package/Environment/Common/layouts/Default 16x9/splash.xml +++ b/Package/Environment/Common/layouts/Aeon Nox 16x9/splash.xml @@ -1,9 +1,9 @@ - + - + +--> + + + diff --git a/Package/Environment/Common/layouts/Aeon Nox 16x9/video/intro.mp4 b/Package/Environment/Common/layouts/Aeon Nox 16x9/video/intro.mp4 new file mode 100644 index 0000000..03ac6f5 Binary files /dev/null and b/Package/Environment/Common/layouts/Aeon Nox 16x9/video/intro.mp4 differ diff --git a/Package/Environment/Common/layouts/Default 16x9/Credits.txt b/Package/Environment/Common/layouts/Default 16x9/Credits.txt deleted file mode 100644 index f6a2307..0000000 --- a/Package/Environment/Common/layouts/Default 16x9/Credits.txt +++ /dev/null @@ -1,7 +0,0 @@ -Theme by TimmyB - - ------------- -Highlight.wav by orginaljun - orginaljun.deviantart.com -http://www.freesound.org/people/orginaljun/sounds/157871/ - diff --git a/Package/Environment/Common/layouts/Default 16x9/LoveloBlack.otf b/Package/Environment/Common/layouts/Default 16x9/LoveloBlack.otf deleted file mode 100644 index 0135811..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/LoveloBlack.otf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/Roboto-Bold.ttf b/Package/Environment/Common/layouts/Default 16x9/Roboto-Bold.ttf deleted file mode 100644 index aaf374d..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/Roboto-Bold.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/barbkgrnd.png b/Package/Environment/Common/layouts/Default 16x9/barbkgrnd.png deleted file mode 100644 index 55d5e26..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/barbkgrnd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/bkgd.png b/Package/Environment/Common/layouts/Default 16x9/bkgd.png deleted file mode 100644 index 709cd79..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/bkgd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/bkgnd.png b/Package/Environment/Common/layouts/Default 16x9/bkgnd.png deleted file mode 100644 index 0f16b88..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/bkgnd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/highlight.png b/Package/Environment/Common/layouts/Default 16x9/highlight.png deleted file mode 100644 index 15292c9..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/highlight.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/highlight.wav b/Package/Environment/Common/layouts/Default 16x9/highlight.wav deleted file mode 100644 index 517e819..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/highlight.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/infobk.png b/Package/Environment/Common/layouts/Default 16x9/infobk.png deleted file mode 100644 index aefd8e7..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/infobk.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/layout.xml b/Package/Environment/Common/layouts/Default 16x9/layout.xml deleted file mode 100644 index 90732e1..0000000 --- a/Package/Environment/Common/layouts/Default 16x9/layout.xml +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Default 16x9/logo.png b/Package/Environment/Common/layouts/Default 16x9/logo.png deleted file mode 100644 index 5e7d0f4..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/logo.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/menubk.png b/Package/Environment/Common/layouts/Default 16x9/menubk.png deleted file mode 100644 index 6170c34..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/menubk.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/select.wav b/Package/Environment/Common/layouts/Default 16x9/select.wav deleted file mode 100644 index 6678b93..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/select.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/unload.wav b/Package/Environment/Common/layouts/Default 16x9/unload.wav deleted file mode 100644 index 65f069a..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/unload.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Default 16x9/videobk.png b/Package/Environment/Common/layouts/Default 16x9/videobk.png deleted file mode 100644 index 9f27435..0000000 Binary files a/Package/Environment/Common/layouts/Default 16x9/videobk.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/Roboto-Bold.ttf b/Package/Environment/Common/layouts/Mamed 16x9/Roboto-Bold.ttf deleted file mode 100644 index aaf374d..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/Roboto-Bold.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/bkgnd.png b/Package/Environment/Common/layouts/Mamed 16x9/bkgnd.png deleted file mode 100644 index 0f16b88..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/bkgnd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/highlight.wav b/Package/Environment/Common/layouts/Mamed 16x9/highlight.wav deleted file mode 100644 index 517e819..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/highlight.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/layout.xml b/Package/Environment/Common/layouts/Mamed 16x9/layout.xml deleted file mode 100644 index dd46163..0000000 --- a/Package/Environment/Common/layouts/Mamed 16x9/layout.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Mamed 16x9/load.wav b/Package/Environment/Common/layouts/Mamed 16x9/load.wav deleted file mode 100644 index 077480e..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/load.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/logo.png b/Package/Environment/Common/layouts/Mamed 16x9/logo.png deleted file mode 100644 index 5e7d0f4..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/logo.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/mamedbg.jpg b/Package/Environment/Common/layouts/Mamed 16x9/mamedbg.jpg deleted file mode 100644 index 86d4d6c..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/mamedbg.jpg and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/mamedfont.ttf b/Package/Environment/Common/layouts/Mamed 16x9/mamedfont.ttf deleted file mode 100644 index 55559c9..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/mamedfont.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/select.wav b/Package/Environment/Common/layouts/Mamed 16x9/select.wav deleted file mode 100644 index 6678b93..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/select.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 16x9/splash.xml b/Package/Environment/Common/layouts/Mamed 16x9/splash.xml deleted file mode 100644 index 5f777f0..0000000 --- a/Package/Environment/Common/layouts/Mamed 16x9/splash.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Mamed 16x9/unload.wav b/Package/Environment/Common/layouts/Mamed 16x9/unload.wav deleted file mode 100644 index 65f069a..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 16x9/unload.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/Roboto-Bold.ttf b/Package/Environment/Common/layouts/Mamed 2015 16x9/Roboto-Bold.ttf deleted file mode 100644 index aaf374d..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/Roboto-Bold.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/bkgnd.png b/Package/Environment/Common/layouts/Mamed 2015 16x9/bkgnd.png deleted file mode 100644 index 0f16b88..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/bkgnd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/highlight.wav b/Package/Environment/Common/layouts/Mamed 2015 16x9/highlight.wav deleted file mode 100644 index 517e819..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/highlight.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/layout.xml b/Package/Environment/Common/layouts/Mamed 2015 16x9/layout.xml deleted file mode 100644 index 4ca289b..0000000 --- a/Package/Environment/Common/layouts/Mamed 2015 16x9/layout.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/load.wav b/Package/Environment/Common/layouts/Mamed 2015 16x9/load.wav deleted file mode 100644 index 077480e..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/load.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/logo.png b/Package/Environment/Common/layouts/Mamed 2015 16x9/logo.png deleted file mode 100644 index 5e7d0f4..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/logo.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/mamedbg.png b/Package/Environment/Common/layouts/Mamed 2015 16x9/mamedbg.png deleted file mode 100644 index 6587ca6..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/mamedbg.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/mamedfont.ttf b/Package/Environment/Common/layouts/Mamed 2015 16x9/mamedfont.ttf deleted file mode 100644 index 55559c9..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/mamedfont.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/select.wav b/Package/Environment/Common/layouts/Mamed 2015 16x9/select.wav deleted file mode 100644 index 6678b93..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/select.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/splash.xml b/Package/Environment/Common/layouts/Mamed 2015 16x9/splash.xml deleted file mode 100644 index 5f777f0..0000000 --- a/Package/Environment/Common/layouts/Mamed 2015 16x9/splash.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Mamed 2015 16x9/unload.wav b/Package/Environment/Common/layouts/Mamed 2015 16x9/unload.wav deleted file mode 100644 index 65f069a..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 2015 16x9/unload.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/Roboto-Bold.ttf b/Package/Environment/Common/layouts/Mamed 4x3/Roboto-Bold.ttf deleted file mode 100644 index aaf374d..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/Roboto-Bold.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/bkgnd.png b/Package/Environment/Common/layouts/Mamed 4x3/bkgnd.png deleted file mode 100644 index 0f16b88..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/bkgnd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/highlight.wav b/Package/Environment/Common/layouts/Mamed 4x3/highlight.wav deleted file mode 100644 index 517e819..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/highlight.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/layout.xml b/Package/Environment/Common/layouts/Mamed 4x3/layout.xml deleted file mode 100644 index 76e4adc..0000000 --- a/Package/Environment/Common/layouts/Mamed 4x3/layout.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Mamed 4x3/load.wav b/Package/Environment/Common/layouts/Mamed 4x3/load.wav deleted file mode 100644 index 077480e..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/load.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/logo.png b/Package/Environment/Common/layouts/Mamed 4x3/logo.png deleted file mode 100644 index 5e7d0f4..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/logo.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/mamedbg.jpg b/Package/Environment/Common/layouts/Mamed 4x3/mamedbg.jpg deleted file mode 100644 index 51bd984..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/mamedbg.jpg and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/mamedfont.ttf b/Package/Environment/Common/layouts/Mamed 4x3/mamedfont.ttf deleted file mode 100644 index 55559c9..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/mamedfont.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/select.wav b/Package/Environment/Common/layouts/Mamed 4x3/select.wav deleted file mode 100644 index 6678b93..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/select.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Mamed 4x3/splash.xml b/Package/Environment/Common/layouts/Mamed 4x3/splash.xml deleted file mode 100644 index 5f777f0..0000000 --- a/Package/Environment/Common/layouts/Mamed 4x3/splash.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Mamed 4x3/unload.wav b/Package/Environment/Common/layouts/Mamed 4x3/unload.wav deleted file mode 100644 index 65f069a..0000000 Binary files a/Package/Environment/Common/layouts/Mamed 4x3/unload.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/Roboto-Bold.ttf b/Package/Environment/Common/layouts/Pandora's Box 16x9/Roboto-Bold.ttf deleted file mode 100644 index aaf374d..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/Roboto-Bold.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/attribution.txt b/Package/Environment/Common/layouts/Pandora's Box 16x9/attribution.txt deleted file mode 100644 index 7a1afcd..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 16x9/attribution.txt +++ /dev/null @@ -1,4 +0,0 @@ -The background image was taken from -https://commons.wikimedia.org/wiki/File:Flame_of_fire.jpg, and is licensed -under the Creative Commons Attribution-Share Alike 2.5 Generic, 2.0 Generic -and 1.0 Generic license. diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/bg.jpg b/Package/Environment/Common/layouts/Pandora's Box 16x9/bg.jpg deleted file mode 100644 index 80103f7..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/bg.jpg and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/bkgnd.png b/Package/Environment/Common/layouts/Pandora's Box 16x9/bkgnd.png deleted file mode 100644 index 0f16b88..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/bkgnd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/black.png b/Package/Environment/Common/layouts/Pandora's Box 16x9/black.png deleted file mode 100644 index 73d0a7c..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/black.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/bottomborder.png b/Package/Environment/Common/layouts/Pandora's Box 16x9/bottomborder.png deleted file mode 100644 index 1735f28..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/bottomborder.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/highlight.wav b/Package/Environment/Common/layouts/Pandora's Box 16x9/highlight.wav deleted file mode 100644 index 517e819..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/highlight.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/layout.xml b/Package/Environment/Common/layouts/Pandora's Box 16x9/layout.xml deleted file mode 100644 index 5ffdff1..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 16x9/layout.xml +++ /dev/null @@ -1,444 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/load.wav b/Package/Environment/Common/layouts/Pandora's Box 16x9/load.wav deleted file mode 100644 index 077480e..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/load.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/logo.png b/Package/Environment/Common/layouts/Pandora's Box 16x9/logo.png deleted file mode 100644 index 5e7d0f4..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/logo.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/select.wav b/Package/Environment/Common/layouts/Pandora's Box 16x9/select.wav deleted file mode 100644 index 6678b93..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/select.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/splash.xml b/Package/Environment/Common/layouts/Pandora's Box 16x9/splash.xml deleted file mode 100644 index 5f777f0..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 16x9/splash.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/unload.wav b/Package/Environment/Common/layouts/Pandora's Box 16x9/unload.wav deleted file mode 100644 index 65f069a..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/unload.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 16x9/videoborder.png b/Package/Environment/Common/layouts/Pandora's Box 16x9/videoborder.png deleted file mode 100644 index e79f15d..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 16x9/videoborder.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/Roboto-Bold.ttf b/Package/Environment/Common/layouts/Pandora's Box 3x4/Roboto-Bold.ttf deleted file mode 100644 index aaf374d..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/Roboto-Bold.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/attribution.txt b/Package/Environment/Common/layouts/Pandora's Box 3x4/attribution.txt deleted file mode 100644 index 7a1afcd..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 3x4/attribution.txt +++ /dev/null @@ -1,4 +0,0 @@ -The background image was taken from -https://commons.wikimedia.org/wiki/File:Flame_of_fire.jpg, and is licensed -under the Creative Commons Attribution-Share Alike 2.5 Generic, 2.0 Generic -and 1.0 Generic license. diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/bg.jpg b/Package/Environment/Common/layouts/Pandora's Box 3x4/bg.jpg deleted file mode 100644 index f9c5d4d..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/bg.jpg and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/bkgnd.png b/Package/Environment/Common/layouts/Pandora's Box 3x4/bkgnd.png deleted file mode 100644 index 0f16b88..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/bkgnd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/black.png b/Package/Environment/Common/layouts/Pandora's Box 3x4/black.png deleted file mode 100644 index 73d0a7c..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/black.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/bottomborder.png b/Package/Environment/Common/layouts/Pandora's Box 3x4/bottomborder.png deleted file mode 100644 index 337be42..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/bottomborder.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/highlight.wav b/Package/Environment/Common/layouts/Pandora's Box 3x4/highlight.wav deleted file mode 100644 index 517e819..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/highlight.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/layout.xml b/Package/Environment/Common/layouts/Pandora's Box 3x4/layout.xml deleted file mode 100644 index 749416e..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 3x4/layout.xml +++ /dev/null @@ -1,393 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/load.wav b/Package/Environment/Common/layouts/Pandora's Box 3x4/load.wav deleted file mode 100644 index 077480e..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/load.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/logo.png b/Package/Environment/Common/layouts/Pandora's Box 3x4/logo.png deleted file mode 100644 index 5e7d0f4..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/logo.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/select.wav b/Package/Environment/Common/layouts/Pandora's Box 3x4/select.wav deleted file mode 100644 index 6678b93..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/select.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/splash.xml b/Package/Environment/Common/layouts/Pandora's Box 3x4/splash.xml deleted file mode 100644 index 5f777f0..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 3x4/splash.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/unload.wav b/Package/Environment/Common/layouts/Pandora's Box 3x4/unload.wav deleted file mode 100644 index 65f069a..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/unload.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 3x4/videoborder.png b/Package/Environment/Common/layouts/Pandora's Box 3x4/videoborder.png deleted file mode 100644 index e79f15d..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 3x4/videoborder.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/Roboto-Bold.ttf b/Package/Environment/Common/layouts/Pandora's Box 4x3/Roboto-Bold.ttf deleted file mode 100644 index aaf374d..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/Roboto-Bold.ttf and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/attribution.txt b/Package/Environment/Common/layouts/Pandora's Box 4x3/attribution.txt deleted file mode 100644 index 7a1afcd..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 4x3/attribution.txt +++ /dev/null @@ -1,4 +0,0 @@ -The background image was taken from -https://commons.wikimedia.org/wiki/File:Flame_of_fire.jpg, and is licensed -under the Creative Commons Attribution-Share Alike 2.5 Generic, 2.0 Generic -and 1.0 Generic license. diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/bg.jpg b/Package/Environment/Common/layouts/Pandora's Box 4x3/bg.jpg deleted file mode 100644 index 53c7441..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/bg.jpg and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/bkgnd.png b/Package/Environment/Common/layouts/Pandora's Box 4x3/bkgnd.png deleted file mode 100644 index 0f16b88..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/bkgnd.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/black.png b/Package/Environment/Common/layouts/Pandora's Box 4x3/black.png deleted file mode 100644 index 73d0a7c..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/black.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/bottomborder.png b/Package/Environment/Common/layouts/Pandora's Box 4x3/bottomborder.png deleted file mode 100644 index 52fa1ff..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/bottomborder.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/highlight.wav b/Package/Environment/Common/layouts/Pandora's Box 4x3/highlight.wav deleted file mode 100644 index 517e819..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/highlight.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/layout.xml b/Package/Environment/Common/layouts/Pandora's Box 4x3/layout.xml deleted file mode 100644 index db71a63..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 4x3/layout.xml +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/load.wav b/Package/Environment/Common/layouts/Pandora's Box 4x3/load.wav deleted file mode 100644 index 077480e..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/load.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/logo.png b/Package/Environment/Common/layouts/Pandora's Box 4x3/logo.png deleted file mode 100644 index 5e7d0f4..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/logo.png and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/select.wav b/Package/Environment/Common/layouts/Pandora's Box 4x3/select.wav deleted file mode 100644 index 6678b93..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/select.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/splash.xml b/Package/Environment/Common/layouts/Pandora's Box 4x3/splash.xml deleted file mode 100644 index 5f777f0..0000000 --- a/Package/Environment/Common/layouts/Pandora's Box 4x3/splash.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/unload.wav b/Package/Environment/Common/layouts/Pandora's Box 4x3/unload.wav deleted file mode 100644 index 65f069a..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/unload.wav and /dev/null differ diff --git a/Package/Environment/Common/layouts/Pandora's Box 4x3/videoborder.png b/Package/Environment/Common/layouts/Pandora's Box 4x3/videoborder.png deleted file mode 100644 index e79f15d..0000000 Binary files a/Package/Environment/Common/layouts/Pandora's Box 4x3/videoborder.png and /dev/null differ diff --git a/Package/Environment/Common/meta/hyperlist/Sega Genesis.xml b/Package/Environment/Common/meta/hyperlist/Sega Genesis.xml index 56c9281..116f5d6 100644 --- a/Package/Environment/Common/meta/hyperlist/Sega Genesis.xml +++ b/Package/Environment/Common/meta/hyperlist/Sega Genesis.xml @@ -7760,10 +7760,13 @@ Zero Tolerance (USA, Europe) 23f603f5 - Technopop + Accolade, Inc. + Technopop, Inc. 1994 Shooter HSRS - GA (General Audience) + 1 + 3.1 Yes diff --git a/Package/Environment/Common/settings.conf b/Package/Environment/Common/settings.conf index c001c15..adff97f 100644 --- a/Package/Environment/Common/settings.conf +++ b/Package/Environment/Common/settings.conf @@ -12,9 +12,9 @@ # Display ####################################### fullscreen = no -horizontal = 400 # or enter in the screen pixel width (i.e 1024) -vertical = 300 # or enter in the screen pixel width (i.e 768) -layout = Default 16x9 +horizontal = stretch # or enter in the screen pixel width (i.e 1024) +vertical = stretch # or enter in the screen pixel width (i.e 768) +layout = Aeon Nox 16x9 hideMouse = yes showParenthesis = yes showSquareBrackets = yes diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt index 92d0625..4332ed3 100644 --- a/RetroFE/Source/CMakeLists.txt +++ b/RetroFE/Source/CMakeLists.txt @@ -115,14 +115,15 @@ set(RETROFE_HEADERS "${RETROFE_DIR}/Source/Graphics/Component/ImageBuilder.h" "${RETROFE_DIR}/Source/Graphics/Component/ReloadableMedia.h" "${RETROFE_DIR}/Source/Graphics/Component/ReloadableText.h" + "${RETROFE_DIR}/Source/Graphics/Component/ReloadableScrollingText.h" "${RETROFE_DIR}/Source/Graphics/Component/ScrollingList.h" "${RETROFE_DIR}/Source/Graphics/Component/Text.h" "${RETROFE_DIR}/Source/Graphics/Component/VideoComponent.h" "${RETROFE_DIR}/Source/Graphics/Component/VideoBuilder.h" + "${RETROFE_DIR}/Source/Graphics/Component/Video.h" "${RETROFE_DIR}/Source/Graphics/Font.h" "${RETROFE_DIR}/Source/Graphics/FontCache.h" "${RETROFE_DIR}/Source/Graphics/PageBuilder.h" - "${RETROFE_DIR}/Source/Graphics/MenuNotifierInterface.h" "${RETROFE_DIR}/Source/Graphics/Page.h" "${RETROFE_DIR}/Source/Sound/Sound.h" "${RETROFE_DIR}/Source/Utility/Log.h" @@ -171,9 +172,11 @@ set(RETROFE_SOURCES "${RETROFE_DIR}/Source/Graphics/Component/Text.cpp" "${RETROFE_DIR}/Source/Graphics/Component/ReloadableMedia.cpp" "${RETROFE_DIR}/Source/Graphics/Component/ReloadableText.cpp" + "${RETROFE_DIR}/Source/Graphics/Component/ReloadableScrollingText.cpp" "${RETROFE_DIR}/Source/Graphics/Component/ScrollingList.cpp" "${RETROFE_DIR}/Source/Graphics/Component/VideoBuilder.cpp" "${RETROFE_DIR}/Source/Graphics/Component/VideoComponent.cpp" + "${RETROFE_DIR}/Source/Graphics/Component/Video.cpp" "${RETROFE_DIR}/Source/Sound/Sound.cpp" "${RETROFE_DIR}/Source/Utility/Log.cpp" "${RETROFE_DIR}/Source/Utility/Utils.cpp" @@ -213,6 +216,6 @@ if(MSVC) set_target_properties(retrofe PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") endif() diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index 2843f54..1f38e7a 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -121,9 +121,6 @@ bool CollectionInfoBuilder::createCollectionDirectory(std::string name) settingsFile << "launcher = mame" << std::endl; settingsFile << "#metadata.type = MAME" << std::endl; settingsFile << std::endl; - settingsFile << "#manufacturer = " << std::endl; - settingsFile << "#year = " << std::endl; - settingsFile << "#genre = " << std::endl; settingsFile << std::endl; settingsFile << "#media.screenshot = " << Utils::combinePath("%BASE_MEDIA_PATH%", "%ITEM_COLLECTION_NAME%", "medium_artwork", "screenshot") << std::endl; settingsFile << "#media.screentitle = " << Utils::combinePath("%BASE_MEDIA_PATH%", "%ITEM_COLLECTION_NAME%", "medium_artwork", "screentitle") << std::endl; diff --git a/RetroFE/Source/Collection/Item.h b/RetroFE/Source/Collection/Item.h index 1826f50..fab12fe 100644 --- a/RetroFE/Source/Collection/Item.h +++ b/RetroFE/Source/Collection/Item.h @@ -32,11 +32,15 @@ public: std::string fullTitle; std::string year; std::string manufacturer; + std::string developer; std::string genre; std::string cloneof; std::string numberPlayers; std::string numberButtons; + std::string ctrlType; + std::string joyWays; + std::string rating; + std::string score; CollectionInfo *collectionInfo; bool leaf; }; - diff --git a/RetroFE/Source/Control/UserInput.cpp b/RetroFE/Source/Control/UserInput.cpp index 310c0c6..e4de2e0 100644 --- a/RetroFE/Source/Control/UserInput.cpp +++ b/RetroFE/Source/Control/UserInput.cpp @@ -191,20 +191,27 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required) { // string is now axis0+ unsigned int axis; - Sint16 min; - Sint16 max; + Sint16 min; + Sint16 max; + int deadZone; + joydesc = Utils::replace(joydesc, "axis", ""); + if(!config_.getProperty("controls.deadZone", deadZone)) + { + deadZone = 3; + } + // string is now 0+ if(joydesc.find("-") != std::string::npos) { min = -32768; - max = -1000; + max = -32768 / 100 * deadZone; joydesc = Utils::replace(joydesc, "-", ""); } else if(joydesc.find("+") != std::string::npos) { - min = 1000; + min = 32767 / 100 * deadZone; max = 32767; joydesc = Utils::replace(joydesc, "+", ""); } @@ -213,7 +220,7 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required) std::stringstream ss; ss << joydesc; ss >> axis; - Logger::write(Logger::ZONE_INFO, "Input", "Binding joypad axis " + ss.str() ); + Logger::write(Logger::ZONE_INFO, "Input", "Binding joypad axis " + ss.str()); keyHandlers_[key] = new JoyAxisHandler(joynum, axis, min, max); return true; } diff --git a/RetroFE/Source/Database/Configuration.cpp b/RetroFE/Source/Database/Configuration.cpp index 7d3e294..d9845fb 100644 --- a/RetroFE/Source/Database/Configuration.cpp +++ b/RetroFE/Source/Database/Configuration.cpp @@ -74,7 +74,7 @@ bool Configuration::import(std::string keyPrefix, std::string file) return import("", keyPrefix, file); } -bool Configuration::import(std::string collection, std::string keyPrefix, std::string file) +bool Configuration::import(std::string collection, std::string keyPrefix, std::string file, bool mustExist) { bool retVal = true; int lineCount = 0; @@ -86,7 +86,14 @@ bool Configuration::import(std::string collection, std::string keyPrefix, std::s if (!ifs.is_open()) { - Logger::write(Logger::ZONE_ERROR, "Configuration", "Could not open " + file + "\""); + if (mustExist) + { + Logger::write(Logger::ZONE_ERROR, "Configuration", "Could not open " + file + "\""); + } + else + { + Logger::write(Logger::ZONE_INFO, "Configuration", "Could not open " + file + "\""); + } return false; } @@ -354,27 +361,7 @@ void Configuration::getMediaPropertyAbsolutePath(std::string collectionName, std baseMediaPath = Utils::combinePath(absolutePath, "collections"); } - if(mediaType == "manufacturer") - { - value = Utils::combinePath(baseMediaPath, "_manufacturer"); - } - else if(mediaType == "genre") - { - value = Utils::combinePath(baseMediaPath, "_genre"); - } - else if(mediaType == "year") - { - value = Utils::combinePath(baseMediaPath, "_year"); - } - else if(mediaType == "number_players") - { - value = Utils::combinePath(baseMediaPath, "_number_players"); - } - else if(mediaType == "number_buttons") - { - value = Utils::combinePath(baseMediaPath, "_number_buttons"); - } - else if(system) + if(system) { value = Utils::combinePath(baseMediaPath, collectionName, "system_artwork"); } diff --git a/RetroFE/Source/Database/Configuration.h b/RetroFE/Source/Database/Configuration.h index 0344ce5..da17d2b 100644 --- a/RetroFE/Source/Database/Configuration.h +++ b/RetroFE/Source/Database/Configuration.h @@ -28,7 +28,7 @@ public: static std::string convertToAbsolutePath(std::string prefix, std::string path); // gets the global configuration bool import(std::string keyPrefix, std::string file); - bool import(std::string collection, std::string keyPrefix, std::string file); + bool import(std::string collection, std::string keyPrefix, std::string file, bool mustExist = true); bool getProperty(std::string key, std::string &value); bool getProperty(std::string key, int &value); bool getProperty(std::string key, bool &value); diff --git a/RetroFE/Source/Database/MetadataDatabase.cpp b/RetroFE/Source/Database/MetadataDatabase.cpp index 19453f1..fdfd27a 100644 --- a/RetroFE/Source/Database/MetadataDatabase.cpp +++ b/RetroFE/Source/Database/MetadataDatabase.cpp @@ -81,10 +81,15 @@ bool MetadataDatabase::initialize() sql.append("title TEXT NOT NULL DEFAULT '',"); sql.append("year TEXT NOT NULL DEFAULT '',"); sql.append("manufacturer TEXT NOT NULL DEFAULT '',"); + sql.append("developer TEXT NOT NULL DEFAULT '',"); sql.append("genre TEXT NOT NULL DEFAULT '',"); sql.append("cloneOf TEXT NOT NULL DEFAULT '',"); sql.append("players TEXT NOT NULL DEFAULT '',"); - sql.append("buttons TEXT NOT NULL DEFAULT '');"); + sql.append("ctrltype TEXT NOT NULL DEFAULT '',"); + sql.append("buttons TEXT NOT NULL DEFAULT '',"); + sql.append("joyways TEXT NOT NULL DEFAULT '',"); + sql.append("rating TEXT NOT NULL DEFAULT '',"); + sql.append("score TEXT NOT NULL DEFAULT '');"); sql.append("CREATE UNIQUE INDEX IF NOT EXISTS MetaUniqueId ON Meta(collectionName, name);"); rc = sqlite3_exec(handle, sql.c_str(), NULL, 0, &error); @@ -205,7 +210,7 @@ void MetadataDatabase::injectMetadata(CollectionInfo *collection) //todo: program crashes if this query fails sqlite3_prepare_v2(handle, - "SELECT DISTINCT Meta.name, Meta.title, Meta.year, Meta.manufacturer, Meta.genre, Meta.players, Meta.buttons, Meta.cloneOf " + "SELECT DISTINCT Meta.name, Meta.title, Meta.year, Meta.manufacturer, Meta.developer, Meta.genre, Meta.players, Meta.ctrltype, Meta.buttons, Meta.joyways, Meta.cloneOf, Meta.rating, Meta.score " "FROM Meta WHERE collectionName=? ORDER BY title ASC;", -1, &stmt, 0); @@ -219,10 +224,15 @@ void MetadataDatabase::injectMetadata(CollectionInfo *collection) std::string fullTitle = (char *)sqlite3_column_text(stmt, 1); std::string year = (char *)sqlite3_column_text(stmt, 2); std::string manufacturer = (char *)sqlite3_column_text(stmt, 3); - std::string genre = (char *)sqlite3_column_text(stmt, 4); - std::string numberPlayers = (char *)sqlite3_column_text(stmt, 5); - std::string numberButtons = (char *)sqlite3_column_text(stmt, 6); - std::string cloneOf = (char *)sqlite3_column_text(stmt, 7); + std::string developer = (char *)sqlite3_column_text(stmt, 4); + std::string genre = (char *)sqlite3_column_text(stmt, 5); + std::string numberPlayers = (char *)sqlite3_column_text(stmt, 6); + std::string ctrlType = (char *)sqlite3_column_text(stmt, 7); + std::string numberButtons = (char *)sqlite3_column_text(stmt, 8); + std::string joyWays = (char *)sqlite3_column_text(stmt, 9); + std::string cloneOf = (char *)sqlite3_column_text(stmt, 10); + std::string rating = (char *)sqlite3_column_text(stmt, 11); + std::string score = (char *)sqlite3_column_text(stmt, 12); std::string launcher; std::string title = fullTitle; @@ -269,10 +279,15 @@ void MetadataDatabase::injectMetadata(CollectionInfo *collection) item->fullTitle = fullTitle; item->year = year; item->manufacturer = manufacturer; + item->developer = developer; item->genre = genre; item->numberPlayers = numberPlayers; item->numberButtons = numberButtons; + item->ctrlType = ctrlType; + item->joyWays = joyWays; item->cloneof = cloneOf; + item->rating = rating; + item->score = score; } rc = sqlite3_step(stmt); } @@ -332,18 +347,30 @@ bool MetadataDatabase::importHyperlist(std::string hyperlistFile, std::string co rapidxml::xml_node<> *cloneofXml = game->first_node("cloneof"); rapidxml::xml_node<> *crcXml = game->first_node("crc"); rapidxml::xml_node<> *manufacturerXml = game->first_node("manufacturer"); + rapidxml::xml_node<> *developerXml = game->first_node("developer"); rapidxml::xml_node<> *yearXml = game->first_node("year"); rapidxml::xml_node<> *genreXml = game->first_node("genre"); rapidxml::xml_node<> *ratingXml = game->first_node("rating"); + rapidxml::xml_node<> *scoreXml = game->first_node("score"); + rapidxml::xml_node<> *numberPlayersXml = game->first_node("players"); + rapidxml::xml_node<> *ctrlTypeXml = game->first_node("ctrltype"); + rapidxml::xml_node<> *numberButtonsXml = game->first_node("buttons"); + rapidxml::xml_node<> *numberJoyWaysXml = game->first_node("joyways"); rapidxml::xml_node<> *enabledXml = game->first_node("enabled"); std::string name = (nameXml) ? nameXml->value() : ""; std::string description = (descriptionXml) ? descriptionXml->value() : ""; std::string crc = (crcXml) ? crcXml->value() : ""; std::string cloneOf = (cloneofXml) ? cloneofXml->value() : ""; std::string manufacturer = (manufacturerXml) ? manufacturerXml->value() : ""; + std::string developer = (developerXml) ? developerXml->value() : ""; std::string year = (yearXml) ? yearXml->value() : ""; std::string genre = (genreXml) ? genreXml->value() : ""; std::string rating = (ratingXml) ? ratingXml->value() : ""; + std::string score = (scoreXml) ? scoreXml->value() : ""; + std::string numberPlayers = (numberPlayersXml) ? numberPlayersXml->value() : ""; + std::string ctrlType = (ctrlTypeXml) ? ctrlTypeXml->value() : ""; + std::string numberButtons = (numberButtonsXml) ? numberButtonsXml->value() : ""; + std::string numberJoyWays = (numberJoyWaysXml) ? numberJoyWaysXml->value() : ""; std::string enabled = (enabledXml) ? enabledXml->value() : ""; if(name.length() > 0) @@ -351,16 +378,23 @@ bool MetadataDatabase::importHyperlist(std::string hyperlistFile, std::string co sqlite3_stmt *stmt; sqlite3_prepare_v2(handle, - "INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, genre, cloneOf, collectionName) VALUES (?,?,?,?,?,?,?)", + "INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, developer, genre, players, ctrltype, buttons, joyways, cloneOf, collectionName, rating, score) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)", -1, &stmt, 0); - sqlite3_bind_text(stmt, 1, name.c_str(), -1, SQLITE_TRANSIENT); - sqlite3_bind_text(stmt, 2, description.c_str(), -1, SQLITE_TRANSIENT); - sqlite3_bind_text(stmt, 3, year.c_str(), -1, SQLITE_TRANSIENT); - sqlite3_bind_text(stmt, 4, manufacturer.c_str(), -1, SQLITE_TRANSIENT); - sqlite3_bind_text(stmt, 5, genre.c_str(), -1, SQLITE_TRANSIENT); - sqlite3_bind_text(stmt, 6, cloneOf.c_str(), -1, SQLITE_TRANSIENT); - sqlite3_bind_text(stmt, 7, collectionName.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 1, name.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 2, description.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 3, year.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 4, manufacturer.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 5, developer.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 6, genre.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 7, numberPlayers.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 8, ctrlType.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 9, numberButtons.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 10, numberJoyWays.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 11, cloneOf.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 12, collectionName.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 13, rating.c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 14, score.c_str(), -1, SQLITE_TRANSIENT); sqlite3_step(stmt); sqlite3_finalize(stmt); @@ -466,7 +500,7 @@ bool MetadataDatabase::importMamelist(std::string filename, std::string collecti sqlite3_stmt *stmt; sqlite3_prepare_v2(handle, - "INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, genre, players, buttons, cloneOf, collectionName) VALUES (?,?,?,?,?,?,?,?,?)", + "INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, genre, players, buttons, cloneOf, collectionName) VALUES (?,?,?,?,?,?,?,?,?,?)", -1, &stmt, 0); diff --git a/RetroFE/Source/Execute/Launcher.cpp b/RetroFE/Source/Execute/Launcher.cpp index 53323f0..c4c62fa 100644 --- a/RetroFE/Source/Execute/Launcher.cpp +++ b/RetroFE/Source/Execute/Launcher.cpp @@ -42,12 +42,11 @@ bool Launcher::run(std::string collection, Item *collectionItem) std::string executablePath; std::string selectedItemsDirectory; std::string selectedItemsPath; - std::string currentDirectory; std::string extensionstr; std::string matchedExtension; std::string args; - if(!launcherExecutable(executablePath, currentDirectory, launcherName)) + if(!launcherExecutable(executablePath, launcherName)) { Logger::write(Logger::ZONE_ERROR, "Launcher", "Failed to find launcher executable (launcher: " + launcherName + " executable: " + executablePath + ")"); return false; @@ -85,6 +84,11 @@ bool Launcher::run(std::string collection, Item *collectionItem) selectedItemsDirectory, collection); + std::string currentDirectoryKey = "launchers." + launcherName + ".currentDirectory"; + std::string currentDirectory = Utils::getDirectory(executablePath); + + config_.getProperty(currentDirectoryKey, currentDirectory); + currentDirectory = replaceVariables(currentDirectory, selectedItemsPath, collectionItem->name, @@ -137,8 +141,8 @@ bool Launcher::execute(std::string executable, std::string args, std::string cur #ifdef WIN32 STARTUPINFO startupInfo; PROCESS_INFORMATION processInfo; - char applicationName[256]; - char currDir[256]; + char applicationName[2048]; + char currDir[2048]; memset(&applicationName, 0, sizeof(applicationName)); memset(&startupInfo, 0, sizeof(startupInfo)); memset(&processInfo, 0, sizeof(processInfo)); @@ -222,7 +226,7 @@ bool Launcher::launcherName(std::string &launcherName, std::string collection) -bool Launcher::launcherExecutable(std::string &executable, std::string ¤tDirectory, std::string launcherName) +bool Launcher::launcherExecutable(std::string &executable, std::string launcherName) { std::string executableKey = "launchers." + launcherName + ".executable"; @@ -231,11 +235,6 @@ bool Launcher::launcherExecutable(std::string &executable, std::string ¤tD return false; } - std::string currentDirectoryKey = "launchers." + launcherName + ".currentDirectory"; - currentDirectory = Utils::getDirectory(executable); - - config_.getProperty(currentDirectoryKey, currentDirectory); - return true; } diff --git a/RetroFE/Source/Execute/Launcher.h b/RetroFE/Source/Execute/Launcher.h index bd05906..6551c79 100644 --- a/RetroFE/Source/Execute/Launcher.h +++ b/RetroFE/Source/Execute/Launcher.h @@ -34,7 +34,7 @@ private: const std::string &replace); bool launcherName(std::string &launcherName, std::string collection); - bool launcherExecutable(std::string &executable, std::string ¤tDirectory, std::string launcherName); + bool launcherExecutable(std::string &executable, std::string launcherName); bool launcherArgs(std::string &args, std::string launcherName); bool extensions(std::string &extensions, std::string launcherName); bool collectionDirectory(std::string &directory, std::string collection); diff --git a/RetroFE/Source/Graphics/Animate/Tween.cpp b/RetroFE/Source/Graphics/Animate/Tween.cpp index 2b4d4b3..3657892 100644 --- a/RetroFE/Source/Graphics/Animate/Tween.cpp +++ b/RetroFE/Source/Graphics/Animate/Tween.cpp @@ -24,7 +24,8 @@ std::map Tween::tweenPropertyMap_; Tween::Tween(TweenProperty property, TweenAlgorithm type, double start, double end, double duration) : property(property) -, duration(duration) + , duration(duration) + , startDefined(true) , type(type) , start(start) , end(end) @@ -38,18 +39,26 @@ bool Tween::getTweenProperty(std::string name, TweenProperty &property) if(tweenPropertyMap_.size() == 0) { - tweenPropertyMap_["x"] = TWEEN_PROPERTY_X; - tweenPropertyMap_["y"] = TWEEN_PROPERTY_Y; - tweenPropertyMap_["angle"] = TWEEN_PROPERTY_ANGLE; - tweenPropertyMap_["alpha"] = TWEEN_PROPERTY_ALPHA; - tweenPropertyMap_["width"] = TWEEN_PROPERTY_WIDTH; - tweenPropertyMap_["height"] = TWEEN_PROPERTY_HEIGHT; - tweenPropertyMap_["xorigin"] = TWEEN_PROPERTY_X_ORIGIN; - tweenPropertyMap_["yorigin"] = TWEEN_PROPERTY_Y_ORIGIN; - tweenPropertyMap_["xoffset"] = TWEEN_PROPERTY_X_OFFSET; - tweenPropertyMap_["yoffset"] = TWEEN_PROPERTY_Y_OFFSET; - tweenPropertyMap_["fontSize"] = TWEEN_PROPERTY_FONT_SIZE; + tweenPropertyMap_["x"] = TWEEN_PROPERTY_X; + tweenPropertyMap_["y"] = TWEEN_PROPERTY_Y; + tweenPropertyMap_["angle"] = TWEEN_PROPERTY_ANGLE; + tweenPropertyMap_["alpha"] = TWEEN_PROPERTY_ALPHA; + tweenPropertyMap_["width"] = TWEEN_PROPERTY_WIDTH; + tweenPropertyMap_["height"] = TWEEN_PROPERTY_HEIGHT; + tweenPropertyMap_["xorigin"] = TWEEN_PROPERTY_X_ORIGIN; + tweenPropertyMap_["yorigin"] = TWEEN_PROPERTY_Y_ORIGIN; + tweenPropertyMap_["xoffset"] = TWEEN_PROPERTY_X_OFFSET; + tweenPropertyMap_["yoffset"] = TWEEN_PROPERTY_Y_OFFSET; + tweenPropertyMap_["fontSize"] = TWEEN_PROPERTY_FONT_SIZE; tweenPropertyMap_["backgroundalpha"] = TWEEN_PROPERTY_BACKGROUND_ALPHA; + tweenPropertyMap_["maxwidth"] = TWEEN_PROPERTY_MAX_WIDTH; + tweenPropertyMap_["maxheight"] = TWEEN_PROPERTY_MAX_HEIGHT; + tweenPropertyMap_["layer"] = TWEEN_PROPERTY_LAYER; + tweenPropertyMap_["containerx"] = TWEEN_PROPERTY_CONTAINER_X; + tweenPropertyMap_["containery"] = TWEEN_PROPERTY_CONTAINER_Y; + tweenPropertyMap_["containerwidth"] = TWEEN_PROPERTY_CONTAINER_WIDTH; + tweenPropertyMap_["containerheight"] = TWEEN_PROPERTY_CONTAINER_HEIGHT; + tweenPropertyMap_["nop"] = TWEEN_PROPERTY_NOP; } std::transform(name.begin(), name.end(), name.begin(), ::tolower); @@ -110,6 +119,11 @@ float Tween::animate(double elapsedTime) return animateSingle(type, start, end, duration, elapsedTime); } +float Tween::animate(double elapsedTime, double startValue) +{ + return animateSingle(type, startValue, end, duration, elapsedTime); +} + //todo: SDL likes floats, consider having casting being performed elsewhere float Tween::animateSingle(TweenAlgorithm type, double start, double end, double duration, double elapsedTime) { diff --git a/RetroFE/Source/Graphics/Animate/Tween.h b/RetroFE/Source/Graphics/Animate/Tween.h index b38bd8e..3cf440e 100644 --- a/RetroFE/Source/Graphics/Animate/Tween.h +++ b/RetroFE/Source/Graphics/Animate/Tween.h @@ -27,11 +27,13 @@ public: Tween(TweenProperty name, TweenAlgorithm type, double start, double end, double duration); float animate(double elapsedTime); + float animate(double elapsedTime, double startValue); static float animateSingle(TweenAlgorithm type, double start, double end, double duration, double elapsedTime); static TweenAlgorithm getTweenType(std::string name); static bool getTweenProperty(std::string name, TweenProperty &property); TweenProperty property; double duration; + bool startDefined; private: static double easeInQuadratic(double elapsedTime, double duration, double b, double c); diff --git a/RetroFE/Source/Graphics/Animate/TweenTypes.h b/RetroFE/Source/Graphics/Animate/TweenTypes.h index c9d61d6..6526099 100644 --- a/RetroFE/Source/Graphics/Animate/TweenTypes.h +++ b/RetroFE/Source/Graphics/Animate/TweenTypes.h @@ -55,4 +55,12 @@ enum TweenProperty TWEEN_PROPERTY_Y_OFFSET, TWEEN_PROPERTY_FONT_SIZE, TWEEN_PROPERTY_BACKGROUND_ALPHA, + TWEEN_PROPERTY_MAX_WIDTH, + TWEEN_PROPERTY_MAX_HEIGHT, + TWEEN_PROPERTY_LAYER, + TWEEN_PROPERTY_CONTAINER_X, + TWEEN_PROPERTY_CONTAINER_Y, + TWEEN_PROPERTY_CONTAINER_WIDTH, + TWEEN_PROPERTY_CONTAINER_HEIGHT, + TWEEN_PROPERTY_NOP, }; diff --git a/RetroFE/Source/Graphics/Component/Component.cpp b/RetroFE/Source/Graphics/Component/Component.cpp index 3b81db2..ede499b 100644 --- a/RetroFE/Source/Graphics/Component/Component.cpp +++ b/RetroFE/Source/Graphics/Component/Component.cpp @@ -22,9 +22,8 @@ Component::Component(Page &p) : page(p) { - tweens_ = NULL; - newItemSelectedSinceEnter = false; - backgroundTexture_ = NULL; + tweens_ = NULL; + backgroundTexture_ = NULL; freeGraphicsMemory(); } @@ -33,7 +32,6 @@ Component::Component(const Component ©) : page(copy.page) { tweens_ = NULL; - newItemSelectedSinceEnter = false; backgroundTexture_ = NULL; freeGraphicsMemory(); @@ -53,23 +51,16 @@ Component::~Component() void Component::freeGraphicsMemory() { - currentAnimationState = HIDDEN; - enterRequested = false; - exitRequested = false; - menuEnterRequested = false; - menuEnterIndex = -1; - menuScrollRequested = false; - menuExitRequested = false; - menuExitIndex = -1; + animationRequestedType_ = ""; + animationType_ = ""; + animationRequested_ = false; + newItemSelected = false; + menuIndex_ = -1; - newItemSelected = false; - playlistChanged = false; - highlightExitComplete = false; - currentTweens_ = NULL; - currentTweenIndex_ = 0; - currentTweenComplete_ = false; - elapsedTweenTime_ = 0; - scrollActive = false; + currentTweens_ = NULL; + currentTweenIndex_ = 0; + currentTweenComplete_ = true; + elapsedTweenTime_ = 0; if(backgroundTexture_) { @@ -98,244 +89,73 @@ void Component::allocateGraphicsMemory() } } -void Component::triggerEnterEvent() +void Component::triggerEvent(std::string event, int menuIndex) { - enterRequested = true; + animationRequestedType_ = event; + animationRequested_ = true; + menuIndex_ = menuIndex; } -void Component::triggerExitEvent() +void Component::setPlaylist(std::string name) { - exitRequested = true; -} - - - -void Component::triggerMenuEnterEvent(int menuIndex) -{ - menuEnterRequested = true; - menuEnterIndex = menuIndex; -} - -void Component::triggerMenuScrollEvent() -{ - menuScrollRequested = true; -} - - -void Component::triggerMenuExitEvent(int menuIndex) -{ - menuExitRequested = true; - menuExitIndex = menuIndex; -} -void Component::triggerHighlightEvent() -{ - newItemSelected = true; -} - -void Component::triggerPlaylistChangeEvent(std::string name) -{ - playlistChanged = true; this->playlistName = name; } +void Component::setNewItemSelected() +{ + newItemSelected = true; +} + bool Component::isIdle() { - return (currentAnimationState == IDLE); -} - -bool Component::isHidden() -{ - return (currentAnimationState == HIDDEN); -} -bool Component::isWaiting() -{ - return (currentAnimationState == HIGHLIGHT_WAIT); + return (currentTweenComplete_ || animationType_ == "idle"); } bool Component::isMenuScrolling() { - return (currentAnimationState == MENU_ENTER || currentAnimationState == MENU_SCROLL || currentAnimationState == MENU_EXIT || menuScrollRequested); + return (!currentTweenComplete_ && animationType_ == "menuScroll"); } void Component::setTweens(AnimationEvents *set) { tweens_ = set; - forceIdle(); } -void Component::forceIdle() -{ - currentAnimationState = IDLE; - currentTweenIndex_ = 0; - currentTweenComplete_ = false; - elapsedTweenTime_ = 0; - currentTweens_ = NULL; -} - - void Component::update(float dt) { elapsedTweenTime_ += dt; - highlightExitComplete = false; - if(isHidden() || isWaiting() || (isIdle() && exitRequested)) + + if(animationRequested_ && animationRequestedType_ != "") { - currentTweenComplete_ = true; + Animation *newTweens = tweens_->getAnimation( animationRequestedType_, menuIndex_ ); + if (newTweens && newTweens->size() > 0) + { + animationType_ = animationRequestedType_; + currentTweens_ = newTweens; + currentTweenIndex_ = 0; + elapsedTweenTime_ = 0; + storeViewInfo_ = baseViewInfo; + currentTweenComplete_ = false; + } + animationRequested_ = false; + } + else if (tweens_ && currentTweenComplete_) + { + animationType_ = "idle"; + currentTweens_ = tweens_->getAnimation( "idle", menuIndex_ ); + currentTweenIndex_ = 0; + elapsedTweenTime_ = 0; + storeViewInfo_ = baseViewInfo; + currentTweenComplete_ = false; + animationRequested_ = false; } + currentTweenComplete_ = animate(); if(currentTweenComplete_) { - currentTweens_ = NULL; - - // There was no request to override our state path. Continue on as normal. - std::stringstream ss; - switch(currentAnimationState) - { - case MENU_ENTER: - currentTweens_ = NULL; - currentAnimationState = IDLE; - break; - - case MENU_SCROLL: - currentTweens_ = NULL; - currentAnimationState = IDLE; - break; - - case MENU_EXIT: - currentTweens_ = NULL; - currentAnimationState = IDLE; - break; - - - case ENTER: - currentTweens_ = tweens_->getAnimation("enter", menuEnterIndex); - currentAnimationState = HIGHLIGHT_ENTER; - break; - - case EXIT: - currentTweens_ = NULL; - currentAnimationState = HIDDEN; - break; - - case HIGHLIGHT_ENTER: - currentTweens_ = tweens_->getAnimation("idle", menuEnterIndex); - currentAnimationState = IDLE; - break; - - case IDLE: - // prevent us from automatically jumping to the exit tween upon enter - if(enterRequested) - { - enterRequested = false; - newItemSelected = false; - } - else if(menuExitRequested && (!menuEnterRequested || menuExitRequested <= menuEnterRequested)) - { - currentTweens_ = tweens_->getAnimation("menuExit", menuExitIndex); - currentAnimationState = MENU_EXIT; - menuExitRequested = false; - } - else if(menuEnterRequested && (!menuExitRequested || menuExitRequested > menuEnterRequested)) - { - currentTweens_ = tweens_->getAnimation("menuEnter", menuEnterIndex); - currentAnimationState = MENU_ENTER; - menuEnterRequested = false; - - } - else if(menuScrollRequested) - { - menuScrollRequested = false; - currentTweens_ = tweens_->getAnimation("menuScroll", menuEnterIndex); - currentAnimationState = MENU_SCROLL; - } - else if(scrollActive || newItemSelected || exitRequested) - { - currentTweens_ = tweens_->getAnimation("highlightExit", menuEnterIndex); - currentAnimationState = HIGHLIGHT_EXIT; - } - else - { - currentTweens_ = tweens_->getAnimation("idle", menuEnterIndex); - currentAnimationState = IDLE; - } - break; - - case HIGHLIGHT_EXIT: - - // intentionally break down - case HIGHLIGHT_WAIT: - - if(exitRequested && (currentAnimationState == HIGHLIGHT_WAIT)) - { - currentTweens_ = tweens_->getAnimation("highlightExit", menuEnterIndex); - currentAnimationState = HIGHLIGHT_EXIT; - - } - else if(exitRequested && (currentAnimationState == HIGHLIGHT_EXIT)) - { - - currentTweens_ = tweens_->getAnimation("exit", menuEnterIndex); - currentAnimationState = EXIT; - exitRequested = false; - } - else if(scrollActive) - { - currentTweens_ = NULL; - currentAnimationState = HIGHLIGHT_WAIT; - } - else if(newItemSelected) - { - currentTweens_ = tweens_->getAnimation("highlightEnter", menuEnterIndex); - currentAnimationState = HIGHLIGHT_ENTER; - highlightExitComplete = true; - newItemSelected = false; - } - else - { - currentTweens_ = NULL; - currentAnimationState = HIGHLIGHT_WAIT; - } - break; - - case HIDDEN: - if(enterRequested || exitRequested) - { - currentTweens_ = tweens_->getAnimation("enter", menuEnterIndex); - currentAnimationState = ENTER; - } - - else if(menuExitRequested && (!menuEnterRequested || menuExitRequested <= menuEnterRequested)) - { - currentTweens_ = tweens_->getAnimation("menuExit", menuExitIndex); - currentAnimationState = MENU_EXIT; - menuExitRequested = false; - } - else if(menuEnterRequested && (!menuExitRequested || menuExitRequested > menuEnterRequested)) - { - currentTweens_ = tweens_->getAnimation("menuEnter", menuEnterIndex); - currentAnimationState = MENU_ENTER; - menuEnterRequested = false; - - } - else if(menuScrollRequested) - { - menuScrollRequested = false; - currentTweens_ = tweens_->getAnimation("menuScroll", menuEnterIndex); - currentAnimationState = MENU_SCROLL; - } - else - { - currentTweens_ = NULL; - currentAnimationState = HIDDEN; - } - } - - currentTweenIndex_ = 0; - currentTweenComplete_ = false; - - elapsedTweenTime_ = 0; + currentTweens_ = NULL; + currentTweenIndex_ = 0; } - - currentTweenComplete_ = animate(isIdle()); } void Component::draw() @@ -355,11 +175,11 @@ void Component::draw() static_cast(baseViewInfo.BackgroundGreen*255), static_cast(baseViewInfo.BackgroundBlue*255)); - SDL::renderCopy(backgroundTexture_, static_cast(baseViewInfo.BackgroundAlpha*255), NULL, &rect, baseViewInfo.Angle); + SDL::renderCopy(backgroundTexture_, baseViewInfo.BackgroundAlpha, NULL, &rect, baseViewInfo); } } -bool Component::animate(bool loop) +bool Component::animate() { bool completeDone = false; if(!currentTweens_ || currentTweenIndex_ >= currentTweens_->size()) @@ -378,64 +198,146 @@ bool Component::animate(bool loop) //todo: too many levels of nesting if(elapsedTime < tween->duration) - { currentDone = false; - } else - { elapsedTime = static_cast(tween->duration); - } - - float value = tween->animate(elapsedTime); switch(tween->property) { case TWEEN_PROPERTY_X: - baseViewInfo.X = value; + if (tween->startDefined) + baseViewInfo.X = tween->animate(elapsedTime); + else + baseViewInfo.X = tween->animate(elapsedTime, storeViewInfo_.X); break; case TWEEN_PROPERTY_Y: - baseViewInfo.Y = value; + if (tween->startDefined) + baseViewInfo.Y = tween->animate(elapsedTime); + else + baseViewInfo.Y = tween->animate(elapsedTime, storeViewInfo_.Y); break; case TWEEN_PROPERTY_HEIGHT: - baseViewInfo.Height = value; + if (tween->startDefined) + baseViewInfo.Height = tween->animate(elapsedTime); + else + baseViewInfo.Height = tween->animate(elapsedTime, storeViewInfo_.Height); break; case TWEEN_PROPERTY_WIDTH: - baseViewInfo.Width = value; + if (tween->startDefined) + baseViewInfo.Width = tween->animate(elapsedTime); + else + baseViewInfo.Width = tween->animate(elapsedTime, storeViewInfo_.Width); break; case TWEEN_PROPERTY_ANGLE: - baseViewInfo.Angle = value; + if (tween->startDefined) + baseViewInfo.Angle = tween->animate(elapsedTime); + else + baseViewInfo.Angle = tween->animate(elapsedTime, storeViewInfo_.Angle); break; case TWEEN_PROPERTY_ALPHA: - baseViewInfo.Alpha = value; + if (tween->startDefined) + baseViewInfo.Alpha = tween->animate(elapsedTime); + else + baseViewInfo.Alpha = tween->animate(elapsedTime, storeViewInfo_.Alpha); break; case TWEEN_PROPERTY_X_ORIGIN: - baseViewInfo.XOrigin = value; + if (tween->startDefined) + baseViewInfo.XOrigin = tween->animate(elapsedTime); + else + baseViewInfo.XOrigin = tween->animate(elapsedTime, storeViewInfo_.XOrigin); break; case TWEEN_PROPERTY_Y_ORIGIN: - baseViewInfo.YOrigin = value; + if (tween->startDefined) + baseViewInfo.YOrigin = tween->animate(elapsedTime); + else + baseViewInfo.YOrigin = tween->animate(elapsedTime, storeViewInfo_.YOrigin); break; case TWEEN_PROPERTY_X_OFFSET: - baseViewInfo.XOffset = value; + if (tween->startDefined) + baseViewInfo.XOffset = tween->animate(elapsedTime); + else + baseViewInfo.XOffset = tween->animate(elapsedTime, storeViewInfo_.XOffset); break; case TWEEN_PROPERTY_Y_OFFSET: - baseViewInfo.YOffset = value; + if (tween->startDefined) + baseViewInfo.YOffset = tween->animate(elapsedTime); + else + baseViewInfo.YOffset = tween->animate(elapsedTime, storeViewInfo_.YOffset); break; case TWEEN_PROPERTY_FONT_SIZE: - baseViewInfo.FontSize = value; + if (tween->startDefined) + baseViewInfo.FontSize = tween->animate(elapsedTime); + else + baseViewInfo.FontSize = tween->animate(elapsedTime, storeViewInfo_.FontSize); break; case TWEEN_PROPERTY_BACKGROUND_ALPHA: - baseViewInfo.BackgroundAlpha = value; + if (tween->startDefined) + baseViewInfo.BackgroundAlpha = tween->animate(elapsedTime); + else + baseViewInfo.BackgroundAlpha = tween->animate(elapsedTime, storeViewInfo_.BackgroundAlpha); + break; + + case TWEEN_PROPERTY_MAX_WIDTH: + if (tween->startDefined) + baseViewInfo.MaxWidth = tween->animate(elapsedTime); + else + baseViewInfo.MaxWidth = tween->animate(elapsedTime, storeViewInfo_.MaxWidth); + break; + + case TWEEN_PROPERTY_MAX_HEIGHT: + if (tween->startDefined) + baseViewInfo.MaxHeight = tween->animate(elapsedTime); + else + baseViewInfo.MaxHeight = tween->animate(elapsedTime, storeViewInfo_.MaxHeight); + break; + + case TWEEN_PROPERTY_LAYER: + if (tween->startDefined) + baseViewInfo.Layer = static_cast(tween->animate(elapsedTime)); + else + baseViewInfo.Layer = static_cast(tween->animate(elapsedTime, storeViewInfo_.Layer)); + break; + + case TWEEN_PROPERTY_CONTAINER_X: + if (tween->startDefined) + baseViewInfo.ContainerX = tween->animate(elapsedTime); + else + baseViewInfo.ContainerX = tween->animate(elapsedTime, storeViewInfo_.ContainerX); + break; + + case TWEEN_PROPERTY_CONTAINER_Y: + if (tween->startDefined) + baseViewInfo.ContainerY = tween->animate(elapsedTime); + else + baseViewInfo.ContainerY = tween->animate(elapsedTime, storeViewInfo_.ContainerY); + break; + + case TWEEN_PROPERTY_CONTAINER_WIDTH: + if (tween->startDefined) + baseViewInfo.ContainerWidth = tween->animate(elapsedTime); + else + baseViewInfo.ContainerWidth = tween->animate(elapsedTime, storeViewInfo_.ContainerWidth); + break; + + case TWEEN_PROPERTY_CONTAINER_HEIGHT: + if (tween->startDefined) + baseViewInfo.ContainerHeight = tween->animate(elapsedTime); + else + baseViewInfo.ContainerHeight = tween->animate(elapsedTime, storeViewInfo_.ContainerHeight); + break; + + case TWEEN_PROPERTY_NOP: break; } } @@ -444,17 +346,20 @@ bool Component::animate(bool loop) { currentTweenIndex_++; elapsedTweenTime_ = 0; + storeViewInfo_ = baseViewInfo; } } if(!currentTweens_ || currentTweenIndex_ >= currentTweens_->tweenSets()->size()) { - if(loop) - { - currentTweenIndex_ = 0; - } completeDone = true; } return completeDone; } + + +bool Component::isPlaying() +{ + return false; +} diff --git a/RetroFE/Source/Graphics/Component/Component.h b/RetroFE/Source/Graphics/Component/Component.h index 495961e..a2d8c79 100644 --- a/RetroFE/Source/Graphics/Component/Component.h +++ b/RetroFE/Source/Graphics/Component/Component.h @@ -18,7 +18,6 @@ #include #include "../../SDL.h" -#include "../MenuNotifierInterface.h" #include "../Page.h" #include "../ViewInfo.h" #include "../Animate/Tween.h" @@ -34,66 +33,39 @@ public: virtual void allocateGraphicsMemory(); virtual void launchEnter() {} virtual void launchExit() {} - void triggerEnterEvent(); - void triggerExitEvent(); - void triggerMenuEnterEvent(int menuIndex = -1); - void triggerMenuExitEvent(int menuIndex = -1); - void triggerMenuScrollEvent(); - void triggerHighlightEvent(); - void triggerPlaylistChangeEvent(std::string name); + void triggerEvent(std::string event, int menuIndex = -1); + void setPlaylist(std::string name ); + void setNewItemSelected(); bool isIdle(); - bool isHidden(); - bool isWaiting(); bool isMenuScrolling(); + bool newItemSelected; virtual void update(float dt); virtual void draw(); void setTweens(AnimationEvents *set); - void forceIdle(); + virtual bool isPlaying(); ViewInfo baseViewInfo; std::string collectionName; - bool scrollActive; protected: Page &page; - enum AnimationState - { - IDLE, - ENTER, - HIGHLIGHT_EXIT, - HIGHLIGHT_WAIT, - HIGHLIGHT_ENTER, - EXIT, - MENU_ENTER, - MENU_SCROLL, - MENU_EXIT, - HIDDEN - }; - - AnimationState currentAnimationState; - bool enterRequested; - bool exitRequested; - bool menuEnterRequested; - int menuEnterIndex; - bool menuScrollRequested; - bool menuExitRequested; - int menuExitIndex; - bool newItemSelected; - bool playlistChanged; std::string playlistName; - bool highlightExitComplete; - bool newItemSelectedSinceEnter; private: - bool animate(bool loop); + bool animate(); bool tweenSequencingComplete(); AnimationEvents *tweens_; Animation *currentTweens_; SDL_Texture *backgroundTexture_; + ViewInfo storeViewInfo_; unsigned int currentTweenIndex_; - bool currentTweenComplete_; - float elapsedTweenTime_; + bool currentTweenComplete_; + float elapsedTweenTime_; + std::string animationRequestedType_; + std::string animationType_; + bool animationRequested_; + int menuIndex_; }; diff --git a/RetroFE/Source/Graphics/Component/Image.cpp b/RetroFE/Source/Graphics/Component/Image.cpp index d13de5b..b077e90 100644 --- a/RetroFE/Source/Graphics/Component/Image.cpp +++ b/RetroFE/Source/Graphics/Component/Image.cpp @@ -19,10 +19,11 @@ #include "../../Utility/Log.h" #include -Image::Image(std::string file, Page &p, float scaleX, float scaleY) +Image::Image(std::string file, std::string altFile, Page &p, float scaleX, float scaleY) : Component(p) , texture_(NULL) , file_(file) + , altFile_(altFile) , scaleX_(scaleX) , scaleY_(scaleY) { @@ -58,6 +59,10 @@ void Image::allocateGraphicsMemory() { SDL_LockMutex(SDL::getMutex()); texture_ = IMG_LoadTexture(SDL::getRenderer(), file_.c_str()); + if (!texture_ && altFile_ != "") + { + texture_ = IMG_LoadTexture(SDL::getRenderer(), altFile_.c_str()); + } if (texture_ != NULL) { @@ -84,6 +89,6 @@ void Image::draw() rect.h = static_cast(baseViewInfo.ScaledHeight()); rect.w = static_cast(baseViewInfo.ScaledWidth()); - SDL::renderCopy(texture_, static_cast((baseViewInfo.Alpha * 255)), NULL, &rect, baseViewInfo.Angle); + SDL::renderCopy(texture_, baseViewInfo.Alpha, NULL, &rect, baseViewInfo); } } diff --git a/RetroFE/Source/Graphics/Component/Image.h b/RetroFE/Source/Graphics/Component/Image.h index 6dd5ff3..6a1da3f 100644 --- a/RetroFE/Source/Graphics/Component/Image.h +++ b/RetroFE/Source/Graphics/Component/Image.h @@ -22,7 +22,7 @@ class Image : public Component { public: - Image(std::string file, Page &p, float scaleX, float scaleY); + Image(std::string file, std::string altFile, Page &p, float scaleX, float scaleY); virtual ~Image(); void freeGraphicsMemory(); void allocateGraphicsMemory(); @@ -31,6 +31,7 @@ public: protected: SDL_Texture *texture_; std::string file_; + std::string altFile_; float scaleX_; float scaleY_; }; diff --git a/RetroFE/Source/Graphics/Component/ImageBuilder.cpp b/RetroFE/Source/Graphics/Component/ImageBuilder.cpp index 8da2923..5008273 100644 --- a/RetroFE/Source/Graphics/Component/ImageBuilder.cpp +++ b/RetroFE/Source/Graphics/Component/ImageBuilder.cpp @@ -35,7 +35,7 @@ Image * ImageBuilder::CreateImage(std::string path, Page &p, std::string name, f if(Utils::findMatchingFile(prefix, extensions, file)) { - image = new Image(file, p, scaleX, scaleY); + image = new Image(file, "", p, scaleX, scaleY); } return image; diff --git a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp index e927835..dd47f4c 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp @@ -28,13 +28,13 @@ #include #include -ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, std::string type, Page &p, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY) +ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, bool commonMode, std::string type, Page &p, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY) : Component(p) , config_(config) , systemMode_(systemMode) + , layoutMode_(layoutMode) + , commonMode_(commonMode) , loadedComponent_(NULL) - , reloadRequested_(false) - , firstLoad_(true) , videoInst_(NULL) , isVideo_(isVideo) , FfntInst_(font) @@ -63,23 +63,11 @@ void ReloadableMedia::enableTextFallback_(bool value) void ReloadableMedia::update(float dt) { - if(newItemSelected) - { - std::string collection; - config_.getProperty("currentCollection", collection); - - if(!systemMode_ || (systemMode_ && currentCollection_ != collection)) - { - reloadRequested_ = true; - } - } - // wait for the right moment to reload the image - if (reloadRequested_ && (highlightExitComplete || firstLoad_)) + if (newItemSelected) { reloadTexture(); - reloadRequested_ = false; - firstLoad_ = false; + newItemSelected = false; } if(loadedComponent_) @@ -102,8 +90,6 @@ void ReloadableMedia::update(float dt) void ReloadableMedia::allocateGraphicsMemory() { - firstLoad_ = true; - if(loadedComponent_) { loadedComponent_->allocateGraphicsMemory(); @@ -158,6 +144,7 @@ void ReloadableMedia::reloadTexture() names.push_back(selectedItem->name); names.push_back(selectedItem->fullTitle); + names.push_back("default"); if(selectedItem->cloneof.length() > 0) { @@ -237,11 +224,11 @@ void ReloadableMedia::reloadTexture() std::string typeLC = Utils::toLower(type_); - if(typeLC == "numberButtons") + if(typeLC == "numberbuttons") { basename = selectedItem->numberButtons; } - else if(typeLC == "numberPlayers") + else if(typeLC == "numberplayers") { basename = selectedItem->numberPlayers; } @@ -253,6 +240,15 @@ void ReloadableMedia::reloadTexture() { basename = selectedItem->title; } + else if(typeLC == "developer") + { + basename = selectedItem->developer; + // Overwrite in case developer has not been specified + if (basename == "") + { + basename = selectedItem->manufacturer; + } + } else if(typeLC == "manufacturer") { if ( selectedItem->leaf ) // item is a leaf @@ -264,6 +260,22 @@ void ReloadableMedia::reloadTexture() { basename = selectedItem->genre; } + else if(typeLC == "ctrltype") + { + basename = selectedItem->ctrlType; + } + else if(typeLC == "joyways") + { + basename = selectedItem->joyWays; + } + else if(typeLC == "rating") + { + basename = selectedItem->rating; + } + else if(typeLC == "score") + { + basename = selectedItem->score; + } Utils::replaceSlashesWithUnderscores(basename); @@ -345,7 +357,38 @@ Component *ReloadableMedia::findComponent(std::string collection, std::string ty ImageBuilder imageBuild; // check the system folder - config_.getMediaPropertyAbsolutePath(collection, type, systemMode, imagePath); + if (layoutMode_) + { + std::string layoutName; + config_.getProperty("layout", layoutName); + if (commonMode_) + { + imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", "_common"); + } + else + { + imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collection); + } + if (systemMode) + imagePath = Utils::combinePath(imagePath, "system_artwork"); + else + imagePath = Utils::combinePath(imagePath, "medium_artwork", type); + } + else + { + if (commonMode_) + { + imagePath = Utils::combinePath(Configuration::absolutePath, "collections", "_common" ); + if (systemMode) + imagePath = Utils::combinePath(imagePath, "system_artwork"); + else + imagePath = Utils::combinePath(imagePath, "medium_artwork", type); + } + else + { + config_.getMediaPropertyAbsolutePath(collection, type, systemMode, imagePath); + } + } if(type == "video") { diff --git a/RetroFE/Source/Graphics/Component/ReloadableMedia.h b/RetroFE/Source/Graphics/Component/ReloadableMedia.h index 2f5683d..47bd789 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableMedia.h +++ b/RetroFE/Source/Graphics/Component/ReloadableMedia.h @@ -27,7 +27,7 @@ class Image; class ReloadableMedia : public Component { public: - ReloadableMedia(Configuration &config, bool systemMode, std::string type, Page &page, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY); + ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, bool commonMode, std::string type, Page &page, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY); virtual ~ReloadableMedia(); void update(float dt); void draw(); @@ -43,9 +43,9 @@ private: void reloadTexture(); Configuration &config_; bool systemMode_; + bool layoutMode_; + bool commonMode_; Component *loadedComponent_; - bool reloadRequested_; - bool firstLoad_; IVideo *videoInst_; bool isVideo_; Font *FfntInst_; diff --git a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp new file mode 100644 index 0000000..55297a7 --- /dev/null +++ b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp @@ -0,0 +1,606 @@ +/* This file is part of RetroFE. + * + * RetroFE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * RetroFE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RetroFE. If not, see . + */ + +#include "ReloadableScrollingText.h" +#include "../ViewInfo.h" +#include "../../Database/Configuration.h" +#include "../../Utility/Log.h" +#include "../../Utility/Utils.h" +#include "../../SDL.h" +#include "../Font.h" +#include +#include +#include +#include +#include + + +ReloadableScrollingText::ReloadableScrollingText(Configuration &config, bool systemMode, bool layoutMode, std::string type, std::string textFormat, std::string alignment, Page &p, int displayOffset, Font *font, float scaleX, float scaleY, std::string direction, float scrollingSpeed, float startPosition, float startTime, float endTime ) + : Component(p) + , config_(config) + , systemMode_(systemMode) + , layoutMode_(layoutMode) + , fontInst_(font) + , type_(type) + , textFormat_(textFormat) + , alignment_(alignment) + , scaleX_(scaleX) + , scaleY_(scaleY) + , direction_(direction) + , scrollingSpeed_(scrollingSpeed) + , startPosition_(startPosition) + , currentPosition_(-startPosition) + , startTime_(startTime) + , waitStartTime_(startTime) + , endTime_(endTime) + , waitEndTime_(0.0f) + , currentCollection_("") + , page_(NULL) + , displayOffset_(displayOffset) + +{ + text_.clear( ); +} + + +ReloadableScrollingText::~ReloadableScrollingText( ) +{ +} + + +void ReloadableScrollingText::update(float dt) +{ + + if (waitEndTime_ > 0) + { + waitEndTime_ -= dt; + } + else if (waitStartTime_ > 0) + { + waitStartTime_ -= dt; + } + else + { + if (direction_ == "horizontal") + { + currentPosition_ += scrollingSpeed_ * dt * scaleX_; + } + else if (direction_ == "vertical") + { + currentPosition_ += scrollingSpeed_ * dt * scaleY_; + } + } + + if (newItemSelected) + { + reloadTexture( ); + newItemSelected = false; + } + + Component::update(dt); +} + + +void ReloadableScrollingText::freeGraphicsMemory( ) +{ + Component::freeGraphicsMemory( ); + text_.clear( ); +} + + +void ReloadableScrollingText::reloadTexture( ) +{ + + if (direction_ == "horizontal") + { + currentPosition_ = -startPosition_ * scaleX_; + } + else if (direction_ == "vertical") + { + currentPosition_ = -startPosition_ * scaleY_; + } + waitStartTime_ = startTime_; + waitEndTime_ = 0.0f; + + text_.clear( ); + + Item *selectedItem = page.getSelectedItem( displayOffset_ ); + if (!selectedItem) + { + return; + } + + config_.getProperty( "currentCollection", currentCollection_ ); + + // build clone list + std::vector names; + + names.push_back( selectedItem->name ); + names.push_back( selectedItem->fullTitle ); + + if (selectedItem->cloneof.length( ) > 0) + { + names.push_back( selectedItem->cloneof ); + } + + // Check for corresponding .txt files + for (unsigned int n = 0; n < names.size( ) && text_.empty( ); ++n) + { + + std::string basename = names[n]; + + Utils::replaceSlashesWithUnderscores( basename ); + + if (systemMode_) + { + + // check the master collection for the system artifact + loadText( collectionName, type_, type_, true ); + + // check collection for the system artifact + if (text_.empty( )) + { + loadText( selectedItem->collectionInfo->name, type_, type_, true ); + } + + } + else + { + + // are we looking at a leaf or a submenu + if (selectedItem->leaf) // item is a leaf + { + + // check the master collection for the artifact + loadText( collectionName, type_, basename, false ); + + // check the collection for the artifact + if (text_.empty( )) + { + loadText( selectedItem->collectionInfo->name, type_, basename, false ); + } + + } + else // item is a submenu + { + + // check the master collection for the artifact + loadText( collectionName, type_, basename, false ); + + // check the collection for the artifact + if (text_.empty( )) + { + loadText( selectedItem->collectionInfo->name, type_, basename, false ); + } + + // check the submenu collection for the system artifact + if (text_.empty( )) + { + loadText( selectedItem->name, type_, type_, true ); + } + + } + + } + } + +} + + +void ReloadableScrollingText::loadText( std::string collection, std::string type, std::string basename, bool systemMode ) +{ + + std::string textPath = ""; + + // check the system folder + if (layoutMode_) + { + std::string layoutName; + config_.getProperty("layout", layoutName); + textPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collection); + if (systemMode) + textPath = Utils::combinePath(textPath, "system_artwork"); + else + textPath = Utils::combinePath(textPath, "medium_artwork", type); + } + else + { + config_.getMediaPropertyAbsolutePath( collection, type, systemMode, textPath ); + } + + textPath = Utils::combinePath( textPath, basename ); + + textPath += ".txt"; + + std::ifstream includeStream( textPath.c_str( ) ); + + if (!includeStream.good( )) + { + return; + } + + std::string line; + + while(std::getline(includeStream, line)) + { + + // In horizontal scrolling direction, add a space before every line except the first. + if (direction_ == "horizontal" && !text_.empty( )) + { + line = " " + line; + } + + // Reformat lines to uppercase or lowercase + if (textFormat_ == "uppercase") + { + std::transform(line.begin(), line.end(), line.begin(), ::toupper); + } + if (textFormat_ == "lowercase") + { + std::transform(line.begin(), line.end(), line.begin(), ::tolower); + } + + text_.push_back( line ); + + } + + return; + +} + + +void ReloadableScrollingText::draw( ) +{ + Component::draw( ); + + if (!text_.empty( ) && waitEndTime_ <= 0.0f) + { + + Font *font; + if (baseViewInfo.font) // Use font of this specific item if available + font = baseViewInfo.font; + else // If not, use the general font settings + font = fontInst_; + + SDL_Texture *t = font->getTexture( ); + + float imageWidth = 0; + float imageMaxWidth = 0; + float imageMaxHeight = 0; + if (baseViewInfo.Width < baseViewInfo.MaxWidth && baseViewInfo.Width > 0) + { + imageMaxWidth = baseViewInfo.Width; + } + else + { + imageMaxWidth = baseViewInfo.MaxWidth; + } + if (baseViewInfo.Height < baseViewInfo.MaxHeight && baseViewInfo.Height > 0) + { + imageMaxHeight = baseViewInfo.Height; + } + else + { + imageMaxHeight = baseViewInfo.MaxHeight; + } + + float scale = (float)baseViewInfo.FontSize / (float)font->getHeight( ) / scaleY_; + + float xOrigin = baseViewInfo.XRelativeToOrigin( ); + float yOrigin = baseViewInfo.YRelativeToOrigin( ); + + SDL_Rect rect; + + float position = 0.0f; + + if (direction_ == "horizontal") + { + + rect.x = static_cast( xOrigin ); + + if (currentPosition_ < 0) + { + rect.x -= static_cast( currentPosition_ ); + } + + for (unsigned int l = 0; l < text_.size( ); ++l) + { + for (unsigned int i = 0; i < text_[l].size( ); ++i) + { + + // Do not print outside the box + if (rect.x >= (static_cast( xOrigin ) + imageMaxWidth)) + { + break; + } + + Font::GlyphInfo glyph; + + if (font->getRect( text_[l][i], glyph) && glyph.rect.h > 0) + { + SDL_Rect charRect = glyph.rect; + rect.h = static_cast( charRect.h * scale * scaleY_ ); + rect.w = static_cast( charRect.w * scale * scaleX_ ); + rect.y = static_cast( yOrigin ); + + if (font->getAscent( ) < glyph.maxY) + { + rect.y += static_cast( (font->getAscent( ) - glyph.maxY) * scale * scaleY_ ); + } + + // Check if glyph falls partially outside the box at the back end + if ((rect.x + static_cast( glyph.advance * scale * scaleX_ )) >= (static_cast( xOrigin ) + imageMaxWidth)) + { + rect.w = static_cast( xOrigin ) + static_cast( imageMaxWidth ) - rect.x; + charRect.w = static_cast( rect.w / scale / scaleX_ ); + } + + // Print the glyph if it falls (partially) within the box + if ( position + glyph.advance * scale * scaleX_ > currentPosition_ ) + { + // Check if glyph falls partially outside the box at the front end + if ( position < currentPosition_ ) + { + rect.w = static_cast( glyph.advance * scale * scaleX_ + position - currentPosition_ ); + charRect.x = static_cast( charRect.x + charRect.w - rect.w / scale / scaleX_ ); + charRect.w = static_cast( rect.w / scale / scaleX_ ); + } + if (rect.w > 0) + { + SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo); + } + rect.x += rect.w; + } + position += glyph.advance * scale * scaleX_; + + } + } + } + + // Determine image width + for (unsigned int l = 0; l < text_.size( ); ++l) + { + for (unsigned int i = 0; i < text_[l].size( ); ++i) + { + Font::GlyphInfo glyph; + if (font->getRect( text_[l][i], glyph )) + { + imageWidth += glyph.advance; + } + } + } + + // Reset scrolling position when we're done + if (currentPosition_ > imageWidth * scale * scaleX_) + { + waitStartTime_ = startTime_; + waitEndTime_ = endTime_; + currentPosition_ = -startPosition_ * scaleX_; + } + + } + else if (direction_ == "vertical") + { + + unsigned int spaceWidth = 0; + { + Font::GlyphInfo glyph; + if (font->getRect( ' ', glyph) ) + { + spaceWidth = static_cast( glyph.advance * scale * scaleX_); + } + } + + // Reformat the text based on the image width + std::vector text; + std::vector textWords; + std::vector textWidth; + std::vector textLast; + for (unsigned int l = 0; l < text_.size( ); ++l) + { + std::string line = ""; + std::istringstream iss(text_[l]); + std::string word; + unsigned int width = 0; + unsigned int lineWidth = 0; + unsigned int wordCount = 0; + while (iss >> word) + { + + // Determine word image width + unsigned int wordWidth = 0; + for (unsigned int i = 0; i < word.size( ); ++i) + { + Font::GlyphInfo glyph; + if (font->getRect( word[i], glyph) ) + { + wordWidth += static_cast( glyph.advance * scale * scaleX_ ); + } + } + // Determine if the word will fit on the line + if (width > 0 && (width + spaceWidth + wordWidth > imageMaxWidth)) + { + text.push_back( line ); + textWords.push_back( wordCount ); + textWidth.push_back( lineWidth ); + textLast.push_back( false ); + line = word; + width = wordWidth; + lineWidth = wordWidth; + wordCount = 1; + } + else + { + if (width == 0) + { + line += word; + width += wordWidth; + } + else + { + line += " " + word; + width += spaceWidth + wordWidth; + } + lineWidth += wordWidth; + wordCount += 1; + } + } + if (text_[l] == "" || line != "") + { + text.push_back( line ); + textWords.push_back( wordCount ); + textWidth.push_back( lineWidth ); + textLast.push_back( true ); + width = 0; + lineWidth = 0; + wordCount = 0; + } + } + + + // Print reformatted text + rect.y = static_cast( yOrigin ); + + if (currentPosition_ < 0) + { + rect.y -= static_cast( currentPosition_ ); + } + + // Do not scroll if the text fits fully inside the box, and start position is 0 + if (text.size() * font->getHeight( ) * scale * scaleY_ <= imageMaxHeight && startPosition_ == 0.0f) + { + currentPosition_ = 0.0f; + waitStartTime_ = 0.0f; + waitEndTime_ = 0.0f; + } + + for (unsigned int l = 0; l < text.size( ); ++l) + { + + // Do not print outside the box + if (rect.y >= (static_cast( yOrigin ) + imageMaxHeight)) + { + break; + } + + // Define x coordinate + rect.x = static_cast( xOrigin ); + if (alignment_ == "right") + { + rect.x = static_cast( xOrigin + imageMaxWidth - textWidth[l] - (textWords[l] - 1) * spaceWidth * scale * scaleX_ ); + } + if (alignment_ == "centered") + { + rect.x = static_cast( xOrigin + imageMaxWidth / 2 - textWidth[l] / 2 - (textWords[l] - 1) * spaceWidth * scale * scaleX_ / 2 ); + } + + std::istringstream iss(text[l]); + std::string word; + unsigned int wordCount = textWords[l]; + unsigned int spaceFill = static_cast( imageMaxWidth ) - textWidth[l]; + unsigned int yAdvance = static_cast( font->getHeight( ) * scale * scaleY_ ); + while (iss >> word) + { + + for (unsigned int i = 0; i < word.size( ); ++i) + { + Font::GlyphInfo glyph; + + if (font->getRect( word[i], glyph) && glyph.rect.h > 0) + { + SDL_Rect charRect = glyph.rect; + rect.h = static_cast( charRect.h * scale * scaleY_ ); + rect.w = static_cast( charRect.w * scale * scaleX_ ); + yAdvance = static_cast( font->getHeight( ) * scale * scaleY_ ); + + // Check if glyph falls partially outside the box at the bottom end + if ((rect.y + rect.h) >= (static_cast( yOrigin ) + imageMaxHeight)) + { + rect.h = static_cast( yOrigin ) + static_cast( imageMaxHeight ) - rect.y; + charRect.h = static_cast( rect.h / scale / scaleY_ ); + } + + // Print the glyph if it falls (partially) within the box + if ( position + font->getHeight( ) * scale * scaleY_ > currentPosition_ ) + { + // Check if glyph falls partially outside the box at the front end + if ( position < currentPosition_ ) + { + yAdvance -= rect.h - static_cast( font->getHeight( ) * scale * scaleX_ + position - currentPosition_ ); + rect.h = static_cast( font->getHeight( ) * scale * scaleX_ + position - currentPosition_ ); + charRect.y = static_cast( charRect.y + charRect.h - rect.h / scale / scaleX_ ); + charRect.h = static_cast( rect.h / scale / scaleX_ ); + } + if (rect.h > 0) + { + SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo); + } + } + rect.x += static_cast( glyph.advance * scale * scaleX_ ); + } + } + + // Print justified + wordCount -= 1; + if (wordCount > 0 && !textLast[l] && alignment_ == "justified") + { + unsigned int advance = static_cast( spaceFill / wordCount ); + spaceFill -= advance; + rect.x += advance; + } + else + { + rect.x += static_cast( spaceWidth * scale * scaleX_ ); + } + } + + // Handle scrolling of empty lines + if (text[l] == "") + { + Font::GlyphInfo glyph; + + if (font->getRect( ' ', glyph) && glyph.rect.h > 0) + { + rect.h = static_cast( glyph.rect.h * scale * scaleY_ ); + + // Check if the glyph falls (partially) within the box at the front end + if ((position + font->getHeight( ) * scale * scaleY_ > currentPosition_) && + (position < currentPosition_)) + { + yAdvance -= rect.h - static_cast( font->getHeight( ) * scale * scaleX_ + position - currentPosition_ ); + } + } + } + + if ( position + font->getHeight( ) * scale * scaleY_ > currentPosition_ ) + { + rect.y += yAdvance; + } + position += font->getHeight( ) * scale * scaleY_; + + } + + // Reset scrolling position when we're done + if (currentPosition_ > text.size( ) * font->getHeight( ) * scale * scaleX_) + { + waitStartTime_ = startTime_; + waitEndTime_ = endTime_; + currentPosition_ = -startPosition_ * scaleY_; + } + + } + } +} diff --git a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h new file mode 100644 index 0000000..7524b7a --- /dev/null +++ b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h @@ -0,0 +1,57 @@ +/* This file is part of RetroFE. + * + * RetroFE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * RetroFE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RetroFE. If not, see . + */ +#pragma once +#include "Component.h" +#include "../../Collection/Item.h" +#include +#include +#include + + +class ReloadableScrollingText : public Component +{ +public: + ReloadableScrollingText(Configuration &config, bool systemMode, bool layoutMode, std::string type, std::string textFormat, std::string alignment, Page &page, int displayOffset, Font *font, float scaleX, float scaleY, std::string direction, float scrollingSpeed, float startPosition, float startTime, float endTime ); + virtual ~ReloadableScrollingText( ); + void update(float dt); + void draw( ); + void freeGraphicsMemory( ); + +private: + void reloadTexture( ); + void loadText( std::string collection, std::string type, std::string basename, bool systemMode ); + Configuration &config_; + bool systemMode_; + bool layoutMode_; + Font *fontInst_; + std::string type_; + std::string textFormat_; + std::string alignment_; + std::vector text_; + float scaleX_; + float scaleY_; + std::string direction_; + float scrollingSpeed_; + float startPosition_; + float currentPosition_; + float startTime_; + float waitStartTime_; + float endTime_; + float waitEndTime_; + std::string currentCollection_; + Page *page_; + int displayOffset_; +}; diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.cpp b/RetroFE/Source/Graphics/Component/ReloadableText.cpp index 36997d8..a5e48ad 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableText.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableText.cpp @@ -22,61 +22,25 @@ #include #include #include +#include +#include -ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, float scaleX, float scaleY) +ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY) : Component(page) , config_(config) , imageInst_(NULL) + , type_(type) , layoutKey_(layoutKey) - , reloadRequested_(false) - , firstLoad_(true) , fontInst_(font) + , timeFormat_(timeFormat) + , textFormat_(textFormat) + , singlePrefix_(singlePrefix) + , singlePostfix_(singlePostfix) + , pluralPrefix_(pluralPrefix) + , pluralPostfix_(pluralPostfix) , scaleX_(scaleX) , scaleY_(scaleY) { - - type_ = TextTypeUnknown; - - if(type == "numberButtons") - { - type_ = TextTypeNumberButtons; - } - else if(type == "numberPlayers") - { - type_ = TextTypeNumberPlayers; - } - else if(type == "year") - { - type_ = TextTypeYear; - } - else if(type == "title") - { - type_ = TextTypeTitle; - } - else if(type == "manufacturer") - { - type_ = TextTypeManufacturer; - } - else if(type == "genre") - { - type_ = TextTypeGenre; - } - else if(type == "playlist") - { - type_ = TextTypePlaylist; - } - else if(type == "collectionName") - { - type_ = TextTypeCollectionName; - } - else if(type == "collectionSize") - { - type_ = TextTypeCollectionSize; - } - else if(type == "collectionIndex") - { - type_ = TextTypeCollectionIndex; - } allocateGraphicsMemory(); } @@ -92,17 +56,10 @@ ReloadableText::~ReloadableText() void ReloadableText::update(float dt) { - if((type_ != TextTypePlaylist && newItemSelected) || - (type_ == TextTypePlaylist && playlistChanged)) - { - reloadRequested_ = true; - } - // wait for the right moment to reload the image - if (reloadRequested_ && (highlightExitComplete || firstLoad_)) + if (newItemSelected || type_ == "time") { ReloadTexture(); - reloadRequested_ = false; - firstLoad_ = false; + newItemSelected = false; } // needs to be ran at the end to prevent the NewItemSelected flag from being detected @@ -112,8 +69,6 @@ void ReloadableText::update(float dt) void ReloadableText::allocateGraphicsMemory() { - firstLoad_ = true; - ReloadTexture(); // NOTICE! needs to be done last to prevent flags from being missed @@ -151,54 +106,156 @@ void ReloadableText::ReloadTexture() if (selectedItem != NULL) { std::stringstream ss; - std::string text; - switch(type_) + std::string text = ""; + if (type_ == "time") + { + time_t now = time(0); + struct tm tstruct; + char buf[80]; + tstruct = *localtime(&now); + strftime(buf, sizeof(buf), timeFormat_.c_str(), &tstruct); + ss << buf; + } + if (type_ == "numberButtons") + { + text = selectedItem->numberButtons; + } + else if (type_ == "numberPlayers") + { + text = selectedItem->numberPlayers; + } + else if (type_ == "ctrlType") + { + text = selectedItem->ctrlType; + } + else if (type_ == "numberJoyWays") + { + text = selectedItem->joyWays; + } + else if (type_ == "rating") + { + text = selectedItem->rating; + } + else if (type_ == "score") + { + text = selectedItem->score; + } + else if (type_ == "year") { - case TextTypeNumberButtons: - ss << selectedItem->numberButtons; - break; - case TextTypeNumberPlayers: - ss << selectedItem->numberPlayers; - break; - case TextTypeYear: if (selectedItem->leaf) // item is a leaf text = selectedItem->year; else // item is a collection (void)config_.getProperty("collections." + selectedItem->name + ".year", text ); - ss << text; - break; - case TextTypeTitle: - ss << selectedItem->title; - break; - case TextTypeManufacturer: + } + else if (type_ == "title") + { + text = selectedItem->title; + } + else if(type_ == "developer") + { + text = selectedItem->developer; + // Overwrite in case developer has not been specified + if (text == "") + { + text = selectedItem->manufacturer; + } + } + else if (type_ == "manufacturer") + { if (selectedItem->leaf) // item is a leaf text = selectedItem->manufacturer; else // item is a collection (void)config_.getProperty("collections." + selectedItem->name + ".manufacturer", text ); - ss << text; - break; - case TextTypeGenre: + } + else if (type_ == "genre") + { if (selectedItem->leaf) // item is a leaf text = selectedItem->genre; else // item is a collection (void)config_.getProperty("collections." + selectedItem->name + ".genre", text ); - ss << text; - break; - case TextTypePlaylist: - ss << playlistName; - break; - case TextTypeCollectionName: - ss << page.getCollectionName(); - break; - case TextTypeCollectionSize: - ss << page.getCollectionSize(); - break; - case TextTypeCollectionIndex: - ss << (1+page.getSelectedIndex()); - break; + } + else if (type_ == "playlist") + { + text = playlistName; + } + else if (type_ == "collectionName") + { + text = page.getCollectionName(); + } + else if (type_ == "collectionSize") + { + if (page.getCollectionSize() == 0) + { + ss << singlePrefix_ << page.getCollectionSize() << pluralPostfix_; + } + else if (page.getCollectionSize() == 1) + { + ss << singlePrefix_ << page.getCollectionSize() << singlePostfix_; + } + else + { + ss << pluralPrefix_ << page.getCollectionSize() << pluralPostfix_; + } + } + else if (type_ == "collectionIndex") + { + if (page.getSelectedIndex() == 0) + { + ss << singlePrefix_ << (page.getSelectedIndex()+1) << pluralPostfix_; + } + else if (page.getSelectedIndex() == 1) + { + ss << singlePrefix_ << (page.getSelectedIndex()+1) << singlePostfix_; + } + else + { + ss << pluralPrefix_ << (page.getSelectedIndex()+1) << pluralPostfix_; + } + } + else if (type_ == "collectionIndexSize") + { + if (page.getSelectedIndex() == 0) + { + ss << singlePrefix_ << (page.getSelectedIndex()+1) << "/" << page.getCollectionSize() << pluralPostfix_; + } + else if (page.getSelectedIndex() == 1) + { + ss << singlePrefix_ << (page.getSelectedIndex()+1) << "/" << page.getCollectionSize() << singlePostfix_; + } + else + { + ss << pluralPrefix_ << (page.getSelectedIndex()+1) << "/" << page.getCollectionSize() << pluralPostfix_; + } + } + else if (!selectedItem->leaf) // item is not a leaf + { + (void)config_.getProperty("collections." + selectedItem->name + "." + type_, text ); + } - default: - break; + if (text == "0") + { + text = singlePrefix_ + text + pluralPostfix_; + } + else if (text == "1") + { + text = singlePrefix_ + text + singlePostfix_; + } + else if (text != "") + { + text = pluralPrefix_ + text + pluralPostfix_; + } + + if (text != "") + { + if (textFormat_ == "uppercase") + { + std::transform(text.begin(), text.end(), text.begin(), ::toupper); + } + if (textFormat_ == "lowercase") + { + std::transform(text.begin(), text.end(), text.begin(), ::tolower); + } + ss << text; } imageInst_ = new Text(ss.str(), page, fontInst_, scaleX_, scaleY_); diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.h b/RetroFE/Source/Graphics/Component/ReloadableText.h index 5f059f3..9e81225 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableText.h +++ b/RetroFE/Source/Graphics/Component/ReloadableText.h @@ -25,7 +25,7 @@ class ReloadableText : public Component { public: - ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, float scaleX, float scaleY); + ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY); virtual ~ReloadableText(); void update(float dt); void draw(); @@ -35,30 +35,19 @@ public: void launchExit(); private: - enum TextType - { - TextTypeUnknown = 0, - TextTypeNumberButtons, - TextTypeNumberPlayers, - TextTypeYear, - TextTypeTitle, - TextTypeManufacturer, - TextTypeGenre, - TextTypePlaylist, - TextTypeCollectionName, - TextTypeCollectionSize, - TextTypeCollectionIndex - }; - void ReloadTexture(); Configuration &config_; Text *imageInst_; - TextType type_; + std::string type_; std::string layoutKey_; - bool reloadRequested_; - bool firstLoad_; Font *fontInst_; + std::string timeFormat_; + std::string textFormat_; + std::string singlePrefix_; + std::string singlePostfix_; + std::string pluralPrefix_; + std::string pluralPostfix_; float scaleX_; float scaleY_; diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.cpp b/RetroFE/Source/Graphics/Component/ScrollingList.cpp index 42bbeb1..5a5428d 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.cpp +++ b/RetroFE/Source/Graphics/Component/ScrollingList.cpp @@ -51,12 +51,9 @@ ScrollingList::ScrollingList(Configuration &c, , spriteList_(NULL) , scrollPoints_(NULL) , tweenPoints_(NULL) - , focus_(false) , itemIndex_(0) , componentIndex_(0) , selectedOffsetIndex_(0) - , scrollStopRequested_(true) - , notifyAllRequested_(false) , currentScrollDirection_(ScrollDirectionIdle) , requestedScrollDirection_(ScrollDirectionIdle) , currentScrollState_(ScrollStateIdle) @@ -77,12 +74,9 @@ ScrollingList::ScrollingList(const ScrollingList ©) : Component(copy) , horizontalScroll(copy.horizontalScroll) , spriteList_(NULL) - , focus_(false) , itemIndex_(0) , componentIndex_(0) , selectedOffsetIndex_(copy.selectedOffsetIndex_) - , scrollStopRequested_(true) - , notifyAllRequested_(false) , currentScrollDirection_(ScrollDirectionIdle) , requestedScrollDirection_(ScrollDirectionIdle) , currentScrollState_(ScrollStateIdle) @@ -113,17 +107,11 @@ ScrollingList::~ScrollingList() void ScrollingList::setItems(std::vector *items) { - deallocateSpritePoints(); - items_ = items; if(items_) { itemIndex_ = loopDecrement(0, selectedOffsetIndex_, items_->size()); } - - allocateSpritePoints(); - - notifyAllRequested_ = true; } unsigned int ScrollingList::loopIncrement(unsigned int offset, unsigned int i, unsigned int size) @@ -192,8 +180,6 @@ void ScrollingList::destroyItems() void ScrollingList::setPoints(std::vector *scrollPoints, std::vector *tweenPoints) { - deallocateSpritePoints(); - scrollPoints_ = scrollPoints; tweenPoints_ = tweenPoints; @@ -209,8 +195,6 @@ void ScrollingList::setPoints(std::vector *scrollPoints, std::vector { itemIndex_ = loopDecrement(0, selectedOffsetIndex_, items_->size()); } - - allocateSpritePoints(); } unsigned int ScrollingList::getScrollOffsetIndex() @@ -242,6 +226,15 @@ Item *ScrollingList::getItemByOffset(int offset) return items_->at(index); } + +Item *ScrollingList::getSelectedItem() +{ + if(!items_ || items_->size() == 0) return NULL; + unsigned index = loopIncrement(itemIndex_, selectedOffsetIndex_, items_->size()); + return items_->at(index); +} + + void ScrollingList::click(double nextScrollTime) { if(currentScrollDirection_ == ScrollDirectionBack) @@ -277,39 +270,20 @@ void ScrollingList::click(double nextScrollTime) void ScrollingList::pageUp() { - notifyAllRequested_ = true; - if(components_.size() == 0) return; - - deallocateSpritePoints(); - itemIndex_ = loopDecrement(itemIndex_, components_.size(), items_->size()); - - allocateSpritePoints(); } void ScrollingList::pageDown() { - notifyAllRequested_ = true; - if(components_.size() == 0) return; - - deallocateSpritePoints(); - itemIndex_ = loopIncrement(itemIndex_, components_.size(), items_->size()); - - allocateSpritePoints(); } void ScrollingList::random() { if(!items_ || items_->size() == 0) return; - - notifyAllRequested_ = true; - - deallocateSpritePoints(); itemIndex_ = rand() % items_->size(); - allocateSpritePoints(); } void ScrollingList::letterUp() @@ -324,9 +298,6 @@ void ScrollingList::letterDown() void ScrollingList::letterChange(bool increment) { - notifyAllRequested_ = true; - deallocateSpritePoints(); - std::string startname = items_->at((itemIndex_+selectedOffsetIndex_)%items_->size())->lowercaseFullTitle(); for(unsigned int i = 0; i < items_->size(); ++i) @@ -366,7 +337,6 @@ void ScrollingList::letterChange(bool increment) } } - allocateSpritePoints(); } @@ -381,27 +351,57 @@ void ScrollingList::freeGraphicsMemory() deallocateSpritePoints(); } -void ScrollingList::triggerMenuEnterEvent() +void ScrollingList::triggerEnterEvent() { - focus_ = true; - notifyAllRequested_ = true; - for(unsigned int i = 0; i < components_.size(); ++i) { Component *c = components_.at(i); - if(c) c->triggerMenuEnterEvent(); + if(c) c->triggerEvent( "enter" ); } } -void ScrollingList::triggerMenuExitEvent() +void ScrollingList::triggerExitEvent() { - focus_ = false; - notifyAllRequested_ = true; - for(unsigned int i = 0; i < components_.size(); ++i) { Component *c = components_.at(i); - if(c) c->triggerMenuExitEvent(); + if(c) c->triggerEvent( "exit" ); + } +} + +void ScrollingList::triggerMenuEnterEvent( int menuIndex ) +{ + for(unsigned int i = 0; i < components_.size(); ++i) + { + Component *c = components_.at(i); + if(c) c->triggerEvent( "menuEnter", menuIndex ); + } +} + +void ScrollingList::triggerMenuExitEvent( int menuIndex ) +{ + for(unsigned int i = 0; i < components_.size(); ++i) + { + Component *c = components_.at(i); + if(c) c->triggerEvent( "menuExit", menuIndex ); + } +} + +void ScrollingList::triggerHighlightEnterEvent( int menuIndex ) +{ + for(unsigned int i = 0; i < components_.size(); ++i) + { + Component *c = components_.at(i); + if(c) c->triggerEvent( "highlightEnter", menuIndex ); + } +} + +void ScrollingList::triggerHighlightExitEvent( int menuIndex ) +{ + for(unsigned int i = 0; i < components_.size(); ++i) + { + Component *c = components_.at(i); + if(c) c->triggerEvent( "highlightExit", menuIndex ); } } @@ -500,51 +500,33 @@ void ScrollingList::update(float dt) resetTweens(c, tweenPoints_->at(i), currentvi, nextvi, scrollPeriod_); c->baseViewInfo.font = nextvi->font; // Use the font settings of the next index - c->triggerMenuScrollEvent(); + c->triggerEvent( "menuScroll" ); } if(c) c->update(dt); } - if(scrollStopped || (notifyAllRequested_ && focus_)) + if(scrollStopped) { - Item *item = NULL; - unsigned index = loopIncrement(itemIndex_, selectedOffsetIndex_, items_->size()); - item = items_->at(index); - - for(std::vector::iterator it = notificationComponents_.begin(); - it != notificationComponents_.end(); - it++) - { - MenuNotifierInterface *c = *it; - - if(c && item) - { - c->onNewItemSelected(item); - } - } - if(currentScrollState_ == ScrollStatePageChange) { currentScrollState_ = ScrollStateIdle; } } - - notifyAllRequested_ = false; } -unsigned int ScrollingList::getSelectedIndex() -{ +unsigned int ScrollingList::getSelectedIndex() +{ if(!items_) return 0; return loopIncrement(itemIndex_, selectedOffsetIndex_, items_->size()); -} - -unsigned int ScrollingList::getSize() -{ - if(!items_) return 0; - - return items_->size(); +} + +unsigned int ScrollingList::getSize() +{ + if(!items_) return 0; + + return items_->size(); } void ScrollingList::resetTweens(Component *c, AnimationEvents *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime) @@ -568,8 +550,8 @@ void ScrollingList::resetTweens(Component *c, AnimationEvents *sets, ViewInfo *c c->baseViewInfo = *currentViewInfo; TweenSet *set = new TweenSet(); - set->push(new Tween(TWEEN_PROPERTY_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->ScaledHeight(), nextViewInfo->ScaledHeight(), scrollTime)); - set->push(new Tween(TWEEN_PROPERTY_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->ScaledWidth(), nextViewInfo->ScaledWidth(), scrollTime)); + set->push(new Tween(TWEEN_PROPERTY_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->Height, nextViewInfo->Height, scrollTime)); + set->push(new Tween(TWEEN_PROPERTY_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->Width, nextViewInfo->Width, scrollTime)); set->push(new Tween(TWEEN_PROPERTY_ANGLE, EASE_INOUT_QUADRATIC, currentViewInfo->Angle, nextViewInfo->Angle, scrollTime)); set->push(new Tween(TWEEN_PROPERTY_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->Alpha, nextViewInfo->Alpha, scrollTime)); set->push(new Tween(TWEEN_PROPERTY_X, EASE_INOUT_QUADRATIC, currentViewInfo->X, nextViewInfo->X, scrollTime)); @@ -580,6 +562,9 @@ void ScrollingList::resetTweens(Component *c, AnimationEvents *sets, ViewInfo *c set->push(new Tween(TWEEN_PROPERTY_Y_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->YOffset, nextViewInfo->YOffset, scrollTime)); set->push(new Tween(TWEEN_PROPERTY_FONT_SIZE, EASE_INOUT_QUADRATIC, currentViewInfo->FontSize, nextViewInfo->FontSize, scrollTime)); set->push(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->BackgroundAlpha, nextViewInfo->BackgroundAlpha, scrollTime)); + set->push(new Tween(TWEEN_PROPERTY_MAX_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->MaxWidth, nextViewInfo->MaxWidth, scrollTime)); + set->push(new Tween(TWEEN_PROPERTY_MAX_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->MaxHeight, nextViewInfo->MaxHeight, scrollTime)); + set->push(new Tween(TWEEN_PROPERTY_LAYER, EASE_INOUT_QUADRATIC, currentViewInfo->Layer, nextViewInfo->Layer, scrollTime)); scrollTween->Push(set); } @@ -694,29 +679,9 @@ void ScrollingList::draw(unsigned int layer) void ScrollingList::setScrollDirection(ScrollDirection direction) { requestedScrollDirection_ = direction; - - scrollStopRequested_ = (direction == ScrollDirectionIdle); } -void ScrollingList::addComponentForNotifications(MenuNotifierInterface *c) -{ - notificationComponents_.push_back(c); -} -void ScrollingList::removeComponentForNotifications(MenuNotifierInterface *c) -{ - for(std::vector::iterator it = notificationComponents_.begin(); - it != notificationComponents_.end(); - it++) - { - if(c == *it) - { - notificationComponents_.erase(it); - break; - } - } -} - bool ScrollingList::isIdle() { if(!Component::isIdle() || currentScrollState_ != ScrollStateIdle) return false; diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.h b/RetroFE/Source/Graphics/Component/ScrollingList.h index 4dafc51..7d658d5 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.h +++ b/RetroFE/Source/Graphics/Component/ScrollingList.h @@ -19,7 +19,6 @@ #include "Component.h" #include "../Animate/Tween.h" #include "../Page.h" -#include "../MenuNotifierInterface.h" #include "../ViewInfo.h" #include "../../Database/Configuration.h" #include @@ -53,8 +52,12 @@ public: ScrollingList(const ScrollingList ©); virtual ~ScrollingList(); - void triggerMenuEnterEvent(); - void triggerMenuExitEvent(); + void triggerEnterEvent(); + void triggerExitEvent(); + void triggerMenuEnterEvent(int menuIndex = -1); + void triggerMenuExitEvent(int menuIndex = -1); + void triggerHighlightEnterEvent(int menuIndex = -1); + void triggerHighlightExitEvent(int menuIndex = -1); bool allocateTexture(unsigned int index, Item *i); void deallocateTexture(unsigned int index); @@ -75,8 +78,7 @@ public: void setScrollOffsetIndex(unsigned int index); void setSelectedIndex(int selectedIndex); Item *getItemByOffset(int offset); - void addComponentForNotifications(MenuNotifierInterface *c); - void removeComponentForNotifications(MenuNotifierInterface *c); + Item *getSelectedItem(); void freeGraphicsMemory(); void update(float dt); void draw(); @@ -105,16 +107,11 @@ private: std::vector *spriteList_; std::vector *scrollPoints_; std::vector *tweenPoints_; - std::vector notificationComponents_; - bool focus_; unsigned int itemIndex_; unsigned int componentIndex_; unsigned int selectedOffsetIndex_; - bool scrollStopRequested_; - bool notifyAllRequested_; - ScrollDirection currentScrollDirection_; ScrollDirection requestedScrollDirection_; ScrollState currentScrollState_; diff --git a/RetroFE/Source/Graphics/Component/Text.cpp b/RetroFE/Source/Graphics/Component/Text.cpp index 5e78063..57b7ee8 100644 --- a/RetroFE/Source/Graphics/Component/Text.cpp +++ b/RetroFE/Source/Graphics/Component/Text.cpp @@ -65,6 +65,21 @@ void Text::draw() float imageHeight = 0; float imageWidth = 0; + float imageMaxWidth = 0; + if (baseViewInfo.Width < baseViewInfo.MaxWidth && baseViewInfo.Width > 0) + { + imageMaxWidth = baseViewInfo.Width; + } + else + { + imageMaxWidth = baseViewInfo.MaxWidth; + } + + imageHeight = (float)font->getHeight(); + float scale = (float)baseViewInfo.FontSize / (float)imageHeight; + + unsigned int textIndexMax = 0; + unsigned int emptySpace = 0; // determine image width for(unsigned int i = 0; i < textData_.size(); ++i) @@ -77,14 +92,19 @@ void Text::draw() imageWidth += glyph.minX; } - imageWidth += glyph.advance; + if ((imageWidth + glyph.advance)*scale > imageMaxWidth ) + { + imageWidth -= emptySpace; + break; + } + + textIndexMax = i; + emptySpace = glyph.advance - glyph.maxX; + imageWidth += glyph.advance; } } - imageHeight = (float)font->getHeight(); - float scale = (float)baseViewInfo.FontSize / (float)imageHeight; - float oldWidth = baseViewInfo.Width; float oldHeight = baseViewInfo.Height; float oldImageWidth = baseViewInfo.ImageHeight; @@ -107,7 +127,7 @@ void Text::draw() SDL_Rect rect; rect.x = static_cast(xOrigin); - for(unsigned int i = 0; i < textData_.size(); ++i) + for(unsigned int i = 0; i <= textIndexMax; ++i) { Font::GlyphInfo glyph; @@ -130,14 +150,10 @@ void Text::draw() } - SDL::renderCopy(t, static_cast(baseViewInfo.Alpha * 255), &charRect, &rect, baseViewInfo.Angle); + SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo); rect.x += static_cast(glyph.advance * scale); - if((static_cast(rect.x) - xOrigin) > baseViewInfo.MaxWidth) - { - break; - } } } } diff --git a/RetroFE/Source/Graphics/Component/Video.cpp b/RetroFE/Source/Graphics/Component/Video.cpp new file mode 100644 index 0000000..0517943 --- /dev/null +++ b/RetroFE/Source/Graphics/Component/Video.cpp @@ -0,0 +1,131 @@ +/* This file is part of RetroFE. + * + * RetroFE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * RetroFE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RetroFE. If not, see . + */ + +#include "Video.h" +#include "VideoComponent.h" +#include "VideoBuilder.h" +#include "../../Video/IVideo.h" +#include "../../Video/GStreamerVideo.h" +#include "../../Utility/Log.h" +#include "../../SDL.h" + + +Video::Video(std::string file, std::string altFile, int numLoops, Page &p, float scaleX, float scaleY) + : Component(p) + , video_(NULL) + , file_(file) + , altFile_(altFile) + , numLoops_(numLoops) + , scaleX_(scaleX) + , scaleY_(scaleY) + +{ + allocateGraphicsMemory( ); +} + + +Video::~Video( ) +{ + if (video_ != NULL) + { + delete video_; + } +} + + +void Video::update(float dt) +{ + if(video_) + { + // video needs to run a frame to start getting size info + if(baseViewInfo.ImageHeight == 0 && baseViewInfo.ImageWidth == 0) + { + baseViewInfo.ImageWidth = video_->baseViewInfo.ImageWidth; + baseViewInfo.ImageHeight = video_->baseViewInfo.ImageHeight; + } + + video_->update(dt); + } + Component::update(dt); +} + + +void Video::freeGraphicsMemory( ) +{ + Component::freeGraphicsMemory( ); + if(video_) + { + video_->freeGraphicsMemory( ); + } +} + + +void Video::allocateGraphicsMemory( ) +{ + + Component::allocateGraphicsMemory( ); + + if (!video_) + { + std::string file = ""; + + std::ifstream f(altFile_.c_str( )); + if (f.good( )) + file = altFile_; + + std::ifstream g(file_.c_str( )); + if (g.good( )) + file = file_; + + if (file != "") + { + IVideo *video = new GStreamerVideo(); + video->initialize(); + ((GStreamerVideo *)(video))->setNumLoops(numLoops_); + video_ = new VideoComponent( video, page, file, scaleX_, scaleY_ ); + } + } + + if (video_) + video_->allocateGraphicsMemory(); + +} + + +void Video::draw( ) +{ + Component::draw( ); + if(video_) + { + baseViewInfo.ImageHeight = video_->baseViewInfo.ImageHeight; + baseViewInfo.ImageWidth = video_->baseViewInfo.ImageWidth; + video_->baseViewInfo = baseViewInfo; + video_->draw( ); + } +} + + +bool Video::isPlaying( ) +{ + if (video_) + { + return video_->isPlaying( ); + } + else + { + return false; + } +} diff --git a/RetroFE/Source/Graphics/MenuNotifierInterface.h b/RetroFE/Source/Graphics/Component/Video.h similarity index 53% rename from RetroFE/Source/Graphics/MenuNotifierInterface.h rename to RetroFE/Source/Graphics/Component/Video.h index 21c105d..04f94c9 100644 --- a/RetroFE/Source/Graphics/MenuNotifierInterface.h +++ b/RetroFE/Source/Graphics/Component/Video.h @@ -14,13 +14,27 @@ * along with RetroFE. If not, see . */ #pragma once +#include "Component.h" +#include "../../Video/IVideo.h" +#include +#include -#include "../Collection/Item.h" - -class MenuNotifierInterface +class Video : public Component { public: - virtual ~MenuNotifierInterface() {} - virtual void onNewItemSelected(Item *) = 0; -}; + Video( std::string file, std::string altFile, int numLoops, Page &page, float scaleX, float scaleY ); + virtual ~Video( ); + void update(float dt); + void freeGraphicsMemory( ); + void allocateGraphicsMemory( ); + void draw( ); + virtual bool isPlaying( ); +protected: + Component *video_; + std::string file_; + std::string altFile_; + int numLoops_; + float scaleX_; + float scaleY_; +}; diff --git a/RetroFE/Source/Graphics/Component/VideoComponent.cpp b/RetroFE/Source/Graphics/Component/VideoComponent.cpp index 672b6b4..1e5bfa9 100644 --- a/RetroFE/Source/Graphics/Component/VideoComponent.cpp +++ b/RetroFE/Source/Graphics/Component/VideoComponent.cpp @@ -18,6 +18,7 @@ #include "../ViewInfo.h" #include "../../Database/Configuration.h" #include "../../Utility/Log.h" +#include "../../Video/GStreamerVideo.h" #include "../../SDL.h" VideoComponent::VideoComponent(IVideo *videoInst, Page &p, std::string videoFile, float scaleX, float scaleY) @@ -43,6 +44,10 @@ VideoComponent::~VideoComponent() void VideoComponent::update(float dt) { + if (videoInst_) + { + isPlaying_ = ((GStreamerVideo *)(videoInst_))->isPlaying(); + } if(isPlaying_) { videoInst_->update(dt); @@ -100,6 +105,11 @@ void VideoComponent::draw() if(texture) { - SDL::renderCopy(texture, static_cast(baseViewInfo.Alpha * 255), NULL, &rect, static_cast(baseViewInfo.Angle)); + SDL::renderCopy(texture, baseViewInfo.Alpha, NULL, &rect, baseViewInfo); } } + +bool VideoComponent::isPlaying() +{ + return isPlaying_; +} diff --git a/RetroFE/Source/Graphics/Component/VideoComponent.h b/RetroFE/Source/Graphics/Component/VideoComponent.h index 9477c7b..22bce43 100644 --- a/RetroFE/Source/Graphics/Component/VideoComponent.h +++ b/RetroFE/Source/Graphics/Component/VideoComponent.h @@ -33,6 +33,7 @@ public: void allocateGraphicsMemory(); void launchEnter(); void launchExit(); + virtual bool isPlaying(); private: std::string videoFile_; diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index b889fff..48fb52d 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -33,8 +33,6 @@ Page::Page(Configuration &config) , scrollActive_(false) , selectedItem_(NULL) , textStatusComponent_(NULL) - , selectedItemChanged_(false) - , playlistChanged_(false) , loadSoundChunk_(NULL) , unloadSoundChunk_(NULL) , highlightSoundChunk_(NULL) @@ -54,21 +52,16 @@ void Page::DeInitialize() while(it != menus_.end()) { ScrollingList *menu = *it; - menu->removeComponentForNotifications(this); menus_.erase(it); delete menu; it = menus_.begin(); } - for(unsigned int i = 0; i < sizeof(LayerComponents)/sizeof(LayerComponents[0]); ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - delete *it; - } - - LayerComponents[i].clear(); + delete *it; } + LayerComponents.clear(); if(loadSoundChunk_) @@ -97,7 +90,7 @@ void Page::DeInitialize() } CollectionVector_T::iterator itc = collections_.begin(); - while(itc != collections_.end()) + while(itc != collections_.end()) { itc->collection->Save(); @@ -132,20 +125,29 @@ void Page::setSelectSound(Sound *chunk) { selectSoundChunk_ = chunk; } -void Page::onNewItemSelected(Item *item) + + +void Page::onNewItemSelected() { - selectedItem_ = item; - selectedItemChanged_ = true; + selectedItem_ = activeMenu_->getSelectedItem(); + + for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) + { + ScrollingList *menu = *it; + menu->setNewItemSelected(); + } + + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) + { + (*it)->setNewItemSelected(); + } + } + void Page::pushMenu(ScrollingList *s) { menus_.push_back(s); - - if(s) - { - s->addComponentForNotifications(this); - } } unsigned int Page::getMenuDepth() @@ -162,19 +164,15 @@ bool Page::addComponent(Component *c) { bool retVal = false; - unsigned int layer = c->baseViewInfo.Layer; - - - if(layer < NUM_LAYERS) + if(c->baseViewInfo.Layer < NUM_LAYERS) { - LayerComponents[layer].push_back(c); - + LayerComponents.push_back(c); retVal = true; } else { std::stringstream ss; - ss << "Component layer too large Layer: " << layer; + ss << "Component layer too large Layer: " << c->baseViewInfo.Layer; Logger::write(Logger::ZONE_ERROR, "Page", ss.str()); } @@ -201,51 +199,34 @@ bool Page::isMenuIdle() bool Page::isIdle() { bool idle = isMenuIdle(); - - for(unsigned int i = 0; i < NUM_LAYERS && idle; ++i) + + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end() && idle; ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end() && idle; ++it) - { - idle = (*it)->isIdle(); - } + idle = (*it)->isIdle(); + } + + return idle; +} + +bool Page::isGraphicsIdle() +{ + bool idle = true; + + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end() && idle; ++it) + { + idle = (*it)->isIdle(); } return idle; } -bool Page::isHidden() -{ - bool hidden = true; - - for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) - { - ScrollingList *menu = *it; - - if(!menu->isHidden()) - { - hidden = false; - break; - } - } - - - for(unsigned int i = 0; hidden && i < NUM_LAYERS; ++i) - { - for(std::vector::iterator it = LayerComponents[i].begin(); hidden && it != LayerComponents[i].end(); ++it) - { - hidden = (*it)->isHidden(); - } - } - - return hidden; -} - void Page::start() { for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) { ScrollingList *menu = *it; + menu->triggerEvent( "enter" ); menu->triggerEnterEvent(); } @@ -254,26 +235,19 @@ void Page::start() loadSoundChunk_->play(); } - startComponents(); -} - - -void Page::startComponents() -{ - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->triggerEnterEvent(); - } + (*it)->triggerEvent( "enter" ); } } + void Page::stop() { for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) { ScrollingList *menu = *it; + menu->triggerEvent( "exit" ); menu->triggerExitEvent(); } @@ -282,12 +256,9 @@ void Page::stop() unloadSoundChunk_->play(); } - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->triggerExitEvent(); - } + (*it)->triggerEvent( "exit" ); } } @@ -344,36 +315,50 @@ void Page::playlistChange() { if(activeMenu_) { - activeMenu_->triggerPlaylistChangeEvent(playlist_->first); + activeMenu_->setPlaylist(playlist_->first); } - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->triggerPlaylistChangeEvent(playlist_->first); - } + (*it)->setPlaylist(playlist_->first); } } -void Page::highlight() + +void Page::highlightEnter() { Item *item = selectedItem_; if(!item) return; - if(activeMenu_) + for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) { - activeMenu_->triggerHighlightEvent(); - activeMenu_->scrollActive = scrollActive_; + ScrollingList *menu = *it; + menu->triggerEvent( "highlightEnter", menuDepth_ - 1 ); + menu->triggerHighlightEnterEvent( menuDepth_ - 1 ); } - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->triggerHighlightEvent(); - (*it)->scrollActive = scrollActive_; - } + (*it)->triggerEvent( "highlightEnter", menuDepth_ - 1 ); + } +} + + +void Page::highlightExit() +{ + Item *item = selectedItem_; + + if(!item) return; + for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) + { + ScrollingList *menu = *it; + menu->triggerEvent( "highlightExit", menuDepth_ - 1 ); + menu->triggerHighlightExitEvent( menuDepth_ - 1 ); + } + + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) + { + (*it)->triggerEvent( "highlightExit", menuDepth_ - 1 ); } } @@ -433,7 +418,7 @@ void Page::pageScroll(ScrollDirection direction) void Page::selectRandom() { - if(activeMenu_) activeMenu_->random(); + if(activeMenu_) activeMenu_->random(); } void Page::letterScroll(ScrollDirection direction) @@ -465,32 +450,16 @@ unsigned int Page::getSelectedIndex() bool Page::pushCollection(CollectionInfo *collection) { - int menuExitIndex = -1; - int menuEnterIndex = -1; - - if(activeMenu_) - { - activeMenu_->triggerMenuExitEvent(); - } - - if(menuDepth_ > 0) - { - menuExitIndex = menuDepth_ - 1; - } - // grow the menu as needed if(menus_.size() >= menuDepth_ && activeMenu_) { activeMenu_ = new ScrollingList(*activeMenu_); - activeMenu_->forceIdle(); pushMenu(activeMenu_); } - activeMenu_ = menus_[menuDepth_]; activeMenu_->collectionName = collection->name; activeMenu_->setItems(&collection->items); - activeMenu_->triggerMenuEnterEvent(); // build the collection info instance MenuInfo_S info; @@ -501,29 +470,16 @@ bool Page::pushCollection(CollectionInfo *collection) collections_.push_back(info); playlist_ = info.playlist; - playlistChanged_ = true; + playlistChange(); if(menuDepth_ < menus_.size()) { - menuEnterIndex = menuDepth_; menuDepth_++; } - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->collectionName = collection->name; - if(menuEnterIndex >= 0) - { - (*it)->triggerMenuEnterEvent(menuEnterIndex); - } - - if(menuExitIndex >= 0) - { - (*it)->triggerMenuExitEvent(menuExitIndex); - } - } + (*it)->collectionName = collection->name; } return true; @@ -531,8 +487,6 @@ bool Page::pushCollection(CollectionInfo *collection) bool Page::popCollection() { - int menuExitIndex = -1; - int menuEnterIndex = -1; if(!activeMenu_) return false; if(menuDepth_ <= 1) return false; @@ -547,44 +501,64 @@ bool Page::popCollection() collections_.pop_back(); info = &collections_.back(); playlist_ = info->playlist; - playlistChanged_ = true; - - if(activeMenu_) - { - activeMenu_->triggerMenuExitEvent(); - - } + playlistChange(); menuDepth_--; - menuExitIndex = menuDepth_; - menuEnterIndex = menuExitIndex - 1; activeMenu_ = menus_[menuDepth_ - 1]; - if(activeMenu_) + + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - activeMenu_->triggerMenuEnterEvent(); - } - - for(unsigned int i = 0; i < NUM_LAYERS; ++i) - { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->collectionName = info->collection->name; - - if(menuEnterIndex >= 0) - { - (*it)->triggerMenuEnterEvent(menuEnterIndex); - } - - if(menuExitIndex >= 0) - { - (*it)->triggerMenuExitEvent(menuExitIndex); - } - } + (*it)->collectionName = info->collection->name; } return true; } + +void Page::enterMenu() +{ + + for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) + { + ScrollingList *menu = *it; + menu->triggerEvent( "menuEnter", menuDepth_ - 1 ); + menu->triggerMenuEnterEvent( menuDepth_ - 1 ); + } + + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) + { + (*it)->triggerEvent( "menuEnter", menuDepth_ - 1 ); + } + + return; +} + + +void Page::exitMenu() +{ + + for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) + { + ScrollingList *menu = *it; + menu->triggerEvent( "menuExit" ); + menu->triggerMenuExitEvent( menuDepth_ - 1 ); + } + + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) + { + (*it)->triggerEvent( "menuExit", menuDepth_ - 1 ); + } + + return; +} + + +std::string Page::getPlaylistName() +{ + return playlist_->first; +} + + void Page::nextPlaylist() { MenuInfo_S &info = collections_.back(); @@ -596,17 +570,16 @@ void Page::nextPlaylist() playlist_++; // wrap if(playlist_ == info.collection->playlists.end()) playlist_ = info.collection->playlists.begin(); - + // find the first playlist if(playlist_->second->size() != 0) break; } activeMenu_->setItems(playlist_->second); - activeMenu_->triggerMenuEnterEvent(); - playlistChanged_ = true; + playlistChange(); } -void Page::favPlaylist() +void Page::selectPlaylist(std::string playlist) { MenuInfo_S &info = collections_.back(); info.collection->Save(); @@ -620,18 +593,17 @@ void Page::favPlaylist() playlist_++; // wrap if(playlist_ == info.collection->playlists.end()) playlist_ = info.collection->playlists.begin(); - + // find the first playlist - if(playlist_->second->size() != 0 && playlist_->first == "favorites") break; + if(playlist_->second->size() != 0 && playlist_->first == playlist) break; } - // Do not change playlist if favorites does not exist or if it's empty - if ( playlist_->second->size() == 0 || playlist_->first != "favorites") + // Do not change playlist if it does not exist or if it's empty + if ( playlist_->second->size() == 0 || playlist_->first != playlist) playlist_ = playlist_store; activeMenu_->setItems(playlist_->second); - activeMenu_->triggerMenuEnterEvent(); - playlistChanged_ = true; + playlistChange(); } void Page::update(float dt) @@ -642,18 +614,6 @@ void Page::update(float dt) menu->update(dt); } - - if(playlistChanged_) - { - playlistChange(); - playlistChanged_ = false; - } - - if(selectedItemChanged_ && !scrollActive_) - { - highlight(); - selectedItemChanged_ = false; - } if(textStatusComponent_) { @@ -662,12 +622,9 @@ void Page::update(float dt) textStatusComponent_->setText(status); } - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - if(*it) (*it)->update(dt); - } + if(*it) (*it)->update(dt); } // many nodes still have handles on the collection info. We need to delete @@ -678,11 +635,11 @@ void Page::update(float dt) { MenuInfo_S &info = *del; if(info.queueDelete && info.menu && info.menu->isIdle()) - { + { std::list::iterator next = del; ++next; - if(info.collection) + if(info.collection) { info.collection->Save(); delete info.collection; @@ -701,7 +658,7 @@ void Page::draw() { for(unsigned int i = 0; i < NUM_LAYERS; ++i) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { if(*it && (*it)->baseViewInfo.Layer == i) (*it)->draw(); } @@ -730,12 +687,6 @@ void Page::removePlaylist() { items->erase(it); collection->saveRequest = true; - - if(activeMenu_) - { - activeMenu_->deallocateSpritePoints(); - activeMenu_->allocateSpritePoints(); - } } } @@ -751,12 +702,8 @@ void Page::addPlaylist() if(playlist_->first != "favorites" && std::find(items->begin(), items->end(), selectedItem_) == items->end()) { items->push_back(selectedItem_); + collection->sortItems(); collection->saveRequest = true; - if(activeMenu_) - { - activeMenu_->deallocateSpritePoints(); - activeMenu_->allocateSpritePoints(); - } } } @@ -782,12 +729,9 @@ void Page::freeGraphicsMemory() if(highlightSoundChunk_) highlightSoundChunk_->free(); if(selectSoundChunk_) selectSoundChunk_->free(); - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->freeGraphicsMemory(); - } + (*it)->freeGraphicsMemory(); } } @@ -807,12 +751,9 @@ void Page::allocateGraphicsMemory() if(highlightSoundChunk_) highlightSoundChunk_->allocate(); if(selectSoundChunk_) selectSoundChunk_->allocate(); - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->allocateGraphicsMemory(); - } + (*it)->allocateGraphicsMemory(); } Logger::write(Logger::ZONE_DEBUG, "Page", "Allocate graphics memory complete"); } @@ -824,12 +765,14 @@ void Page::launchEnter() activeMenu_->launchEnter(); } - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->launchEnter(); - } + (*it)->launchEnter(); + } + + if(selectSoundChunk_) + { + selectSoundChunk_->play(); } } @@ -840,11 +783,39 @@ void Page::launchExit() activeMenu_->launchExit(); } - for(unsigned int i = 0; i < NUM_LAYERS; ++i) + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) - { - (*it)->launchExit(); - } + (*it)->launchExit(); } } + + +void Page::reallocateMenuSpritePoints() +{ + if (activeMenu_) + { + activeMenu_->deallocateSpritePoints(); + activeMenu_->allocateSpritePoints(); + } +} + + +bool Page::isMenuScrolling() +{ + return scrollActive_; +} + + +bool Page::isPlaying() +{ + + bool retVal = false; + + for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) + { + retVal |= (*it)->isPlaying(); + } + + return retVal; + +} \ No newline at end of file diff --git a/RetroFE/Source/Graphics/Page.h b/RetroFE/Source/Graphics/Page.h index a53e28c..2c43765 100644 --- a/RetroFE/Source/Graphics/Page.h +++ b/RetroFE/Source/Graphics/Page.h @@ -15,7 +15,6 @@ */ #pragma once -#include "MenuNotifierInterface.h" #include "../Collection/CollectionInfo.h" #include @@ -30,7 +29,7 @@ class Text; class Item; class Sound; -class Page : public MenuNotifierInterface +class Page { public: enum ScrollDirection @@ -44,11 +43,14 @@ public: Page(Configuration &c); virtual ~Page(); void DeInitialize(); - virtual void onNewItemSelected(Item *); + virtual void onNewItemSelected(); bool pushCollection(CollectionInfo *collection); bool popCollection(); + void enterMenu(); + void exitMenu(); + std::string getPlaylistName(); void nextPlaylist(); - void favPlaylist(); + void selectPlaylist(std::string playlist); void pushMenu(ScrollingList *s); bool isMenusFull(); void setLoadSound(Sound *chunk); @@ -62,7 +64,6 @@ public: unsigned int getSelectedIndex(); void selectRandom(); void start(); - void startComponents(); void stop(); void setScrolling(ScrollDirection direction); bool isHorizontalScroll(); @@ -73,8 +74,8 @@ public: void setScrollOffsetIndex(unsigned int i); unsigned int getScrollOffsetIndex(); bool isIdle(); + bool isGraphicsIdle(); bool isMenuIdle(); - bool isHidden(); void setStatusTextComponent(Text *t); void update(float dt); void draw(); @@ -85,11 +86,15 @@ public: std::string getCollectionName(); void setMinShowTime(float value); float getMinShowTime(); + void highlightEnter(); + void highlightExit(); void addPlaylist(); void removePlaylist(); + void reallocateMenuSpritePoints(); + bool isMenuScrolling(); + bool isPlaying(); private: - void highlight(); void playlistChange(); std::string collectionName_; Configuration &config_; @@ -112,7 +117,7 @@ private: CollectionVector_T deleteCollections_; static const unsigned int NUM_LAYERS = 20; - std::vector LayerComponents[NUM_LAYERS]; + std::vector LayerComponents; std::list deleteMenuList_; std::list deleteCollectionList_; @@ -120,8 +125,6 @@ private: Item *selectedItem_; Text *textStatusComponent_; - bool selectedItemChanged_; - bool playlistChanged_; Sound *loadSoundChunk_; Sound *unloadSoundChunk_; Sound *highlightSoundChunk_; diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index b9557e0..06e2981 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -22,7 +22,9 @@ #include "Component/Text.h" #include "Component/ReloadableText.h" #include "Component/ReloadableMedia.h" +#include "Component/ReloadableScrollingText.h" #include "Component/ScrollingList.h" +#include "Component/Video.h" #include "Animate/AnimationEvents.h" #include "Animate/TweenTypes.h" #include "../Sound/Sound.h" @@ -70,14 +72,22 @@ PageBuilder::~PageBuilder() { } -Page *PageBuilder::buildPage() +Page *PageBuilder::buildPage( std::string collectionName ) { Page *page = NULL; std::string layoutFile; std::string layoutName = layoutKey; - layoutPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName); + if ( collectionName == "" ) + { + layoutPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName); + } + else + { + layoutPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collectionName); + layoutPath = Utils::combinePath(layoutPath, "layout"); + } layoutFile = Utils::combinePath(layoutPath, layoutPage + ".xml"); Logger::write(Logger::ZONE_INFO, "Layout", "Initializing " + layoutFile); @@ -174,16 +184,19 @@ Page *PageBuilder::buildPage() // load sounds for(xml_node<> *sound = root->first_node("sound"); sound; sound = sound->next_sibling("sound")) { - xml_attribute<> *src = sound->first_attribute("src"); + xml_attribute<> *src = sound->first_attribute("src"); xml_attribute<> *type = sound->first_attribute("type"); - std::string file = Configuration::convertToAbsolutePath(layoutPath, src->value()); + std::string file = Configuration::convertToAbsolutePath(layoutPath, src->value()); + std::string layoutName; + config_.getProperty("layout", layoutName); + std::string altfile = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value())); if(!type) { Logger::write(Logger::ZONE_ERROR, "Layout", "Sound tag missing type attribute"); } else { - Sound *sound = new Sound(file); + Sound *sound = new Sound(file, altfile); std::string soundType = type->value(); if(!soundType.compare("load")) @@ -345,8 +358,39 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page) { std::string imagePath; imagePath = Utils::combinePath(Configuration::convertToAbsolutePath(layoutPath, imagePath), std::string(src->value())); + std::string layoutName; + config_.getProperty("layout", layoutName); + std::string altImagePath; + altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value())); - Image *c = new Image(imagePath, *page, scaleX_, scaleY_); + Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_); + buildViewInfo(componentXml, c->baseViewInfo); + loadTweens(c, componentXml); + page->addComponent(c); + } + } + + + for(xml_node<> *componentXml = layout->first_node("video"); componentXml; componentXml = componentXml->next_sibling("video")) + { + xml_attribute<> *srcXml = componentXml->first_attribute("src"); + xml_attribute<> *numLoopsXml = componentXml->first_attribute("numLoops"); + + if (!srcXml) + { + Logger::write(Logger::ZONE_ERROR, "Layout", "Video component in layout does not specify a source video file"); + } + else + { + std::string videoPath; + videoPath = Utils::combinePath(Configuration::convertToAbsolutePath(layoutPath, videoPath), std::string(srcXml->value())); + std::string layoutName; + config_.getProperty("layout", layoutName); + std::string altVideoPath; + altVideoPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(srcXml->value())); + int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1; + + Video *c = new Video(videoPath, altVideoPath, numLoops, *page, scaleX_, scaleY_); buildViewInfo(componentXml, c->baseViewInfo); loadTweens(c, componentXml); page->addComponent(c); @@ -387,9 +431,10 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page) } - loadReloadableImages(layout, "reloadableImage", page); - loadReloadableImages(layout, "reloadableVideo", page); - loadReloadableImages(layout, "reloadableText", page); + loadReloadableImages(layout, "reloadableImage", page); + loadReloadableImages(layout, "reloadableVideo", page); + loadReloadableImages(layout, "reloadableText", page); + loadReloadableImages(layout, "reloadableScrollingText", page); return true; } @@ -401,10 +446,24 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, { std::string reloadableImagePath; std::string reloadableVideoPath; - xml_attribute<> *type = componentXml->first_attribute("type"); - xml_attribute<> *mode = componentXml->first_attribute("mode"); + xml_attribute<> *type = componentXml->first_attribute("type"); + xml_attribute<> *mode = componentXml->first_attribute("mode"); + xml_attribute<> *timeFormatXml = componentXml->first_attribute("timeFormat"); + xml_attribute<> *textFormatXml = componentXml->first_attribute("textFormat"); + xml_attribute<> *singlePrefixXml = componentXml->first_attribute("singlePrefix"); + xml_attribute<> *singlePostfixXml = componentXml->first_attribute("singlePostfix"); + xml_attribute<> *pluralPrefixXml = componentXml->first_attribute("pluralPrefix"); + xml_attribute<> *pluralPostfixXml = componentXml->first_attribute("pluralPostfix"); xml_attribute<> *selectedOffsetXml = componentXml->first_attribute("selectedOffset"); + xml_attribute<> *directionXml = componentXml->first_attribute("direction"); + xml_attribute<> *scrollingSpeedXml = componentXml->first_attribute("scrollingSpeed"); + xml_attribute<> *startPositionXml = componentXml->first_attribute("startPosition"); + xml_attribute<> *startTimeXml = componentXml->first_attribute("startTime"); + xml_attribute<> *endTimeXml = componentXml->first_attribute("endTime"); + xml_attribute<> *alignmentXml = componentXml->first_attribute("alignment"); bool systemMode = false; + bool layoutMode = false; + bool commonMode = false; int selectedOffset = 0; if(tagName == "reloadableVideo") { @@ -420,6 +479,10 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, { Logger::write(Logger::ZONE_ERROR, "Layout", "Image component in layout does not specify a source image file"); } + if(!type && tagName == "reloadableScrollingText") + { + Logger::write(Logger::ZONE_ERROR, "Layout", "Reloadable scroling text component in layout does not specify a type"); + } if(mode) @@ -429,6 +492,24 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, { systemMode = true; } + if(sysMode == "layout") + { + layoutMode = true; + } + if(sysMode == "common") + { + commonMode = true; + } + if(sysMode == "commonlayout") + { + layoutMode = true; + commonMode = true; + } + if(sysMode == "systemlayout") + { + systemMode = true; + layoutMode = true; + } } if(selectedOffsetXml) @@ -446,13 +527,86 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, if(type) { Font *font = addFont(componentXml, NULL); - c = new ReloadableText(type->value(), *page, config_, font, layoutKey, scaleX_, scaleY_); + std::string timeFormat = "%H:%M"; + if (timeFormatXml) + { + timeFormat = timeFormatXml->value(); + } + std::string textFormat = ""; + if (textFormatXml) + { + textFormat = textFormatXml->value(); + } + std::string singlePrefix = ""; + if (singlePrefixXml) + { + singlePrefix = singlePrefixXml->value(); + } + std::string singlePostfix = ""; + if (singlePostfixXml) + { + singlePostfix = singlePostfixXml->value(); + } + std::string pluralPrefix = ""; + if (pluralPrefixXml) + { + pluralPrefix = pluralPrefixXml->value(); + } + std::string pluralPostfix = ""; + if (pluralPostfixXml) + { + pluralPostfix = pluralPostfixXml->value(); + } + c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_); + } + } + else if(tagName == "reloadableScrollingText") + { + if(type) + { + Font *font = addFont(componentXml, NULL); + std::string direction = "horizontal"; + std::string textFormat = ""; + if (textFormatXml) + { + textFormat = textFormatXml->value(); + } + if (directionXml) + { + direction = directionXml->value(); + } + float scrollingSpeed = 1.0f; + if (scrollingSpeedXml) + { + scrollingSpeed = Utils::convertFloat(scrollingSpeedXml->value()); + } + float startPosition = 0.0f; + if (startPositionXml) + { + startPosition = Utils::convertFloat(startPositionXml->value()); + } + float startTime = 0.0f; + if (startTimeXml) + { + startTime = Utils::convertFloat(startTimeXml->value()); + } + float endTime = 0.0f; + if (endTimeXml) + { + endTime = Utils::convertFloat(endTimeXml->value()); + } + std::string alignment = ""; + if (alignmentXml) + { + alignment = alignmentXml->value(); + } + c = new ReloadableScrollingText(config_, systemMode, layoutMode, type->value(), textFormat, alignment, *page, selectedOffset, font, scaleX_, scaleY_, direction, scrollingSpeed, startPosition, startTime, endTime); } } else { Font *font = addFont(componentXml, NULL); - c = new ReloadableMedia(config_, systemMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_); + c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_); xml_attribute<> *textFallback = componentXml->first_attribute("textFallback"); if(textFallback && Utils::toLower(textFallback->value()) == "true") @@ -619,9 +773,9 @@ ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml, Page &page) if(scrollOrientationXml) { std::string scrollOrientation = scrollOrientationXml->value(); - if(scrollOrientation == "horizontal") + if(scrollOrientation == "horizontal") { - menu->horizontalScroll = true; + menu->horizontalScroll = true; } } @@ -834,25 +988,33 @@ xml_attribute<> *PageBuilder::findAttribute(xml_node<> *componentXml, std::strin void PageBuilder::buildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_node<> *defaultXml) { - xml_attribute<> *x = findAttribute(componentXml, "x", defaultXml); - xml_attribute<> *y = findAttribute(componentXml, "y", defaultXml); - xml_attribute<> *xOffset = findAttribute(componentXml, "xOffset", defaultXml); - xml_attribute<> *yOffset = findAttribute(componentXml, "yOffset", defaultXml); - xml_attribute<> *xOrigin = findAttribute(componentXml, "xOrigin", defaultXml); - xml_attribute<> *yOrigin = findAttribute(componentXml, "yOrigin", defaultXml); - xml_attribute<> *height = findAttribute(componentXml, "height", defaultXml); - xml_attribute<> *width = findAttribute(componentXml, "width", defaultXml); - xml_attribute<> *fontSize = findAttribute(componentXml, "fontSize", defaultXml); - xml_attribute<> *fontColor = findAttribute(componentXml, "fontColor", defaultXml); - xml_attribute<> *minHeight = findAttribute(componentXml, "minHeight", defaultXml); - xml_attribute<> *minWidth = findAttribute(componentXml, "minWidth", defaultXml); - xml_attribute<> *maxHeight = findAttribute(componentXml, "maxHeight", defaultXml); - xml_attribute<> *maxWidth = findAttribute(componentXml, "maxWidth", defaultXml); - xml_attribute<> *alpha = findAttribute(componentXml, "alpha", defaultXml); - xml_attribute<> *angle = findAttribute(componentXml, "angle", defaultXml); - xml_attribute<> *layer = findAttribute(componentXml, "layer", defaultXml); - xml_attribute<> *backgroundColor = findAttribute(componentXml, "backgroundColor", defaultXml); - xml_attribute<> *backgroundAlpha = findAttribute(componentXml, "backgroundAlpha", defaultXml); + xml_attribute<> *x = findAttribute(componentXml, "x", defaultXml); + xml_attribute<> *y = findAttribute(componentXml, "y", defaultXml); + xml_attribute<> *xOffset = findAttribute(componentXml, "xOffset", defaultXml); + xml_attribute<> *yOffset = findAttribute(componentXml, "yOffset", defaultXml); + xml_attribute<> *xOrigin = findAttribute(componentXml, "xOrigin", defaultXml); + xml_attribute<> *yOrigin = findAttribute(componentXml, "yOrigin", defaultXml); + xml_attribute<> *height = findAttribute(componentXml, "height", defaultXml); + xml_attribute<> *width = findAttribute(componentXml, "width", defaultXml); + xml_attribute<> *fontSize = findAttribute(componentXml, "fontSize", defaultXml); + xml_attribute<> *fontColor = findAttribute(componentXml, "fontColor", defaultXml); + xml_attribute<> *minHeight = findAttribute(componentXml, "minHeight", defaultXml); + xml_attribute<> *minWidth = findAttribute(componentXml, "minWidth", defaultXml); + xml_attribute<> *maxHeight = findAttribute(componentXml, "maxHeight", defaultXml); + xml_attribute<> *maxWidth = findAttribute(componentXml, "maxWidth", defaultXml); + xml_attribute<> *alpha = findAttribute(componentXml, "alpha", defaultXml); + xml_attribute<> *angle = findAttribute(componentXml, "angle", defaultXml); + xml_attribute<> *layer = findAttribute(componentXml, "layer", defaultXml); + xml_attribute<> *backgroundColor = findAttribute(componentXml, "backgroundColor", defaultXml); + xml_attribute<> *backgroundAlpha = findAttribute(componentXml, "backgroundAlpha", defaultXml); + xml_attribute<> *reflection = findAttribute(componentXml, "reflection", defaultXml); + xml_attribute<> *reflectionDistance = findAttribute(componentXml, "reflectionDistance", defaultXml); + xml_attribute<> *reflectionScale = findAttribute(componentXml, "reflectionScale", defaultXml); + xml_attribute<> *reflectionAlpha = findAttribute(componentXml, "reflectionAlpha", defaultXml); + xml_attribute<> *containerX = findAttribute(componentXml, "containerX", defaultXml); + xml_attribute<> *containerY = findAttribute(componentXml, "containerY", defaultXml); + xml_attribute<> *containerWidth = findAttribute(componentXml, "containerWidth", defaultXml); + xml_attribute<> *containerHeight = findAttribute(componentXml, "containerHeight", defaultXml); info.X = getHorizontalAlignment(x, 0); info.Y = getVerticalAlignment(y, 0); @@ -877,14 +1039,22 @@ void PageBuilder::buildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no info.Height = getVerticalAlignment(height, -1); info.Width = getHorizontalAlignment(width, -1); } - info.FontSize = getVerticalAlignment(fontSize, -1); - info.MinHeight = getVerticalAlignment(minHeight, 0); - info.MinWidth = getHorizontalAlignment(minWidth, 0); - info.MaxHeight = getVerticalAlignment(maxHeight, FLT_MAX); - info.MaxWidth = getVerticalAlignment(maxWidth, FLT_MAX); - info.Alpha = alpha ? Utils::convertFloat(alpha->value()) : 1.f; - info.Angle = angle ? Utils::convertFloat(angle->value()) : 0.f; - info.Layer = layer ? Utils::convertInt(layer->value()) : 0; + info.FontSize = getVerticalAlignment(fontSize, -1); + info.MinHeight = getVerticalAlignment(minHeight, 0); + info.MinWidth = getHorizontalAlignment(minWidth, 0); + info.MaxHeight = getVerticalAlignment(maxHeight, FLT_MAX); + info.MaxWidth = getVerticalAlignment(maxWidth, FLT_MAX); + info.Alpha = alpha ? Utils::convertFloat(alpha->value()) : 1.f; + info.Angle = angle ? Utils::convertFloat(angle->value()) : 0.f; + info.Layer = layer ? Utils::convertInt(layer->value()) : 0; + info.Reflection = reflection ? reflection->value() : ""; + info.ReflectionDistance = reflectionDistance ? Utils::convertInt(reflectionDistance->value()) : 0; + info.ReflectionScale = reflectionScale ? Utils::convertFloat(reflectionScale->value()) : 0.25f; + info.ReflectionAlpha = reflectionAlpha ? Utils::convertFloat(reflectionAlpha->value()) : 1.f; + info.ContainerX = containerX ? Utils::convertFloat(containerX->value()) * scaleX_ : 0.f; + info.ContainerY = containerY ? Utils::convertFloat(containerY->value()) * scaleY_ : 0.f; + info.ContainerWidth = containerWidth ? Utils::convertFloat(containerWidth->value()) * scaleX_ : -1.f; + info.ContainerHeight = containerHeight ? Utils::convertFloat(containerHeight->value()) * scaleY_ : -1.f; if(fontColor) { @@ -942,22 +1112,38 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens) xml_attribute<> *to = animate->first_attribute("to"); xml_attribute<> *algorithmXml = animate->first_attribute("algorithm"); + std::string animateType; + if (type) + { + animateType = type->value(); + } + + if(!type) { Logger::write(Logger::ZONE_ERROR, "Layout", "Animate tag missing \"type\" attribute"); } - else if(!from) - { - Logger::write(Logger::ZONE_ERROR, "Layout", "Animate tag missing \"from\" attribute"); - } - else if(!to) + else if(!to && animateType != "nop") { Logger::write(Logger::ZONE_ERROR, "Layout", "Animate tag missing \"to\" attribute"); } else { - float fromValue = Utils::convertFloat(from->value()); - float toValue = Utils::convertFloat(to->value()); + float fromValue = 0.0f; + bool fromDefined = true; + if (from) + { + fromValue = Utils::convertFloat(from->value()); + } + else + { + fromDefined = false; + } + float toValue = 0.0f; + if (to) + { + toValue = Utils::convertFloat(to->value()); + } float durationValue = Utils::convertFloat(durationXml->value()); TweenAlgorithm algorithm = LINEAR; @@ -976,6 +1162,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens) case TWEEN_PROPERTY_WIDTH: case TWEEN_PROPERTY_X: case TWEEN_PROPERTY_X_OFFSET: + case TWEEN_PROPERTY_CONTAINER_X: + case TWEEN_PROPERTY_CONTAINER_WIDTH: fromValue = getHorizontalAlignment(from, 0); toValue = getHorizontalAlignment(to, 0); break; @@ -990,6 +1178,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens) case TWEEN_PROPERTY_Y: case TWEEN_PROPERTY_Y_OFFSET: case TWEEN_PROPERTY_FONT_SIZE: + case TWEEN_PROPERTY_CONTAINER_Y: + case TWEEN_PROPERTY_CONTAINER_HEIGHT: fromValue = getVerticalAlignment(from, 0); toValue = getVerticalAlignment(to, 0); break; @@ -1000,11 +1190,18 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens) toValue = getVerticalAlignment(to, 0) / screenHeight_; break; + case TWEEN_PROPERTY_MAX_WIDTH: + case TWEEN_PROPERTY_MAX_HEIGHT: + fromValue = getVerticalAlignment(from, FLT_MAX); + toValue = getVerticalAlignment(to, FLT_MAX); + default: break; } Tween *t = new Tween(property, algorithm, fromValue, toValue, durationValue); + if (!fromDefined) + t->startDefined = false; tweens.push(t); } else diff --git a/RetroFE/Source/Graphics/PageBuilder.h b/RetroFE/Source/Graphics/PageBuilder.h index bea62ff..ce390bc 100644 --- a/RetroFE/Source/Graphics/PageBuilder.h +++ b/RetroFE/Source/Graphics/PageBuilder.h @@ -33,7 +33,7 @@ class PageBuilder public: PageBuilder(std::string layoutKey, std::string layoutPage, Configuration &c, FontCache *fc); virtual ~PageBuilder(); - Page *buildPage(); + Page *buildPage( std::string collectionName = "" ); private: std::string layoutKey; diff --git a/RetroFE/Source/Graphics/ViewInfo.cpp b/RetroFE/Source/Graphics/ViewInfo.cpp index bfacb20..bd83413 100644 --- a/RetroFE/Source/Graphics/ViewInfo.cpp +++ b/RetroFE/Source/Graphics/ViewInfo.cpp @@ -43,6 +43,14 @@ ViewInfo::ViewInfo() , BackgroundGreen(0) , BackgroundBlue(0) , BackgroundAlpha(0) + , Reflection("") + , ReflectionDistance(0) + , ReflectionScale(.25) + , ReflectionAlpha(1) + , ContainerX(0) + , ContainerY(0) + , ContainerWidth(-1) + , ContainerHeight(-1) { } diff --git a/RetroFE/Source/Graphics/ViewInfo.h b/RetroFE/Source/Graphics/ViewInfo.h index 944c9b2..d59fa93 100644 --- a/RetroFE/Source/Graphics/ViewInfo.h +++ b/RetroFE/Source/Graphics/ViewInfo.h @@ -40,31 +40,39 @@ public: static const int AlignRight = -4; static const int AlignBottom = -5; - float X; - float Y; - float XOrigin; - float YOrigin; - float XOffset; - float YOffset; - float Width; - float MinWidth; - float MaxWidth; - float Height; - float MinHeight; - float MaxHeight; - float ImageWidth; - float ImageHeight; - float FontSize; - Font *font; - float Angle; - float Alpha; + float X; + float Y; + float XOrigin; + float YOrigin; + float XOffset; + float YOffset; + float Width; + float MinWidth; + float MaxWidth; + float Height; + float MinHeight; + float MaxHeight; + float ImageWidth; + float ImageHeight; + float FontSize; + Font *font; + float Angle; + float Alpha; unsigned int Layer; - float HorizontalScale; - float VerticalScale; - float BackgroundRed; - float BackgroundGreen; - float BackgroundBlue; - float BackgroundAlpha; + float HorizontalScale; + float VerticalScale; + float BackgroundRed; + float BackgroundGreen; + float BackgroundBlue; + float BackgroundAlpha; + std::string Reflection; + unsigned int ReflectionDistance; + float ReflectionScale; + float ReflectionAlpha; + float ContainerX; + float ContainerY; + float ContainerWidth; + float ContainerHeight; private: float AbsoluteHeight() const; diff --git a/RetroFE/Source/Main.cpp b/RetroFE/Source/Main.cpp index 0915f38..34588a9 100644 --- a/RetroFE/Source/Main.cpp +++ b/RetroFE/Source/Main.cpp @@ -146,6 +146,10 @@ bool ImportConfiguration(Configuration *c) { std::string prefix = "collections." + collection; + std::string infoFile = Utils::combinePath(collectionsPath, collection, "info.conf"); + + c->import(collection, prefix, infoFile, false); + std::string settingsFile = Utils::combinePath(collectionsPath, collection, "settings.conf"); if(!c->import(collection, prefix, settingsFile)) @@ -154,6 +158,7 @@ bool ImportConfiguration(Configuration *c) closedir(dp); return false; } + } } diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index ca26ed6..5cb7e0b 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -60,7 +60,7 @@ RetroFE::RetroFE(Configuration &c) , currentTime_(0) , lastLaunchReturnTime_(0) , keyLastTime_(0) - , keyDelayTime_(.3f) + , keyDelayTime_(.3f) { } @@ -90,8 +90,8 @@ int RetroFE::initialize(void *context) Logger::write(Logger::ZONE_INFO, "RetroFE", "Initializing"); - if(!instance->input_.initialize()) - { + if(!instance->input_.initialize()) + { Logger::write(Logger::ZONE_ERROR, "RetroFE", "Could not initialize user controls"); instance->initializeError = true; return -1; @@ -127,7 +127,6 @@ void RetroFE::launchEnter() } SDL_SetWindowGrab(SDL::getWindow(), SDL_FALSE); - } void RetroFE::launchExit() @@ -167,7 +166,6 @@ void RetroFE::allocateGraphicsMemory() if(currentPage_) { currentPage_->allocateGraphicsMemory(); - currentPage_->start(); } } @@ -239,8 +237,10 @@ void RetroFE::run() int initializeStatus = 0; // load the initial splash screen, unload it once it is complete - currentPage_ = loadSplashPage(); - bool splashMode = true; + currentPage_ = loadSplashPage(); + state = RETROFE_ENTER; + bool splashMode = true; + bool exitSplashMode = false; Launcher l(*this, config_); preloadTime = static_cast(SDL_GetTicks()) / 1000; @@ -254,6 +254,7 @@ void RetroFE::run() { if(input_.update(e)) { + exitSplashMode = true; attract_.reset(); } } @@ -270,15 +271,15 @@ void RetroFE::run() if(currentPage_ && !splashMode) { - // account for when returning from a menu and the previous key was still "stuck" + // account for when returning from a menu and the previous key was still "stuck" if(lastLaunchReturnTime_ == 0 || (currentTime_ - lastLaunchReturnTime_ > .3)) - { + { state = processUserInput(currentPage_); lastLaunchReturnTime_ = 0; } } - if((initialized || initializeError) && splashMode && currentPage_->getMinShowTime() <= (currentTime_ - preloadTime)) + if((initialized || initializeError) && splashMode && (exitSplashMode || (currentPage_->getMinShowTime() <= (currentTime_ - preloadTime) && !(currentPage_->isPlaying())))) { SDL_WaitThread(initializeThread, &initializeStatus); @@ -288,6 +289,22 @@ void RetroFE::run() break; } + currentPage_->stop(); + state = RETROFE_SPLASH_EXIT; + + } + break; + + case RETROFE_ENTER: + if(currentPage_->isIdle()) + { + state = RETROFE_IDLE; + } + break; + + case RETROFE_SPLASH_EXIT: + if(currentPage_->isIdle()) + { // delete the splash screen and use the standard menu currentPage_->DeInitialize(); delete currentPage_; @@ -301,8 +318,6 @@ void RetroFE::run() config_.getProperty("firstCollection", firstCollection); config_.getProperty("collections." + firstCollection + ".list.menuSort", menuSort); - - currentPage_->start(); config_.setProperty("currentCollection", firstCollection); CollectionInfo *info = getCollection(firstCollection); MenuParser mp; @@ -310,39 +325,178 @@ void RetroFE::run() mp.buildMenuItems(info, menuSort); currentPage_->pushCollection(info); + currentPage_->onNewItemSelected(); + currentPage_->start(); + + currentPage_->reallocateMenuSpritePoints(); + + state = RETROFE_ENTER; } else { state = RETROFE_QUIT_REQUEST; } - } + break; + case RETROFE_HIGHLIGHT_REQUEST: + currentPage_->highlightExit(); + currentPage_->setScrolling(Page::ScrollDirectionIdle); + state = RETROFE_HIGHLIGHT_EXIT; + break; + + case RETROFE_HIGHLIGHT_EXIT: + if ( processUserInput(currentPage_) == RETROFE_HIGHLIGHT_REQUEST) + { + state = RETROFE_HIGHLIGHT_ENTER; + } + else if (currentPage_->isGraphicsIdle() && currentPage_->isMenuScrolling()) + { + currentPage_->onNewItemSelected(); + currentPage_->highlightEnter(); + state = RETROFE_HIGHLIGHT_ENTER; + } + else if (currentPage_->isIdle()) + { + currentPage_->onNewItemSelected(); + currentPage_->highlightEnter(); + state = RETROFE_HIGHLIGHT_ENTER; + } + break; + + case RETROFE_HIGHLIGHT_ENTER: + if ( processUserInput(currentPage_) == RETROFE_HIGHLIGHT_REQUEST) + { + state = RETROFE_HIGHLIGHT_REQUEST; + } + else if (currentPage_->isGraphicsIdle()) + { + state = RETROFE_IDLE; + } break; case RETROFE_NEXT_PAGE_REQUEST: + currentPage_->exitMenu(); + state = RETROFE_NEXT_PAGE_MENU_EXIT; + break; + + case RETROFE_NEXT_PAGE_MENU_EXIT: if(currentPage_->isIdle()) { - state = RETROFE_NEW; - } - break; + // Load new layout if available + std::string layoutName; + config_.getProperty("layout", layoutName); + PageBuilder pb(layoutName, "layout", config_, &fontcache_); + Page *page = pb.buildPage( nextPageItem_->name); + std::string nextPageName = nextPageItem_->name; + if(page) + { + currentPage_->freeGraphicsMemory(); + pages_.push( currentPage_ ); + currentPage_ = page; + currentPage_->start(); + } + + bool menuSort = true; + config_.setProperty("currentCollection", nextPageName); + config_.getProperty("collections." + nextPageName + ".list.menuSort", menuSort); + + CollectionInfo *info = getCollection(nextPageName); + + MenuParser mp; + mp.buildMenuItems(info, menuSort); + currentPage_->pushCollection(info); + + bool rememberMenu = false; + config_.getProperty("rememberMenu", rememberMenu); + bool autoFavorites = true; + config_.getProperty("autoFavorites", autoFavorites); + + if (rememberMenu && lastMenuPlaylists_.find(nextPageName) != lastMenuPlaylists_.end()) + { + currentPage_->selectPlaylist(lastMenuPlaylists_[nextPageName]); // Switch to last playlist + } + else if (autoFavorites) + { + currentPage_->selectPlaylist("favorites"); // Switch to favorites playlist + } + + if(rememberMenu && lastMenuOffsets_.find(nextPageName) != lastMenuOffsets_.end()) + { + currentPage_->setScrollOffsetIndex(lastMenuOffsets_[nextPageName]); + } + + currentPage_->onNewItemSelected(); + currentPage_->reallocateMenuSpritePoints(); + if (currentPage_->getMenuDepth() != 1 ) + { + currentPage_->enterMenu(); + } + + state = RETROFE_NEXT_PAGE_MENU_ENTER; + + } + break; + + case RETROFE_NEXT_PAGE_MENU_ENTER: + if(currentPage_->isIdle()) + { + state = RETROFE_IDLE; + } + break; case RETROFE_LAUNCH_REQUEST: nextPageItem_ = currentPage_->getSelectedItem(); + launchEnter(); l.run(nextPageItem_->collectionInfo->name, nextPageItem_); + launchExit(); state = RETROFE_IDLE; break; case RETROFE_BACK_REQUEST: - - lastMenuOffsets_[currentPage_->getCollectionName()] = currentPage_->getScrollOffsetIndex(); - currentPage_->popCollection(); - config_.setProperty("currentCollection", currentPage_->getCollectionName()); - - state = RETROFE_NEW; - + if (currentPage_->getMenuDepth() == 1 ) + { + currentPage_->stop(); + } + else + { + currentPage_->exitMenu(); + } + state = RETROFE_BACK_MENU_EXIT; break; + case RETROFE_BACK_MENU_EXIT: + if(currentPage_->isIdle()) + { + lastMenuOffsets_[currentPage_->getCollectionName()] = currentPage_->getScrollOffsetIndex(); + lastMenuPlaylists_[currentPage_->getCollectionName()] = currentPage_->getPlaylistName(); + if (currentPage_->getMenuDepth() == 1) + { + currentPage_->DeInitialize(); + delete currentPage_; + currentPage_ = pages_.top(); + pages_.pop(); + currentPage_->allocateGraphicsMemory(); + } + else + { + currentPage_->popCollection(); + } + config_.setProperty("currentCollection", currentPage_->getCollectionName()); + currentPage_->onNewItemSelected(); + currentPage_->reallocateMenuSpritePoints(); + currentPage_->enterMenu(); + state = RETROFE_BACK_MENU_ENTER; + } + break; + + case RETROFE_BACK_MENU_ENTER: + if(currentPage_->isIdle()) + { + state = RETROFE_IDLE; + } + break; + case RETROFE_NEW: if(currentPage_->isIdle()) { @@ -356,11 +510,10 @@ void RetroFE::run() break; case RETROFE_QUIT: - if(currentPage_->isHidden()) + if(currentPage_->isGraphicsIdle()) { - running = false; + running = false; } - break; } @@ -384,7 +537,10 @@ void RetroFE::run() if(currentPage_) { - attract_.update(deltaTime, *currentPage_); + if (!splashMode) + { + attract_.update(deltaTime, *currentPage_); + } currentPage_->update(deltaTime); } @@ -401,7 +557,7 @@ bool RetroFE::back(bool &exit) config_.getProperty("exitOnFirstPageBack", exitOnBack); exit = false; - if(currentPage_->getMenuDepth() <= 1) + if(currentPage_->getMenuDepth() <= 1 && pages_.empty()) { exit = exitOnBack; } @@ -419,9 +575,6 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page) bool exit = false; RETROFE_STATE state = RETROFE_IDLE; - bool rememberMenu = false; - config_.getProperty("rememberMenu", rememberMenu); - if(page->isHorizontalScroll()) { if (input_.keystate(UserInput::KeyCodeLeft)) @@ -431,136 +584,135 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page) if (input_.keystate(UserInput::KeyCodeRight)) { page->setScrolling(Page::ScrollDirectionForward); - } + } } else - { + { if (input_.keystate(UserInput::KeyCodeUp)) { page->setScrolling(Page::ScrollDirectionBack); } if (input_.keystate(UserInput::KeyCodeDown)) { - page->setScrolling(Page::ScrollDirectionForward); + page->setScrolling(Page::ScrollDirectionForward); } } - if (!input_.keystate(UserInput::KeyCodePageUp) && - !input_.keystate(UserInput::KeyCodePageDown) && - !input_.keystate(UserInput::KeyCodeLetterUp) && - !input_.keystate(UserInput::KeyCodeLetterDown) && - !input_.keystate(UserInput::KeyCodeNextPlaylist) && - !input_.keystate(UserInput::KeyCodeAddPlaylist) && - !input_.keystate(UserInput::KeyCodeRemovePlaylist) && - !input_.keystate(UserInput::KeyCodeRandom)) + if(page->isMenuIdle()) { - keyLastTime_ = 0; - keyDelayTime_= 0.3f; - } - else if((currentTime_ - keyLastTime_) > keyDelayTime_ || keyLastTime_ == 0) - { - keyLastTime_ = currentTime_; - keyDelayTime_-= .05f; - if(keyDelayTime_< 0.1f) keyDelayTime_= 0.1f; - - if (input_.keystate(UserInput::KeyCodePageUp)) + if (!input_.keystate(UserInput::KeyCodePageUp) && + !input_.keystate(UserInput::KeyCodePageDown) && + !input_.keystate(UserInput::KeyCodeLetterUp) && + !input_.keystate(UserInput::KeyCodeLetterDown) && + !input_.keystate(UserInput::KeyCodeNextPlaylist) && + !input_.keystate(UserInput::KeyCodeAddPlaylist) && + !input_.keystate(UserInput::KeyCodeRemovePlaylist) && + !input_.keystate(UserInput::KeyCodeRandom)) { - page->pageScroll(Page::ScrollDirectionBack); + keyLastTime_ = 0; + keyDelayTime_= 0.3f; } - if (input_.keystate(UserInput::KeyCodePageDown)) - { - page->pageScroll(Page::ScrollDirectionForward); - } - if (input_.keystate(UserInput::KeyCodeLetterUp)) - { - page->letterScroll(Page::ScrollDirectionBack); - } - if (input_.keystate(UserInput::KeyCodeLetterDown)) - { - page->letterScroll(Page::ScrollDirectionForward); - } - if(input_.newKeyPressed(UserInput::KeyCodeNextPlaylist)) - { - page->nextPlaylist(); - } - if(input_.newKeyPressed(UserInput::KeyCodeRemovePlaylist)) - { - page->removePlaylist(); - } - if(input_.newKeyPressed(UserInput::KeyCodeAddPlaylist)) - { - page->addPlaylist(); - } - if(input_.keystate(UserInput::KeyCodeRandom)) - { - page->selectRandom(); - } - } - if (input_.keystate(UserInput::KeyCodeAdminMode)) - { - //todo: add admin mode support - } - if (input_.keystate(UserInput::KeyCodeSelect) && page->isMenuIdle()) - { - nextPageItem_ = page->getSelectedItem(); - - if(nextPageItem_) + else if((currentTime_ - keyLastTime_) > keyDelayTime_ || keyLastTime_ == 0) { - if(nextPageItem_->leaf) + keyLastTime_ = currentTime_; + keyDelayTime_-= .05f; + if(keyDelayTime_< 0.1f) keyDelayTime_= 0.1f; + + if (input_.keystate(UserInput::KeyCodePageUp)) { - state = RETROFE_LAUNCH_REQUEST; + page->pageScroll(Page::ScrollDirectionBack); + page->reallocateMenuSpritePoints(); + state = RETROFE_HIGHLIGHT_REQUEST; } - else + if (input_.keystate(UserInput::KeyCodePageDown)) { - bool menuSort = true; - config_.setProperty("currentCollection", nextPageItem_->name); - config_.getProperty("collections." + nextPageItem_->name + ".list.menuSort", menuSort); + page->pageScroll(Page::ScrollDirectionForward); + page->reallocateMenuSpritePoints(); + state = RETROFE_HIGHLIGHT_REQUEST; + } + if (input_.keystate(UserInput::KeyCodeLetterUp)) + { + page->letterScroll(Page::ScrollDirectionBack); + page->reallocateMenuSpritePoints(); + state = RETROFE_HIGHLIGHT_REQUEST; + } + if (input_.keystate(UserInput::KeyCodeLetterDown)) + { + page->letterScroll(Page::ScrollDirectionForward); + page->reallocateMenuSpritePoints(); + state = RETROFE_HIGHLIGHT_REQUEST; + } + if(input_.newKeyPressed(UserInput::KeyCodeNextPlaylist)) + { + page->nextPlaylist(); + page->reallocateMenuSpritePoints(); + state = RETROFE_HIGHLIGHT_REQUEST; + } + if(input_.newKeyPressed(UserInput::KeyCodeRemovePlaylist)) + { + page->removePlaylist(); + page->onNewItemSelected(); + page->reallocateMenuSpritePoints(); + } + if(input_.newKeyPressed(UserInput::KeyCodeAddPlaylist)) + { + page->addPlaylist(); + page->reallocateMenuSpritePoints(); + } + if(input_.keystate(UserInput::KeyCodeRandom)) + { + page->selectRandom(); + page->reallocateMenuSpritePoints(); + state = RETROFE_HIGHLIGHT_REQUEST; + } + } - CollectionInfo *info = getCollection(nextPageItem_->name); + if (input_.keystate(UserInput::KeyCodeAdminMode)) + { + //todo: add admin mode support + } + if (input_.keystate(UserInput::KeyCodeSelect)) + { + nextPageItem_ = page->getSelectedItem(); - MenuParser mp; - mp.buildMenuItems(info, menuSort); - page->pushCollection(info); - - if(rememberMenu && lastMenuOffsets_.find(nextPageItem_->name) != lastMenuOffsets_.end()) + if(nextPageItem_) + { + if(nextPageItem_->leaf) { - page->setScrollOffsetIndex(lastMenuOffsets_[nextPageItem_->name]); + state = RETROFE_LAUNCH_REQUEST; + } + else + { + state = RETROFE_NEXT_PAGE_REQUEST; } - - bool autoFavorites = true; - config_.getProperty("autoFavorites", autoFavorites); - - if (autoFavorites) - page->favPlaylist(); // Switch to favorites if it exists - - state = RETROFE_NEXT_PAGE_REQUEST; } } - } - if (input_.keystate(UserInput::KeyCodeBack) && page->isMenuIdle()) - { - if(back(exit) || exit) + if (input_.keystate(UserInput::KeyCodeBack)) { - state = (exit) ? RETROFE_QUIT_REQUEST : RETROFE_BACK_REQUEST; + if(back(exit) || exit) + { + state = (exit) ? RETROFE_QUIT_REQUEST : RETROFE_BACK_REQUEST; + } } - } - if (input_.keystate(UserInput::KeyCodeQuit)) - { - state = RETROFE_QUIT_REQUEST; + if (input_.keystate(UserInput::KeyCodeQuit)) + { + state = RETROFE_QUIT_REQUEST; + } } if(!input_.keystate(UserInput::KeyCodeUp) && - !input_.keystate(UserInput::KeyCodeLeft) && - !input_.keystate(UserInput::KeyCodeDown) && - !input_.keystate(UserInput::KeyCodeRight) && - !input_.keystate(UserInput::KeyCodePageUp) && - !input_.keystate(UserInput::KeyCodePageDown)) + !input_.keystate(UserInput::KeyCodeLeft) && + !input_.keystate(UserInput::KeyCodeDown) && + !input_.keystate(UserInput::KeyCodeRight) && + !input_.keystate(UserInput::KeyCodePageUp) && + !input_.keystate(UserInput::KeyCodePageDown)) { - page->setScrolling(Page::ScrollDirectionIdle); + if (page->isMenuScrolling()) + state = RETROFE_HIGHLIGHT_REQUEST; } return state; @@ -579,10 +731,6 @@ Page *RetroFE::loadPage() { Logger::write(Logger::ZONE_ERROR, "RetroFE", "Could not create page"); } - else - { - page->start(); - } return page; } diff --git a/RetroFE/Source/RetroFE.h b/RetroFE/Source/RetroFE.h index f00d529..3e33e4c 100644 --- a/RetroFE/Source/RetroFE.h +++ b/RetroFE/Source/RetroFE.h @@ -25,7 +25,7 @@ #include "Video/VideoFactory.h" #include #include -#include +#include #include class CollectionInfo; @@ -52,9 +52,18 @@ private: enum RETROFE_STATE { RETROFE_IDLE, + RETROFE_ENTER, + RETROFE_SPLASH_EXIT, + RETROFE_HIGHLIGHT_REQUEST, + RETROFE_HIGHLIGHT_EXIT, + RETROFE_HIGHLIGHT_ENTER, RETROFE_NEXT_PAGE_REQUEST, + RETROFE_NEXT_PAGE_MENU_EXIT, + RETROFE_NEXT_PAGE_MENU_ENTER, RETROFE_LAUNCH_REQUEST, RETROFE_BACK_REQUEST, + RETROFE_BACK_MENU_EXIT, + RETROFE_BACK_MENU_ENTER, RETROFE_NEW, RETROFE_QUIT_REQUEST, RETROFE_QUIT, @@ -74,6 +83,7 @@ private: MetadataDatabase *metadb_; UserInput input_; Page *currentPage_; + std::stack pages_; float keyInputDisable_; float currentTime_; float lastLaunchReturnTime_; @@ -83,5 +93,6 @@ private: FontCache fontcache_; AttractMode attract_; std::map lastMenuOffsets_; + std::map lastMenuPlaylists_; }; diff --git a/RetroFE/Source/SDL.cpp b/RetroFE/Source/SDL.cpp index e74fe3a..eeefe60 100644 --- a/RetroFE/Source/SDL.cpp +++ b/RetroFE/Source/SDL.cpp @@ -255,8 +255,12 @@ SDL_Window* SDL::getWindow() return window_; } -bool SDL::renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, SDL_Rect *dest, double angle) +bool SDL::renderCopy(SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect *dest, ViewInfo &viewInfo) { + + SDL_Rect srcRect; + SDL_Rect dstRect; + SDL_Rect rotateRect; rotateRect.w = dest->w; rotateRect.h = dest->h; @@ -272,8 +276,98 @@ bool SDL::renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, S rotateRect.y = dest->y; } - SDL_SetTextureAlphaMod(texture, alpha); - SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_NONE); + // Create the base fields to check against the container. + if (src) + { + srcRect.x = src->x; + srcRect.y = src->y; + srcRect.w = src->w; + srcRect.h = src->h; + } + else + { + srcRect.x = 0; + srcRect.y = 0; + int w = 0; + int h = 0; + SDL_QueryTexture(texture, NULL, NULL, &w, &h); + srcRect.w = w; + srcRect.h = h; + } + dstRect.x = rotateRect.x; + dstRect.y = rotateRect.y; + dstRect.w = rotateRect.w; + dstRect.h = rotateRect.h; + + // If a container has been defined, limit the display to the container boundaries. + if (viewInfo.ContainerWidth > 0 && viewInfo.ContainerHeight > 0 && + rotateRect.w > 0 && rotateRect.h > 0) + { + + // Correct if the image falls to the left of the container + if (dstRect.x < viewInfo.ContainerX) + { + dstRect.x = static_cast(viewInfo.ContainerX); + srcRect.x = srcRect.x + srcRect.w * (dstRect.x - rotateRect.x) / rotateRect.w; + } + + // Correct if the image falls to the right of the container + if (rotateRect.x + rotateRect.w > viewInfo.ContainerX + viewInfo.ContainerWidth) + { + dstRect.w = static_cast(viewInfo.ContainerX + viewInfo.ContainerWidth) - dstRect.x; + srcRect.w = srcRect.w * dstRect.w / rotateRect.w; + } + + // Correct if the image falls to the top of the container + if (dstRect.y < viewInfo.ContainerY) + { + dstRect.y = static_cast(viewInfo.ContainerY); + srcRect.y = srcRect.y + srcRect.h * (dstRect.y - rotateRect.y) / rotateRect.h; + } + + // Correct if the image falls to the bottom of the container + if (rotateRect.y + rotateRect.h > viewInfo.ContainerY + viewInfo.ContainerHeight) + { + dstRect.h = static_cast(viewInfo.ContainerY + viewInfo.ContainerHeight) - dstRect.y; + srcRect.h = srcRect.h * dstRect.h / rotateRect.h; + } + + } + + SDL_SetTextureAlphaMod(texture, static_cast(alpha * 255)); + SDL_RenderCopyEx(getRenderer(), texture, &srcRect, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_NONE); + + if (viewInfo.Reflection == "top") + { + rotateRect.h = static_cast(static_cast(rotateRect.h) * viewInfo.ReflectionScale); + rotateRect.y = rotateRect.y - rotateRect.h - viewInfo.ReflectionDistance; + SDL_SetTextureAlphaMod(texture, static_cast(viewInfo.ReflectionAlpha * alpha * 255)); + SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, viewInfo.Angle, NULL, SDL_FLIP_VERTICAL); + } + + if (viewInfo.Reflection == "bottom") + { + rotateRect.y = rotateRect.y + rotateRect.h + viewInfo.ReflectionDistance; + rotateRect.h = static_cast(static_cast(rotateRect.h) * viewInfo.ReflectionScale); + SDL_SetTextureAlphaMod(texture, static_cast(viewInfo.ReflectionAlpha * alpha * 255)); + SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, viewInfo.Angle, NULL, SDL_FLIP_VERTICAL); + } + + if (viewInfo.Reflection == "left") + { + rotateRect.w = static_cast(static_cast(rotateRect.w) * viewInfo.ReflectionScale); + rotateRect.x = rotateRect.x - rotateRect.w - viewInfo.ReflectionDistance; + SDL_SetTextureAlphaMod(texture, static_cast(viewInfo.ReflectionAlpha * alpha * 255)); + SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, viewInfo.Angle, NULL, SDL_FLIP_HORIZONTAL); + } + + if (viewInfo.Reflection == "right") + { + rotateRect.x = rotateRect.x + rotateRect.w + viewInfo.ReflectionDistance; + rotateRect.w = static_cast(static_cast(rotateRect.w) * viewInfo.ReflectionScale); + SDL_SetTextureAlphaMod(texture, static_cast(viewInfo.ReflectionAlpha * alpha * 255)); + SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, viewInfo.Angle, NULL, SDL_FLIP_HORIZONTAL); + } return true; } diff --git a/RetroFE/Source/SDL.h b/RetroFE/Source/SDL.h index 14b1a4c..87b20c6 100644 --- a/RetroFE/Source/SDL.h +++ b/RetroFE/Source/SDL.h @@ -15,6 +15,8 @@ */ #pragma once #include +#include +#include "Graphics/ViewInfo.h" // todo: this wrapper could be cleaned up class Configuration; @@ -27,7 +29,7 @@ public: static SDL_Renderer *getRenderer(); static SDL_mutex *getMutex(); static SDL_Window *getWindow(); - static bool renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, SDL_Rect *dest, double angle); + static bool renderCopy(SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect *dest, ViewInfo &viewInfo); static int getWindowWidth() { return windowWidth_; diff --git a/RetroFE/Source/Sound/Sound.cpp b/RetroFE/Source/Sound/Sound.cpp index ef39483..02861c7 100644 --- a/RetroFE/Source/Sound/Sound.cpp +++ b/RetroFE/Source/Sound/Sound.cpp @@ -18,13 +18,17 @@ #include "../Utility/Log.h" -Sound::Sound(std::string file) +Sound::Sound(std::string file, std::string altfile) : file_(file) , chunk_(NULL) { if(!allocate()) { - Logger::write(Logger::ZONE_ERROR, "Sound", "Cannot load " + file_); + file_ = altfile; + if (!allocate()) + { + Logger::write(Logger::ZONE_ERROR, "Sound", "Cannot load " + file_); + } } } diff --git a/RetroFE/Source/Sound/Sound.h b/RetroFE/Source/Sound/Sound.h index 55525d4..3f06682 100644 --- a/RetroFE/Source/Sound/Sound.h +++ b/RetroFE/Source/Sound/Sound.h @@ -20,7 +20,7 @@ class Sound { public: - Sound(std::string file); + Sound(std::string file, std::string altfile); virtual ~Sound(); void play(); bool allocate(); diff --git a/RetroFE/Source/Video/GStreamerVideo.cpp b/RetroFE/Source/Video/GStreamerVideo.cpp index 017aee8..0b223f1 100644 --- a/RetroFE/Source/Video/GStreamerVideo.cpp +++ b/RetroFE/Source/Video/GStreamerVideo.cpp @@ -390,6 +390,10 @@ void GStreamerVideo::update(float /* dt */) GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); } + else + { + isPlaying_ = false; + } } gst_message_unref(msg); @@ -397,3 +401,8 @@ void GStreamerVideo::update(float /* dt */) } } + +bool GStreamerVideo::isPlaying() +{ + return isPlaying_; +} \ No newline at end of file diff --git a/RetroFE/Source/Video/GStreamerVideo.h b/RetroFE/Source/Video/GStreamerVideo.h index adccdee..ba2a261 100644 --- a/RetroFE/Source/Video/GStreamerVideo.h +++ b/RetroFE/Source/Video/GStreamerVideo.h @@ -40,6 +40,7 @@ public: void freeElements(); int getHeight(); int getWidth(); + bool isPlaying(); private: static void processNewBuffer (GstElement *fakesink, GstBuffer *buf, GstPad *pad, gpointer data);