Skip to content

Commit 4f26b2b

Browse files
mardyWinterMute
authored andcommitted
ogc: rotate mouse cursor to match wiimote orientation
Set a rotation on the mouse cursor to match the wiimote angle. Note that we do this only with the default hand-shaped cursor: if the application has set a different cursor, we should not rotate it. Fixes: #63
1 parent 3f99df1 commit 4f26b2b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/video/ogc/SDL_ogcmouse.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <malloc.h>
3636
#include <ogc/cache.h>
3737
#include <ogc/gx.h>
38+
#include <wiiuse/wpad.h>
3839

3940
typedef struct _OGC_CursorData
4041
{
@@ -189,6 +190,16 @@ void OGC_draw_cursor(_THIS)
189190

190191
guMtxIdentity(mv);
191192
guMtxScaleApply(mv, mv, screen_w / 640.0f, screen_h / 480.0f, 1.0f);
193+
/* If this is the default cursor, rotate it too */
194+
if (mouse->cur_cursor == mouse->def_cursor) {
195+
Mtx rot;
196+
float angle;
197+
WPADData *data = WPAD_Data(mouse->mouseID);
198+
199+
angle = data->ir.angle;
200+
guMtxRotDeg(rot, 'z', angle);
201+
guMtxConcat(mv, rot, mv);
202+
}
192203
guMtxTransApply(mv, mv, mouse->x, mouse->y, 0);
193204
GX_LoadPosMtxImm(mv, GX_PNMTX1);
194205

0 commit comments

Comments
 (0)