Description:
Avoid passing mouse clicks when the user is hovering over ImGui windows.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -4,6 +4,8 | |||
|
4 | 4 | using Microsoft.Xna.Framework.Graphics; |
|
5 | 5 | using Microsoft.Xna.Framework.Input; |
|
6 | 6 | |
|
7 | using ImGuiNET; | |
|
8 | ||
|
7 | 9 | using Encompass; |
|
8 | 10 | |
|
9 | 11 | using isometricparkfna.Messages; |
@@ -59,6 +61,8 | |||
|
59 | 61 | var viewWidth = gdm.PreferredBackBufferWidth; |
|
60 | 62 | var viewHeight = gdm.PreferredBackBufferHeight; |
|
61 | 63 | |
|
64 | ImGuiIOPtr io = ImGui.GetIO(); | |
|
65 | ||
|
62 | 66 | foreach (var entity in ReadEntities<GameStateComponent>()) |
|
63 | 67 | { |
|
64 | 68 | var state = GetComponent<GameStateComponent>(entity).isPlaying; |
@@ -242,27 +246,29 | |||
|
242 | 246 | #endregion |
|
243 | 247 | #region mouse_click |
|
244 | 248 | |
|
245 | if (mouseCur.RightButton == ButtonState.Pressed && mousePrev.RightButton == ButtonState.Released) | |
|
246 | { | |
|
247 | SendMessage(new JumpCameraMessage {Movement = original_point}); | |
|
248 | } | |
|
249 | if (!io.WantCaptureMouse) { | |
|
250 | if (mouseCur.RightButton == ButtonState.Pressed && mousePrev.RightButton == ButtonState.Released) | |
|
251 | { | |
|
252 | SendMessage(new JumpCameraMessage {Movement = original_point}); | |
|
253 | } | |
|
249 | 254 | |
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 | { | |
|
254 |
|
|
|
255 | } | |
|
255 | if (mouseCur.LeftButton == ButtonState.Pressed && mousePrev.LeftButton == ButtonState.Released | |
|
256 | // && keyboardCur.IsKeyDown(Keys.LeftShift) | |
|
257 | ) | |
|
258 | { | |
|
259 | SendMessage(new SpawnSelection {Start = CellMap.calculateMousegrid(original_point)}); | |
|
260 | } | |
|
256 | 261 | |
|
257 |
|
|
|
258 | { | |
|
259 |
|
|
|
260 | } | |
|
262 | if ( mouseCur.LeftButton == ButtonState.Released && mousePrev.LeftButton == ButtonState.Pressed ) | |
|
263 | { | |
|
264 | SendMessage(new AdjustSelection {Type = AdjustmentType.Complete }); | |
|
265 | } | |
|
261 | 266 | |
|
262 |
|
|
|
263 | { | |
|
264 |
|
|
|
265 | } | |
|
267 | if (mouseCur.LeftButton == ButtonState.Pressed && mousePrev.LeftButton == ButtonState.Pressed) | |
|
268 | { | |
|
269 | SendMessage(new AdjustSelection { End = CellMap.calculateMousegrid(original_point)}); | |
|
270 | } | |
|
271 | } | |
|
266 | 272 | |
|
267 | 273 | |
|
268 | 274 |
You need to be logged in to leave comments.
Login now