Add PUT_CAMERA command

This commit is contained in:
Edgaru089 2024-04-28 19:29:47 +08:00
parent 7157c963a9
commit 28fa69f8a4
2 changed files with 12 additions and 1 deletions

View File

@ -26,7 +26,7 @@ export FASM = echo " FASM $^" && fasm >/dev/null
ifneq (, $(findstring mingw,$(shell $(CC1) -dumpmachine))) ifneq (, $(findstring mingw,$(shell $(CC1) -dumpmachine)))
export Platform_CXXFLAGS := -DSFML_STATIC export Platform_CXXFLAGS := -DSFML_STATIC
export Platform_LDFLAGS := export Platform_LDFLAGS :=
export Platform_LDLIBS := -lgdi32 -limm32 -lwinmm export Platform_LDLIBS := -lopengl32 -lgdi32 -limm32 -lwinmm
export Platform_INCLUDEFLAGS := export Platform_INCLUDEFLAGS :=
else else
export Platform_CXXFLAGS := export Platform_CXXFLAGS :=

11
map.cpp
View File

@ -15,6 +15,8 @@ static std::list<EntityBase *> entities;
static EntityBase *selected_entity = NULL; static EntityBase *selected_entity = NULL;
static EntityBase *to_delete = NULL; static EntityBase *to_delete = NULL;
static Vec2 offset0(0, 0); static Vec2 offset0(0, 0);
static Vec2 put_camera(0, 0);
static bool has_put_camera = true;
static double cutoff = 1500; static double cutoff = 1500;
static float bgcolor[3] = {0.0f, 0.0f, 0.0f}; 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[1] = strtof(TOKEN, NULL) / 255.0f;
bgcolor[2] = 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) { if (e != NULL) {
e->from_strtok(); e->from_strtok();
@ -130,6 +137,8 @@ void ui_map() {
DragDouble("Cutoff depth", &cutoff); DragDouble("Cutoff depth", &cutoff);
ImGui::ColorEdit3("Background", bgcolor, ImGuiColorEditFlags_PickerHueWheel); ImGui::ColorEdit3("Background", bgcolor, ImGuiColorEditFlags_PickerHueWheel);
DragVec2("Put Camera", &put_camera);
//ig::SameLine();dd
ig::SeparatorText("Entities"); ig::SeparatorText("Entities");
if (ig::Selectable("<<< CLEAR >>>", selected_entity == NULL)) if (ig::Selectable("<<< CLEAR >>>", selected_entity == NULL))
@ -173,6 +182,8 @@ void ui_map() {
buff.clear(); buff.clear();
buff = "CUTOFF " + std::to_string((int)std::round(cutoff)) + "\n"; 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"; 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) { for (EntityBase *e: entities) {
buff += e->to_file(); buff += e->to_file();
} }