From 28fa69f8a469879578bb50d68c09e8bd1d75dd85 Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Sun, 28 Apr 2024 19:29:47 +0800 Subject: [PATCH] Add PUT_CAMERA command --- Makefile.flags | 2 +- map.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile.flags b/Makefile.flags index 43214a8..8c59e45 100644 --- a/Makefile.flags +++ b/Makefile.flags @@ -26,7 +26,7 @@ export FASM = echo " FASM $^" && fasm >/dev/null ifneq (, $(findstring mingw,$(shell $(CC1) -dumpmachine))) export Platform_CXXFLAGS := -DSFML_STATIC export Platform_LDFLAGS := -export Platform_LDLIBS := -lgdi32 -limm32 -lwinmm +export Platform_LDLIBS := -lopengl32 -lgdi32 -limm32 -lwinmm export Platform_INCLUDEFLAGS := else export Platform_CXXFLAGS := diff --git a/map.cpp b/map.cpp index b39bdb1..bd198fe 100644 --- a/map.cpp +++ b/map.cpp @@ -15,6 +15,8 @@ static std::list entities; static EntityBase *selected_entity = NULL; static EntityBase *to_delete = NULL; static Vec2 offset0(0, 0); +static Vec2 put_camera(0, 0); +static bool has_put_camera = true; static double cutoff = 1500; static float bgcolor[3] = {0.0f, 0.0f, 0.0f}; @@ -71,6 +73,11 @@ void ui_map() { bgcolor[1] = strtof(TOKEN, NULL) / 255.0f; bgcolor[2] = strtof(TOKEN, NULL) / 255.0f; } + CMD("PUT_CAMERA") { + has_put_camera = true; + put_camera.x = strtod(strtok(NULL, " "), NULL); + put_camera.y = strtod(strtok(NULL, " "), NULL); + } if (e != NULL) { e->from_strtok(); @@ -130,6 +137,8 @@ void ui_map() { DragDouble("Cutoff depth", &cutoff); ImGui::ColorEdit3("Background", bgcolor, ImGuiColorEditFlags_PickerHueWheel); + DragVec2("Put Camera", &put_camera); + //ig::SameLine();dd ig::SeparatorText("Entities"); if (ig::Selectable("<<< CLEAR >>>", selected_entity == NULL)) @@ -173,6 +182,8 @@ void ui_map() { buff.clear(); buff = "CUTOFF " + std::to_string((int)std::round(cutoff)) + "\n"; buff += "BACKGROUND " + std::to_string((int)std::round(bgcolor[0] * 255.0f)) + " " + std::to_string((int)std::round(bgcolor[1] * 255.0f)) + " " + std::to_string((int)std::round(bgcolor[2] * 255.0f)) + "\n"; + if (has_put_camera) + buff += "PUT_CAMERA " + std::to_string((int)std::round(put_camera.x)) + " " + std::to_string((int)std::round(put_camera.y)) + "\n"; for (EntityBase *e: entities) { buff += e->to_file(); }