mirror of
https://github.com/risingPhil/PokeMe64.git
synced 2026-04-24 15:06:57 -05:00
It doesn't look like much, but it's functional ;-) It can inject distribution pokémon into gen 1 and gen 2 original cartridges and inject the GS ball in Pokémon Crystal. That's it. But that was the minimal feature set I had in mind for the project. In the Readme.md you can find the ideas I have for expanding the project. But the first priority is the UI, because it really looks bad right now. (as I was mostly focused on building blocks and transfer pak functionality. Not on making it looks good)
54 lines
1.5 KiB
C++
Executable File
54 lines
1.5 KiB
C++
Executable File
#ifndef _LISTITEMFILLER_H
|
|
#define _LISTITEMFILLER_H
|
|
|
|
#include <vector>
|
|
#include <libdragon.h>
|
|
|
|
/**
|
|
* This template class simply serves the purpose of filling the specified ListType with widgets of the given ListItemWidgetType by creating
|
|
* these list item widgets based on a list of ListDataType entries and a ListItemWidgetStyleType
|
|
*
|
|
* ListType must have a function called addWidget(ListItemWidgetType)
|
|
* ListItemWidgetStyleType must have a setData(ListDataType) function
|
|
* AND a setStyle(ListItemWidgetStyleType) function
|
|
*
|
|
* ... in order to be able to use the ListItemFiller template class
|
|
*/
|
|
template<typename ListType, typename ListDataType, typename ListItemWidgetType, typename ListItemWidgetStyleType>
|
|
class ListItemFiller
|
|
{
|
|
public:
|
|
ListItemFiller(ListType& list)
|
|
: list_(list)
|
|
, widgets_()
|
|
{
|
|
}
|
|
|
|
~ListItemFiller()
|
|
{
|
|
for(ListItemWidgetType* item : widgets_)
|
|
{
|
|
delete item;
|
|
}
|
|
widgets_.clear();
|
|
}
|
|
|
|
void addItems(ListDataType* dataList, size_t dataListSize, const MenuItemStyle& itemStyle)
|
|
{
|
|
ListItemWidgetType* itemWidget;
|
|
for(size_t i = 0; i < dataListSize; ++i)
|
|
{
|
|
itemWidget = new ListItemWidgetType();
|
|
itemWidget->setData(dataList[i]);
|
|
itemWidget->setStyle(itemStyle);
|
|
list_.addWidget(itemWidget);
|
|
}
|
|
}
|
|
protected:
|
|
private:
|
|
ListType& list_;
|
|
std::vector<ListItemWidgetType*> widgets_;
|
|
};
|
|
|
|
#endif
|