|
@@ -15,6 +15,7 @@
|
15
|
15
|
#include "Menu.h"
|
16
|
16
|
#include "Render.h"
|
17
|
17
|
#include "RunTime.h"
|
|
18
|
+#include "Selector.h"
|
18
|
19
|
#include "SoundManager.h"
|
19
|
20
|
#include "TextureManager.h"
|
20
|
21
|
#include "World.h"
|
|
@@ -173,7 +174,7 @@ void UI::eventsFinished() {
|
173
|
174
|
|
174
|
175
|
ImGui::NewFrame();
|
175
|
176
|
|
176
|
|
- if (!(visible || Console::isVisible() || Menu::isVisible())) {
|
|
177
|
+ if (!(visible || Console::isVisible() || Menu::isVisible() || Selector::isVisible())) {
|
177
|
178
|
while (!motionEvents.empty()) {
|
178
|
179
|
auto i = motionEvents.front();
|
179
|
180
|
Game::handleMouseMotion(std::get<0>(i), std::get<1>(i),
|
|
@@ -185,7 +186,7 @@ void UI::eventsFinished() {
|
185
|
186
|
while (!keyboardEvents.empty()) {
|
186
|
187
|
auto i = keyboardEvents.front();
|
187
|
188
|
|
188
|
|
- if (!(visible || Console::isVisible() || Menu::isVisible())) {
|
|
189
|
+ if (!(visible || Console::isVisible() || Menu::isVisible() || Selector::isVisible())) {
|
189
|
190
|
for (int n = forwardAction; n < ActionEventCount; n++) {
|
190
|
191
|
auto ae = static_cast<ActionEvents>(n);
|
191
|
192
|
if (RunTime::getKeyBinding(ae) == std::get<0>(i))
|
|
@@ -194,7 +195,7 @@ void UI::eventsFinished() {
|
194
|
195
|
}
|
195
|
196
|
|
196
|
197
|
if (std::get<1>(i)) {
|
197
|
|
- if ((!io.WantCaptureKeyboard) || (!(visible || Console::isVisible() || Menu::isVisible()))) {
|
|
198
|
+ if ((!io.WantCaptureKeyboard) || (!(visible || Console::isVisible() || Menu::isVisible() || Selector::isVisible()))) {
|
198
|
199
|
if (!metaKeyIsActive) {
|
199
|
200
|
if (RunTime::getKeyBinding(debugAction) == std::get<0>(i)) {
|
200
|
201
|
visible = !visible;
|
|
@@ -215,6 +216,16 @@ void UI::eventsFinished() {
|
215
|
216
|
}
|
216
|
217
|
|
217
|
218
|
bool clicked = !clickEvents.empty();
|
|
219
|
+ while (!clickEvents.empty()) {
|
|
220
|
+ auto i = clickEvents.front();
|
|
221
|
+
|
|
222
|
+ if (Selector::isVisible() && (!io.WantCaptureMouse)) {
|
|
223
|
+ Selector::handleMouseClick(std::get<0>(i), std::get<1>(i), std::get<2>(i), std::get<3>(i));
|
|
224
|
+ }
|
|
225
|
+
|
|
226
|
+ clickEvents.pop_front();
|
|
227
|
+ }
|
|
228
|
+
|
218
|
229
|
clickEvents.clear();
|
219
|
230
|
motionEvents.clear();
|
220
|
231
|
scrollEvents.clear();
|
|
@@ -225,10 +236,10 @@ void UI::eventsFinished() {
|
225
|
236
|
Console::setVisible(false);
|
226
|
237
|
}
|
227
|
238
|
|
228
|
|
- if (Window::getTextInput() != (visible || Console::isVisible() || Menu::isVisible()))
|
229
|
|
- Window::setTextInput(visible || Console::isVisible() || Menu::isVisible());
|
|
239
|
+ if (Window::getTextInput() != (visible || Console::isVisible() || Menu::isVisible() || Selector::isVisible()))
|
|
240
|
+ Window::setTextInput(visible || Console::isVisible() || Menu::isVisible() || Selector::isVisible());
|
230
|
241
|
|
231
|
|
- bool input = !(visible || Console::isVisible() || Menu::isVisible());
|
|
242
|
+ bool input = !(visible || Console::isVisible() || Menu::isVisible() || Selector::isVisible());
|
232
|
243
|
if (Window::getMousegrab() != input)
|
233
|
244
|
Window::setMousegrab(input);
|
234
|
245
|
|
|
@@ -263,6 +274,7 @@ void UI::display() {
|
263
|
274
|
|
264
|
275
|
Console::display();
|
265
|
276
|
Menu::display();
|
|
277
|
+ Selector::display();
|
266
|
278
|
|
267
|
279
|
if (!visible) {
|
268
|
280
|
ImGui::Render();
|
|
@@ -272,6 +284,16 @@ void UI::display() {
|
272
|
284
|
static bool showTestWindow = false;
|
273
|
285
|
static bool showStyleWindow = false;
|
274
|
286
|
if (ImGui::Begin("Engine", &visible, ImVec2(500, 600))) {
|
|
287
|
+ if (Selector::isVisible()) {
|
|
288
|
+ if (ImGui::Button("Disable Mouse Object Picking")) {
|
|
289
|
+ Selector::setVisible(false);
|
|
290
|
+ }
|
|
291
|
+ } else {
|
|
292
|
+ if (ImGui::Button("Enable Mouse Object Picking")) {
|
|
293
|
+ Selector::setVisible(true);
|
|
294
|
+ }
|
|
295
|
+ }
|
|
296
|
+
|
275
|
297
|
Render::displayUI();
|
276
|
298
|
RunTime::display();
|
277
|
299
|
TextureManager::display();
|
|
@@ -456,7 +478,7 @@ void UI::handleControllerAxis(float value, KeyboardButton axis) {
|
456
|
478
|
}
|
457
|
479
|
|
458
|
480
|
void UI::handleControllerButton(KeyboardButton button, bool released) {
|
459
|
|
- if (visible || Console::isVisible())
|
|
481
|
+ if (visible || Console::isVisible() || Menu::isVisible() || Selector::isVisible())
|
460
|
482
|
return;
|
461
|
483
|
|
462
|
484
|
if (Menu::isVisible()) {
|