Fixed vehicles export
This commit is contained in:
@@ -51,11 +51,11 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
|
||||
, command(COMMAND_NONE)
|
||||
{
|
||||
_midFont = createFont("midFont", "General",
|
||||
"Jupiteroid-Regular.ttf", 18.0f);
|
||||
"Jupiteroid-Regular.ttf", 24.0f);
|
||||
_smallFont = createFont("smallFont", "General",
|
||||
"Jupiteroid-Regular.ttf", 13.0f);
|
||||
"Jupiteroid-Regular.ttf", 18.0f);
|
||||
_bigFont = createFont("bigFont", "General", "Kenney Bold.ttf",
|
||||
32.0f);
|
||||
36.0f);
|
||||
smallFont = overlay->addFont("smallFont", "General");
|
||||
OgreAssert(smallFont, "Could not load font");
|
||||
midFont = overlay->addFont("midFont", "General");
|
||||
@@ -1398,8 +1398,9 @@ EditorGUIModule::EditorGUIModule(flecs::world &ecs)
|
||||
.event(flecs::OnSet)
|
||||
.without<EditorGUIData>()
|
||||
.each([](const RenderWindow &window, const App &app, GUI &gui) {
|
||||
float vpScale = window.dpi / 96 *
|
||||
window.window->getWidth() / 1600.0f;
|
||||
float vpScale = window.dpi / 96;
|
||||
if (vpScale < 1.0f)
|
||||
vpScale = 1.0f;
|
||||
Ogre::OverlayManager::getSingleton().setPixelRatio(
|
||||
vpScale);
|
||||
std::cout << "Editor GUI configure\n";
|
||||
|
||||
@@ -47,11 +47,11 @@ struct GUIListener : public Ogre::RenderTargetListener {
|
||||
: Ogre::RenderTargetListener()
|
||||
{
|
||||
_midFont = createFont("midFont", "General",
|
||||
"Jupiteroid-Regular.ttf", 18.0f);
|
||||
"Jupiteroid-Regular.ttf", 24.0f);
|
||||
_smallFont = createFont("smallFont", "General",
|
||||
"Jupiteroid-Regular.ttf", 13.0f);
|
||||
"Jupiteroid-Regular.ttf", 18.0f);
|
||||
_bigFont = createFont("bigFont", "General", "Kenney Bold.ttf",
|
||||
32.0f);
|
||||
36.0f);
|
||||
smallFont = ECS::get<GUIData>().mGuiOverlay->addFont(
|
||||
"smallFont", "General");
|
||||
OgreAssert(smallFont, "Could not load font");
|
||||
@@ -370,12 +370,24 @@ struct GUIListener : public Ogre::RenderTargetListener {
|
||||
ImGui::End();
|
||||
} else if (ECS::get().get<GUI>().enabled) {
|
||||
if (ECS::get().get<GUI>().mainMenu) {
|
||||
ImVec2 size = ImGui::GetMainViewport()->Size;
|
||||
ImGuiViewport *viewport =
|
||||
ImGui::GetMainViewport();
|
||||
ImGui::SetNextWindowPos(viewport->WorkPos,
|
||||
ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(viewport->WorkSize,
|
||||
ImGuiCond_Always);
|
||||
ImGui::PushStyleVar(
|
||||
ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::PushStyleVar(
|
||||
ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
|
||||
#if 0
|
||||
ImGui::SetNextWindowPos(ImVec2(0, 0),
|
||||
ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(ImVec2(size.x + 4,
|
||||
size.y + 1),
|
||||
ImGuiCond_Always);
|
||||
#endif
|
||||
ImVec4 solidColor =
|
||||
ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg,
|
||||
@@ -388,31 +400,81 @@ struct GUIListener : public Ogre::RenderTargetListener {
|
||||
ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing |
|
||||
ImGuiWindowFlags_NoSavedSettings |
|
||||
ImGuiWindowFlags_NoBringToFrontOnFocus |
|
||||
0);
|
||||
ImGui::PushFont(bigFont);
|
||||
struct buttons {
|
||||
std::string label;
|
||||
std::function<void(bool)> callback;
|
||||
};
|
||||
bool new_game = false, cont = false,
|
||||
load_game = false, opts = false,
|
||||
quit = false;
|
||||
struct buttons buttons_data[] = {
|
||||
{ "New Game",
|
||||
[&](bool pressed) {
|
||||
new_game = true;
|
||||
} },
|
||||
{ "Continue",
|
||||
[&](bool pressed) { cont = true; } },
|
||||
{ "Load Game",
|
||||
[&](bool pressed) {
|
||||
load_game = true;
|
||||
} },
|
||||
{ "Options",
|
||||
[&](bool pressed) { opts = true; } },
|
||||
{ "Quit###quit",
|
||||
[&](bool pressed) { quit = true; } },
|
||||
};
|
||||
ImVec2 size = ImGui::GetWindowSize();
|
||||
float window_width = size.x;
|
||||
float window_height = size.y;
|
||||
ImGui::PushFont(bigFont);
|
||||
ImGui::TextWrapped("%s", "Booo!!!!");
|
||||
bool pressed = false;
|
||||
bool new_game = false, cont = false,
|
||||
load_game = false, opts = false,
|
||||
quit = false;
|
||||
ImGui::SetCursorPosY(size.y / 2.0f - 300.0f);
|
||||
ImGui::SetCursorPosX(size.x / 2.0f - 300.0f);
|
||||
new_game = ImGui::Button("New Game");
|
||||
ImGui::SetCursorPosX(size.x / 2.0f - 300.0f);
|
||||
cont = ImGui::Button("Continue");
|
||||
ImGui::SetCursorPosX(size.x / 2.0f - 300.0f);
|
||||
load_game = ImGui::Button("Load Game");
|
||||
ImGui::SetCursorPosX(size.x / 2.0f - 300.0f);
|
||||
opts = ImGui::Button("Options");
|
||||
ImGui::SetCursorPosX(size.x / 2.0f - 300.0f);
|
||||
quit = ImGui::Button("Quit###quit");
|
||||
float extra_pixels = 20.0f;
|
||||
float button_width = 0.0f;
|
||||
float buttons_height = 0.0f;
|
||||
for (const struct buttons &b : buttons_data) {
|
||||
ImVec2 text_size = ImGui::CalcTextSize(
|
||||
b.label.c_str());
|
||||
float text_width = text_size.x;
|
||||
float text_height = text_size.y;
|
||||
float bwidth =
|
||||
text_width +
|
||||
(ImGui::GetStyle()
|
||||
.FramePadding.x *
|
||||
2.0f) +
|
||||
extra_pixels;
|
||||
if (button_width < bwidth)
|
||||
button_width = bwidth;
|
||||
buttons_height +=
|
||||
text_height +
|
||||
(ImGui::GetStyle()
|
||||
.FramePadding.y *
|
||||
2.0f);
|
||||
}
|
||||
ImGui::SetCursorPosY(
|
||||
(window_height - buttons_height) *
|
||||
0.5f);
|
||||
for (const struct buttons &b : buttons_data) {
|
||||
ImGui::SetCursorPosX(
|
||||
(window_width - button_width) *
|
||||
0.5f);
|
||||
if (ImGui::Button(b.label.c_str(),
|
||||
ImVec2(button_width,
|
||||
0)))
|
||||
b.callback(true);
|
||||
}
|
||||
bool pressed = false;
|
||||
pressed = new_game || cont || load_game ||
|
||||
opts || quit;
|
||||
ImGui::PopFont();
|
||||
ImGui::Spacing();
|
||||
ImGui::End();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleVar();
|
||||
if (quit)
|
||||
Ogre::Root::getSingleton()
|
||||
.queueEndRendering();
|
||||
@@ -686,7 +748,9 @@ void GUIModule::configure()
|
||||
const App &app = ECS::get<App>();
|
||||
if (gui.mGuiOverlay)
|
||||
return;
|
||||
float vpScale = window.dpi / 96 * window.window->getWidth() / 1600.0f;
|
||||
float vpScale = window.dpi / 96;
|
||||
if (vpScale < 1.0f)
|
||||
vpScale = 1.0f;
|
||||
Ogre::OverlayManager::getSingleton().setPixelRatio(vpScale);
|
||||
std::cout << "GUI configure\n";
|
||||
OgreAssert(app.mGuiOverlay, "No ImGUI overlay");
|
||||
|
||||
Reference in New Issue
Block a user