mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 02:08:52 +01:00
Adding button to add to playlists (does not yet save favorites.txt yet)
This commit is contained in:
parent
bf1286653a
commit
24d4b37cf7
@ -7,6 +7,7 @@ pageDown = B
|
||||
letterUp = N
|
||||
letterDown = M
|
||||
nextPlaylist = P
|
||||
addPlaylist = O
|
||||
random = R
|
||||
select = Space
|
||||
back = Escape
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
<!-----------------MAIN MENU Section----------------->
|
||||
<!-- This is the title text that shows at the bottom of the main menu list. -->
|
||||
<reloadableText type="title" x="center" y="center" xOrigin="center" yOrigin="center" yOffset="394" fontSize="48" layer="5">
|
||||
<reloadableText type="playlist" x="center" y="center" xOrigin="center" yOrigin="center" yOffset="394" fontSize="48" layer="5">
|
||||
<onMenuEnter menuIndex="0">
|
||||
<set duration=".2">
|
||||
<animate type="alpha" from="0" to="1" algorithm="easeinquadratic"/>
|
||||
@ -367,4 +367,4 @@
|
||||
</onHighlightExit>
|
||||
</reloadableVideo>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
||||
@ -66,15 +66,17 @@ bool UserInput::initialize()
|
||||
retVal = MapKey("down", KeyCodeRight) && retVal;
|
||||
}
|
||||
|
||||
retVal = MapKey("pageDown", KeyCodePageDown) && retVal;
|
||||
retVal = MapKey("pageUp", KeyCodePageUp) && retVal;
|
||||
MapKey("letterDown", KeyCodeLetterDown);
|
||||
MapKey("letterUp", KeyCodeLetterUp);
|
||||
retVal = MapKey("select", KeyCodeSelect) && retVal;
|
||||
retVal = MapKey("back", KeyCodeBack) && retVal;
|
||||
retVal = MapKey("quit", KeyCodeQuit) && retVal;
|
||||
MapKey("nextPlaylist", KeyCodeNextPlaylist);
|
||||
MapKey("random", KeyCodeRandom);
|
||||
retVal = MapKey("pageDown", KeyCodePageDown);
|
||||
retVal = MapKey("pageUp", KeyCodePageUp);
|
||||
|
||||
MapKey("letterDown", KeyCodeLetterDown, false);
|
||||
MapKey("letterUp", KeyCodeLetterUp, false);
|
||||
MapKey("nextPlaylist", KeyCodeNextPlaylist, false);
|
||||
MapKey("addPlaylist", KeyCodeAddPlaylist, false);
|
||||
MapKey("random", KeyCodeRandom, false);
|
||||
// these features will need to be implemented at a later time
|
||||
// retVal = MapKey("admin", KeyCodeAdminMode) && retVal;
|
||||
// retVal = MapKey("remove", KeyCodeHideItem) && retVal;
|
||||
@ -89,6 +91,11 @@ bool UserInput::initialize()
|
||||
}
|
||||
|
||||
bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
|
||||
{
|
||||
return MapKey(keyDescription, key, true);
|
||||
}
|
||||
|
||||
bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required)
|
||||
{
|
||||
SDL_Scancode scanCode;
|
||||
std::string description;
|
||||
@ -97,7 +104,8 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
|
||||
|
||||
if(!config_.getProperty(configKey, description))
|
||||
{
|
||||
Logger::write(Logger::ZONE_ERROR, "Input", "Missing property " + configKey);
|
||||
Logger::Zone zone = (required) ? Logger::ZONE_ERROR : Logger::ZONE_INFO;
|
||||
Logger::write(zone, "Input", "Missing property " + configKey);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ public:
|
||||
KeyCodeLetterUp,
|
||||
KeyCodeNextPlaylist,
|
||||
KeyCodeRandom,
|
||||
KeyCodeAddPlaylist,
|
||||
KeyCodeAdminMode,
|
||||
KeyCodeHideItem,
|
||||
KeyCodeQuit,
|
||||
@ -56,6 +57,7 @@ public:
|
||||
|
||||
private:
|
||||
bool MapKey(std::string keyDescription, KeyCode_E key);
|
||||
bool MapKey(std::string keyDescription, KeyCode_E key, bool required);
|
||||
Configuration &config_;
|
||||
std::vector<SDL_Joystick *> joysticks_;
|
||||
InputHandler *keyHandlers_[KeyCodeMax];
|
||||
|
||||
@ -129,12 +129,14 @@ void ScrollingList::setItems(std::vector<Item *> *items)
|
||||
deallocateSpritePoints();
|
||||
|
||||
items_ = items;
|
||||
itemIndex_ = 0;
|
||||
if(items_)
|
||||
{
|
||||
itemIndex_ = loopDecrement(0, selectedOffsetIndex_, items_->size());
|
||||
}
|
||||
|
||||
allocateSpritePoints();
|
||||
|
||||
notifyAllRequested_ = true;
|
||||
|
||||
}
|
||||
|
||||
unsigned int ScrollingList::loopIncrement(unsigned int offset, unsigned int i, unsigned int size)
|
||||
@ -215,6 +217,11 @@ void ScrollingList::setPoints(std::vector<ViewInfo *> *scrollPoints, std::vector
|
||||
if(scrollPoints) size = scrollPoints_->size();
|
||||
components_.resize(size);
|
||||
|
||||
if(items_)
|
||||
{
|
||||
itemIndex_ = loopDecrement(0, selectedOffsetIndex_, items_->size());
|
||||
}
|
||||
|
||||
allocateSpritePoints();
|
||||
}
|
||||
|
||||
|
||||
@ -79,12 +79,12 @@ public:
|
||||
void setScrollAcceleration(float value);
|
||||
void setStartScrollTime(float value);
|
||||
bool horizontalScroll;
|
||||
void deallocateSpritePoints();
|
||||
void allocateSpritePoints();
|
||||
|
||||
|
||||
private:
|
||||
void click(double nextScrollTime);
|
||||
void deallocateSpritePoints();
|
||||
void allocateSpritePoints();
|
||||
void resetTweens(Component *c, AnimationEvents *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime);
|
||||
unsigned int loopIncrement(unsigned int offset, unsigned int i, unsigned int size);
|
||||
unsigned int loopDecrement(unsigned int offset, unsigned int i, unsigned int size);
|
||||
|
||||
@ -645,6 +645,25 @@ void Page::draw()
|
||||
|
||||
}
|
||||
|
||||
void Page::addPlaylist()
|
||||
{
|
||||
if(!selectedItem_) return;
|
||||
|
||||
MenuInfo_S &info = collections_.back();
|
||||
CollectionInfo *collection = info.collection;
|
||||
|
||||
std::vector<Item *> *items = collection->playlists["favorites"];
|
||||
if(playlist_->first != "favorites" && std::find(items->begin(), items->end(), selectedItem_) == items->end())
|
||||
{
|
||||
items->push_back(selectedItem_);
|
||||
if(activeMenu_)
|
||||
{
|
||||
activeMenu_->deallocateSpritePoints();
|
||||
activeMenu_->allocateSpritePoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string Page::getCollectionName()
|
||||
{
|
||||
if(collections_.size() == 0) return "";
|
||||
|
||||
@ -80,6 +80,7 @@ public:
|
||||
std::string getCollectionName();
|
||||
void setMinShowTime(float value);
|
||||
float getMinShowTime();
|
||||
void addPlaylist();
|
||||
|
||||
private:
|
||||
void highlight();
|
||||
|
||||
@ -449,6 +449,7 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
||||
!input_.keystate(UserInput::KeyCodeLetterUp) &&
|
||||
!input_.keystate(UserInput::KeyCodeLetterDown) &&
|
||||
!input_.keystate(UserInput::KeyCodeNextPlaylist) &&
|
||||
!input_.keystate(UserInput::KeyCodeAddPlaylist) &&
|
||||
!input_.keystate(UserInput::KeyCodeRandom))
|
||||
{
|
||||
keyLastTime_ = 0;
|
||||
@ -481,6 +482,10 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
||||
{
|
||||
page->nextPlaylist();
|
||||
}
|
||||
if(input_.keystate(UserInput::KeyCodeAddPlaylist))
|
||||
{
|
||||
page->addPlaylist();
|
||||
}
|
||||
if(input_.keystate(UserInput::KeyCodeRandom))
|
||||
{
|
||||
page->selectRandom();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user