mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 09:19:12 +01:00
pch migration to modules [wip]
This commit is contained in:
78
launcher/vehicle_picker.cppm
Normal file
78
launcher/vehicle_picker.cppm
Normal file
@@ -0,0 +1,78 @@
|
||||
module;
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "utilities/translation_macros.h"
|
||||
|
||||
export module eu07.launcher.vehicle_picker;
|
||||
import eu07.launcher.deferred_image;
|
||||
import eu07.application.uilayer;
|
||||
import eu07.launcher.textures_scanner;
|
||||
import eu07.utilities.translation;
|
||||
|
||||
export {
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
class vehiclepicker_panel : public ui_panel
|
||||
{
|
||||
public:
|
||||
vehiclepicker_panel();
|
||||
|
||||
void render_contents() override;
|
||||
|
||||
private:
|
||||
bool selectable_image(const char *desc, bool selected, const deferred_image *image, const skin_set *pickable = nullptr);
|
||||
|
||||
vehicle_type selected_type = vehicle_type::none;
|
||||
std::shared_ptr<const vehicle_desc> selected_vehicle;
|
||||
const std::string *selected_group = nullptr;
|
||||
const skin_set *selected_skinset = nullptr;
|
||||
bool display_by_groups = true;
|
||||
deferred_image placeholder_mini;
|
||||
std::array<char, 128> search_query = { 0 };
|
||||
std::map<vehicle_type, std::string> type_names =
|
||||
{
|
||||
{ vehicle_type::electric_loco, STRN("Electric locos") },
|
||||
{ vehicle_type::diesel_loco, STRN("Diesel locos") },
|
||||
{ vehicle_type::steam_loco, STRN("Steam locos") },
|
||||
{ vehicle_type::railcar, STRN("Railcars") },
|
||||
{ vehicle_type::emu, STRN("EMU") },
|
||||
{ vehicle_type::utility, STRN("Utility") },
|
||||
{ vehicle_type::draisine, STRN("Draisines") },
|
||||
{ vehicle_type::tram, STRN("Trams") },
|
||||
{ vehicle_type::carriage, STRN("Carriages") },
|
||||
{ vehicle_type::truck, STRN("Trucks") },
|
||||
{ vehicle_type::bus, STRN("Buses") },
|
||||
{ vehicle_type::car, STRN("Cars") },
|
||||
{ vehicle_type::man, STRN("People") },
|
||||
{ vehicle_type::animal, STRN("Animals") },
|
||||
{ vehicle_type::unknown, STRN("Unknown") }
|
||||
};
|
||||
|
||||
vehicles_bank bank;
|
||||
|
||||
struct search_info
|
||||
{
|
||||
enum
|
||||
{
|
||||
TEXT,
|
||||
YEAR_MIN,
|
||||
YEAR_MAX
|
||||
} mode = TEXT;
|
||||
bool alternative = false;
|
||||
bool negation = false;
|
||||
|
||||
std::string text;
|
||||
int number;
|
||||
};
|
||||
|
||||
std::vector<search_info> parse_search_query(const std::string &str);
|
||||
bool skin_filter(const skin_set *skin, std::vector<search_info> &info_list);
|
||||
};
|
||||
} // namespace ui
|
||||
|
||||
} // export
|
||||
Reference in New Issue
Block a user