Skip to content

Commit 76b9c04

Browse files
mardyWinterMute
authored andcommitted
ogc: hide default mouse cursor when not pointing at screen
Applications not explicitly requesting a mouse cursor don't have any benefit in rendering the default cursor when the wiimote is not pointed at the screen; on the contrary, the wiimote might be held sideways, and the cursor would just be disturbing.
1 parent fad294d commit 76b9c04

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/video/ogc/SDL_ogcmouse.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,21 @@ void OGC_draw_cursor(_THIS)
176176
OGC_CursorData *curdata;
177177
Mtx mv;
178178
int screen_w, screen_h;
179+
float angle = 0.0f;
179180

180181
if (!mouse || !mouse->cursor_shown ||
181182
!mouse->cur_cursor || !mouse->cur_cursor->driverdata) {
182183
return;
183184
}
184185

186+
/* If this is the default cursor, rotate it, and if it's not pointed at the
187+
* screen, hide it */
188+
if (mouse->cur_cursor == mouse->def_cursor) {
189+
WPADData *data = WPAD_Data(mouse->mouseID);
190+
angle = data->ir.angle;
191+
if (!data->ir.valid) return;
192+
}
193+
185194
screen_w = _this->displays[0].current_mode.w;
186195
screen_h = _this->displays[0].current_mode.h;
187196

@@ -191,13 +200,8 @@ void OGC_draw_cursor(_THIS)
191200

192201
guMtxIdentity(mv);
193202
guMtxScaleApply(mv, mv, screen_w / 640.0f, screen_h / 480.0f, 1.0f);
194-
/* If this is the default cursor, rotate it too */
195-
if (mouse->cur_cursor == mouse->def_cursor) {
203+
if (angle != 0.0f) {
196204
Mtx rot;
197-
float angle;
198-
WPADData *data = WPAD_Data(mouse->mouseID);
199-
200-
angle = data->ir.angle;
201205
guMtxRotDeg(rot, 'z', angle);
202206
guMtxConcat(mv, rot, mv);
203207
}

0 commit comments

Comments
 (0)