player run mode name changed back to game

Added region selecting outline to map canvas tool bar
core_refactor
Joey Pollack 4 years ago
parent 8e07cec621
commit 289c1de828

@ -126,7 +126,7 @@ add_subdirectory(src/run_modes/tester)
add_subdirectory(src/run_modes/editor)
# add run mode editor
add_subdirectory(src/run_modes/player)
add_subdirectory(src/run_modes/game)
target_include_directories(${PROJECT_NAME}
PUBLIC "${PROJECT_BINARY_DIR}"

@ -4,6 +4,7 @@ Build System:
✔ Modify .sh scripts to recognize the noeditor flag @done (1/25/2022, 3:59:23 PM)
Core:
☐ For scripting switch to Wren instead of LUA @high
☐ Add log settings to the state file
✔ Add run modes (Editor, Game, Test) to state file @done (9/15/2021, 7:27:03 PM)
✔ Add run mode interface class @done (9/15/2021, 8:22:35 PM)
@ -40,7 +41,7 @@ Core:
✔ Sort items by type (Directories should come first) @done (11/8/2021, 6:26:01 PM)
✔ Allow the user to type in a filename @done (11/9/2021, 3:26:16 PM)
✔ Add a "New Directory" button @done (11/8/2021, 7:15:51 PM)
☐ Selected files should show up in the text box
✔ Selected files should show up in the text box @done(22-04-18 13:33)
Input:
✔ Port over the Element2D input system and adjust it to use glfw @done (9/8/2021, 8:20:07 PM)

@ -55,6 +55,7 @@ Editor:
☐ Flood Fill
✔ Zoom ability @high @done (3/14/2022, 3:38:27 PM)
✔ Middle mouse button scrolling @done (3/14/2022, 3:38:43 PM)
☐ Add arrow images to the move region buttons @low
Tile Set Viewer:

@ -102,7 +102,8 @@ namespace lunarium
if (ImGui::InputText("selection", mInputBuffer, mBufferSize))
{
mInputSelection = mCurrentDirectory / mInputBuffer;
// mInputSelection = mCurrentDirectory / mInputBuffer;
mInputSelection = mInputBuffer;
mpSelectedItem = &mInputSelection;
}
@ -216,7 +217,7 @@ namespace lunarium
{
mpSelectedItem = &mItemsInDir[i];
memset(mInputBuffer, 0, mBufferSize);
memcpy(mInputBuffer, mpSelectedItem->string().c_str(), mpSelectedItem->string().size());
memcpy(mInputBuffer, mpSelectedItem->filename().string().c_str(), mpSelectedItem->filename().string().size());
}
}
}

@ -7,7 +7,7 @@
******************************************************************************/
#include "worldTree.h"
#include <player/world/world.h>
#include <game/world/world.h>
#include <gui/dearimgui/imgui.h>
#include <editor/editor.h>

@ -13,7 +13,7 @@
namespace lunarium
{
namespace game { class World; }
namespace game { class World; } // TODO: Use the editor::World class instead?
namespace editor
{

@ -8,7 +8,7 @@
#include "worldView.h"
#include <utils/logger.h>
#include <player/world/world.h>
#include <game/world/world.h>
#include <gui/dearimgui/imgui.h>
#include <editor/editor.h>
#include "../panel_manager.h"

@ -14,7 +14,8 @@
namespace lunarium
{
class World;
class World; // TODO: Use the editor::World class instead?
namespace editor
{
class Editor;

@ -23,8 +23,11 @@ namespace lunarium { namespace editor
MapCanvas::MapCanvas(MapEditor* editor)
: Panel("Map Canvas", gui::PanelDockZone::DDZ_CENTER, true),
mpMapEditor(editor), mpCanvasImage(nullptr), mMap(nullptr), mSelectedTile({-1, -1}), mFrameBuffer(-1), mMapSizeChanged(false),
mZoomFactor(1.0f), mScrollDragged(false)
mZoomFactor(1.0f), mScrollDragged(false), mCurrentRegion({0, 0}), mRegionString("")
{
mRegionString = std::to_string(mCurrentRegion.X);
mRegionString += ",";
mRegionString += std::to_string(mCurrentRegion.Y);
}
void MapCanvas::Update(float delta)
@ -146,14 +149,12 @@ namespace lunarium { namespace editor
ImVec2 pos = ImGui::GetWindowPos();
ImVec2 size = ImGui::GetWindowSize();
// tool bar
float child_height = ImGui::GetFrameHeight() * 2;
ImGui::BeginChild("Map Tool Bar", ImVec2(ImGui::GetWindowSize().x, child_height), true);
ImGui::Text("Zoom: ");
ImGui::SameLine();
ImGui::PushItemWidth(100.0f);
ImGui::InputFloat("", &mZoomFactor, 0.05f, 0.1f, "%.2f");
ImGui::PopItemWidth();
// tool bar
DoToolBar();
ImGui::EndChild();
ImGui::BeginChild("Map Canvas", ImVec2(ImGui::GetWindowSize().x, ImGui::GetWindowSize().y - child_height), true);
@ -220,5 +221,87 @@ namespace lunarium { namespace editor
mMapSizeChanged = true;
mpCanvasImage = nullptr;
}
////////////////////////////////////////////////////////////
// RENDER HELPERS
////////////////////////////////////////////////////////////
void MapCanvas::DoToolBar()
{
if (ImGui::BeginTable("tool bar", 2, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_SizingFixedFit))
{
ImGui::AlignTextToFramePadding();
ImGui::TableNextColumn();
ImGui::Text("Zoom: ");
ImGui::SameLine();
ImGui::PushItemWidth(100.0f);
ImGui::InputFloat("##zoom_factor", &mZoomFactor, 0.05f, 0.1f, "%.2f");
ImGui::PopItemWidth();
// Region Selecting
ImGui::TableNextColumn();
ImGui::Text("Regions: ");
ImGui::SameLine();
if (ImGui::Button("<="))
{
// TODO: Move to the next region to the left
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Move to the west");
ImGui::SameLine();
if (ImGui::Button("^"))
{
// TODO: Move to the next region to the north
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Move to the north");
ImGui::SameLine();
if (ImGui::Button("V"))
{
// TODO: Move to the next region to the south
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Move to the south");
ImGui::SameLine();
if (ImGui::Button("=>"))
{
// TODO: Move to the next region to the right
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Move to the east");
ImGui::SameLine();
ImGui::Text("Current: ");
ImGui::SameLine();
ImGui::PushItemWidth(50.0f);
if (ImGui::InputText("##current_region", mRegionString.data(), mRegionString.size() + 1, ImGuiInputTextFlags_EnterReturnsTrue)
&& mRegionString.size() > 2)
{
int x = -1, y = -1;
if (std::isdigit(mRegionString[0]))
{
x = std::atoi(&mRegionString[0]);
if (std::isdigit(mRegionString[2]))
{
mCurrentRegion.X = x;
mCurrentRegion.Y = std::atoi(&mRegionString[2]);
}
}
}
ImGui::PopItemWidth();
// ImGui::TableNextColumn();
// ImGui::Text("Status Bar");
ImGui::EndTable();
}
}
}}

@ -46,11 +46,17 @@ namespace lunarium { namespace editor
std::string mMouseStatusInfo;
int mFrameBuffer;
Image* mpCanvasImage;
TileMap* mMap;
TileMap* mMap; // TODO: Replace with a World
TileRef mSelectedTile;
bool mMapSizeChanged;
private:
// TESTING
Vec2i mCurrentRegion;
std::string mRegionString;
private: // HELPERS
void DoToolBar();
};
}}

@ -39,6 +39,7 @@ namespace lunarium { namespace game
Vec2i mCoords;
std::vector<GameObject*> mObjects;
std::vector<lunarium::Image*> mLayers;
// Colliders
};
public: // INTERFACE

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<Project Name="test2.lproj">
<NextID ID="1" />
<Contents>
<Asset Type="1" ID="0" Location="D:\Projects\lunarium\build\Debug\test2\contents\assets\LinkToThePast1_sized.png" TileSizeWidth="16" TileSizeHeight="16" NumTilesCol="64" NumTilesRow="64" />
</Contents>
</Project>

@ -0,0 +1,2 @@
<?xml version="1.0"?>
<Lunarium_Project name="test2" />
Loading…
Cancel
Save