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