@@ -22,6 +22,9 @@ Source information and contacts persons can be found at
2222*/
2323
2424#include " PuzzleEditorState.hpp"
25+
26+ #include < unistd.h>
27+
2528#include " imgui.h"
2629#include " backends/imgui_impl_sdl2.h"
2730#include " backends/imgui_impl_sdlrenderer2.h"
@@ -50,6 +53,10 @@ void PuzzleEditorState::SelectFile(const std::string& file) {
5053 this ->selected_file = file;
5154 PuzzleSetName (file);
5255 LoadPuzzleStages ();
56+ read_only = false ;
57+ if (file == " puzzle.levels" ) {
58+ read_only = true ;
59+ }
5360}
5461
5562static void LogicalToPhysical (const sago::SagoLogicalResize& resize, ImVec2& inout) {
@@ -154,6 +161,37 @@ void PuzzleEditorState::Draw(SDL_Renderer* target) {
154161 }
155162 }
156163 ImGui::End ();
164+
165+ ImGui::Begin (" Palette" );
166+ if (ImGui::Selectable (" Red" , this ->selected_action == 0 )) {
167+ this ->selected_action = 0 ;
168+ }
169+ if (ImGui::Selectable (" Blue" , this ->selected_action == 1 )) {
170+ this ->selected_action = 1 ;
171+ }
172+ if (ImGui::Selectable (" Clear" , this ->selected_action == selection_clear)) {
173+ this ->selected_action = selection_clear;
174+ }
175+ if (ImGui::Selectable (" Move Up" , this ->selected_action == selection_move_up)) {
176+ this ->selected_action = selection_move_up;
177+ }
178+ if (ImGui::Selectable (" Move down" , this ->selected_action == selection_move_down)) {
179+ this ->selected_action = selection_move_down;
180+ }
181+ if (ImGui::Selectable (" Move left" , this ->selected_action == selection_move_left)) {
182+ this ->selected_action = selection_move_left;
183+ }
184+ if (ImGui::Selectable (" Move right" , this ->selected_action == selection_move_right)) {
185+ this ->selected_action = selection_move_right;
186+ }
187+ ImGui::Separator ();
188+ ImGui::LabelText (" moves allowed" , " %i" , PuzzleNumberOfMovesAllowed (this ->selected_puzzle ));
189+ ImGui::Separator ();
190+ if (read_only) {
191+ ImGui::LabelText (" Read Only" , " " );
192+ ImGui::Separator ();
193+ }
194+ ImGui::End ();
157195}
158196
159197void PuzzleEditorState::Update () {
0 commit comments