Skip to content

Commit

Permalink
Merge pull request #81 from prizrak9/#69-cursor-return
Browse files Browse the repository at this point in the history
#69 cursor return
  • Loading branch information
pryvyd9 authored Oct 11, 2020
2 parents 4e23274 + e04eac7 commit 58298b1
Show file tree
Hide file tree
Showing 14 changed files with 994 additions and 537 deletions.
596 changes: 165 additions & 431 deletions StereoPlus2/FileManager.hpp

Large diffs are not rendered by default.

35 changes: 26 additions & 9 deletions StereoPlus2/GUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Window.hpp"
#include "Windows.hpp"
#include "Input.hpp"
#include "Localization.hpp"
#include <map>


Expand Down Expand Up @@ -54,23 +55,22 @@ class GUI {
}

bool DesignMenuBar() {
if (ImGui::BeginMenu("File")) {
if (ImGui::MenuItem("Open", nullptr, false))
if (ImGui::BeginMenu(LocaleProvider::GetC("file"))) {
if (ImGui::MenuItem(LocaleProvider::GetC("open"), nullptr, false))
if (!OpenFileWindow(FileWindow::Load))
return false;
if (ImGui::MenuItem("Save", nullptr, false))
if (ImGui::MenuItem(LocaleProvider::GetC("save"), nullptr, false))
if (!OpenFileWindow(FileWindow::Save))
return false;
if (ImGui::MenuItem("Close", nullptr, false))
if (ImGui::MenuItem(LocaleProvider::GetC("close"), nullptr, false))
scene->DeleteAll();

//ImGui::MenuItem("Use position detection", nullptr, &shouldUsePositionDetection);
if (auto h = GlobalToolConfiguration::ShouldDetectPosition().Get();
ImGui::MenuItem("Use position detection", nullptr, &h))
ImGui::MenuItem(LocaleProvider::GetC("usePositionDetection"), nullptr, &h))
GlobalToolConfiguration::ShouldDetectPosition().Set(h);
ImGui::MenuItem("Show FPS", nullptr, &shouldShowFPS);
ImGui::MenuItem(LocaleProvider::GetC("showFPS"), nullptr, &shouldShowFPS);

if (ImGui::MenuItem("Exit", nullptr, false))
if (ImGui::MenuItem(LocaleProvider::GetC("exit"), nullptr, false))
shouldClose = true;

ImGui::EndMenu();
Expand Down Expand Up @@ -144,7 +144,6 @@ class GUI {
KeyBinding keyBinding;
Scene* scene;

//bool shouldUsePositionDetection = false;
bool shouldShowFPS = true;

std::vector<Window*> windows;
Expand Down Expand Up @@ -193,6 +192,24 @@ class GUI {
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
// - Read 'misc/fonts/README.txt' for more instructions and details.
// - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !


ImFontConfig font_config;
font_config.OversampleH = 1; //or 2 is the same
font_config.OversampleV = 1;
font_config.PixelSnapH = 1;

static const ImWchar ranges[] =
{
0x0020, 0x00FF, // Basic Latin + Latin Supplement
0x0400, 0x04FF, // Cyrillic
0x0500, 0x052F, // Cyrillic supplement
0,
};


io->Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\Tahoma.ttf", 14.0f, &font_config, ranges);

//io.Fonts->AddFontDefault();
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
Expand Down
11 changes: 9 additions & 2 deletions StereoPlus2/InfrastructureTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ class IEvent {
handlers.erase(v);
};
}

size_t operator += (std::function<void(T...)> func) {
return AddHandler(func);
}
void operator -= (size_t v) {
RemoveHandler(v);
}

};

template<typename...T>
Expand Down Expand Up @@ -464,5 +472,4 @@ class ReadonlyProperty : Property<T> {
static Property<type>& name() {\
static Property<type> v;\
return v;\
}

}
Loading

0 comments on commit 58298b1

Please sign in to comment.