From 791ebed6017b8846f8bd63c323c12a5c56fe14b9 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sun, 3 Jul 2016 19:27:05 -0400 Subject: control save/load, tracking default config --- brice.dat | 8 ++++---- config/controls.dat | 6 ++++++ src/ui_menu.cpp | 19 +++++++------------ xml/!town.xml | 4 ++-- 4 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 config/controls.dat diff --git a/brice.dat b/brice.dat index 2653f9c..3b090ad 100644 --- a/brice.dat +++ b/brice.dat @@ -1,7 +1,7 @@ 3 -Slow -1 -canJump -0 canSprint 0 +canJump +0 +Slow +1 diff --git a/config/controls.dat b/config/controls.dat new file mode 100644 index 0000000..679c014 --- /dev/null +++ b/config/controls.dat @@ -0,0 +1,6 @@ +119 +97 +100 +1073742049 +1073742048 +101 diff --git a/src/ui_menu.cpp b/src/ui_menu.cpp index 2419ed2..ca830d8 100644 --- a/src/ui_menu.cpp +++ b/src/ui_menu.cpp @@ -63,12 +63,7 @@ void initControls(Menu *m) for (const auto &l : cfg) { z = static_cast(std::stoi(l)); setControl(i, z); - std::cout<<"1\n"; - auto fs = sym2str(z); - std::cout<<"2 " << i << "\n"; - std::cout<items[i].button.text<<'\n'; - m->items[i++].button.text += fs; - std::cout<<"3\n"; + m->items[i++].button.text += sym2str(z); } } @@ -175,12 +170,12 @@ namespace ui { optionsMenu.parent = &pauseMenu; // Create the controls menu - controlsMenu.items.push_back(ui::menu::createButton({-450,300}, {400, 75}, {0.0f, 0.0f, 0.0f}, "Left: ", nullptr)); - controlsMenu.items.back().button.func = [](){ setControlF(1, controlsMenu.items[0]); }; - controlsMenu.items.push_back(ui::menu::createButton({-450,200}, {400, 75}, {0.0f, 0.0f, 0.0f}, "Right: ", nullptr)); - controlsMenu.items.back().button.func = [](){ setControlF(2, controlsMenu.items[1]); }; - controlsMenu.items.push_back(ui::menu::createButton({-450,100}, {400, 75}, {0.0f, 0.0f, 0.0f}, "Up: ", nullptr)); - controlsMenu.items.back().button.func = [](){ setControlF(0, controlsMenu.items[2]); }; + controlsMenu.items.push_back(ui::menu::createButton({-450,300}, {400, 75}, {0.0f, 0.0f, 0.0f}, "Up: ", nullptr)); + controlsMenu.items.back().button.func = [](){ setControlF(0, controlsMenu.items[0]); }; + controlsMenu.items.push_back(ui::menu::createButton({-450,200}, {400, 75}, {0.0f, 0.0f, 0.0f}, "Left: ", nullptr)); + controlsMenu.items.back().button.func = [](){ setControlF(1, controlsMenu.items[1]); }; + controlsMenu.items.push_back(ui::menu::createButton({-450,100}, {400, 75}, {0.0f, 0.0f, 0.0f}, "Right: ", nullptr)); + controlsMenu.items.back().button.func = [](){ setControlF(2, controlsMenu.items[2]); }; controlsMenu.items.push_back(ui::menu::createButton({-450,0}, {400, 75}, {0.0f, 0.0f, 0.0f}, "Sprint: ", nullptr)); controlsMenu.items.back().button.func = [](){ setControlF(3, controlsMenu.items[3]); }; controlsMenu.items.push_back(ui::menu::createButton({-450,-100}, {400, 75}, {0.0f, 0.0f, 0.0f}, "Creep: ", nullptr)); diff --git a/xml/!town.xml b/xml/!town.xml index e3a6a20..d9bed58 100644 --- a/xml/!town.xml +++ b/xml/!town.xml @@ -4,8 +4,8 @@ -300 - - + + -- cgit v1.2.3