mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Dreamcast: Wheel support for mice
This commit is contained in:
parent
d8676cbd6c
commit
5be965131c
@ -64,6 +64,7 @@ cc_bool Game_Anaglyph3D;
|
||||
cc_bool Game_ViewBobbing, Game_HideGui;
|
||||
cc_bool Game_BreakableLiquids, Game_ScreenshotRequested;
|
||||
struct GameVersion Game_Version;
|
||||
Game_Draw2DHook Game_Draw2DHooks[4];
|
||||
|
||||
static char usernameBuffer[STRING_SIZE];
|
||||
static char mppassBuffer[STRING_SIZE];
|
||||
@ -657,6 +658,7 @@ static void LimitFPS(void) {
|
||||
#endif
|
||||
|
||||
static CC_INLINE void Game_DrawFrame(float delta, float t) {
|
||||
int i;
|
||||
UpdateViewMatrix();
|
||||
|
||||
if (!Gui_GetBlocksWorld()) {
|
||||
@ -675,7 +677,11 @@ static CC_INLINE void Game_DrawFrame(float delta, float t) {
|
||||
|
||||
Gfx_Begin2D(Game.Width, Game.Height);
|
||||
Gui_RenderGui(delta);
|
||||
OnscreenKeyboard_Draw3D();
|
||||
for (i = 0; i < Array_Elems(Game_Draw2DHooks); i++)
|
||||
{
|
||||
if (Game_Draw2DHooks[i]) Game_Draw2DHooks[i]();
|
||||
}
|
||||
|
||||
/* TODO find a better solution than this */
|
||||
#ifdef CC_BUILD_3DS
|
||||
if (Game_Anaglyph3D) {
|
||||
|
@ -21,6 +21,8 @@ extern cc_bool Game_UseCPEBlocks;
|
||||
|
||||
extern cc_string Game_Username;
|
||||
extern cc_string Game_Mppass;
|
||||
typedef void (*Game_Draw2DHook)(void);
|
||||
extern Game_Draw2DHook Game_Draw2DHooks[4];
|
||||
|
||||
#ifdef CC_BUILD_SPLITSCREEN
|
||||
extern int Game_NumLocalPlayers;
|
||||
|
@ -21,7 +21,7 @@ static void VirtualCursor_Display2D(struct Context2D* ctx) {
|
||||
x - CURSOR_SIZE, y - CURSOR_EXTENT, CURSOR_SIZE * 3, CURSOR_EXTENT * 2);
|
||||
}
|
||||
|
||||
static void VirtualCursor_SetPosition(int x, int y) {
|
||||
static void VirtualCursor_SetPositionm(int x, int y) {
|
||||
x = max(0, min(x, Window_Main.Width - 1));
|
||||
y = max(0, min(y, Window_Main.Height - 1));
|
||||
vc_hooked = true;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "LBackend.h"
|
||||
#include "Window.h"
|
||||
#include "Graphics.h"
|
||||
#include "Game.h"
|
||||
|
||||
static cc_bool kb_inited, kb_shift, kb_needsHook;
|
||||
static struct FontDesc kb_font;
|
||||
@ -305,7 +306,7 @@ static void VirtualKeyboard_Display2D(struct Context2D* real_ctx) {
|
||||
}
|
||||
|
||||
static void VirtualKeyboard_Close2D(void) {
|
||||
LBackend_Hooks[0] = NULL;
|
||||
LBackend_Hooks[0] = NULL;
|
||||
LBackend_Redraw();
|
||||
}
|
||||
|
||||
@ -321,7 +322,9 @@ static void VirtualKeyboard_MarkDirty3D(void) {
|
||||
|
||||
static void VirtualKeyboard_Close3D(void) {
|
||||
Gfx_DeleteTexture(&kb_texture.ID);
|
||||
Game_Draw2DHooks[0] = NULL;
|
||||
}
|
||||
|
||||
static void VirtualKeyboard_MakeTexture(void) {
|
||||
struct Context2D ctx;
|
||||
int width = VirtualKeyboard_Width();
|
||||
@ -399,7 +402,8 @@ static void VirtualKeyboard_Open(struct OpenKeyboardArgs* args, cc_bool launcher
|
||||
|
||||
Window_Main.SoftKeyboardFocus = true;
|
||||
Input.DownHook = VirtualKeyboard_ProcessDown;
|
||||
LBackend_Hooks[0] = VirtualKeyboard_Display2D;
|
||||
LBackend_Hooks[0] = VirtualKeyboard_Display2D;
|
||||
Game_Draw2DHooks[0] = VirtualKeyboard_Display3D;
|
||||
}
|
||||
|
||||
static void VirtualKeyboard_SetText(const cc_string* text) {
|
||||
|
@ -215,8 +215,6 @@ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args);
|
||||
/* As such, this is necessary to ensure the HTML input is consistent with */
|
||||
/* whatever text input widget is actually being displayed on screen. */
|
||||
void OnscreenKeyboard_SetText(const cc_string* text);
|
||||
void OnscreenKeyboard_Draw2D(Rect2D* r, struct Bitmap* bmp);
|
||||
void OnscreenKeyboard_Draw3D(void);
|
||||
/* Hides/Removes the previously displayed on-screen keyboard. */
|
||||
void OnscreenKeyboard_Close(void);
|
||||
/* Locks/Unlocks the landscape orientation. */
|
||||
|
@ -279,7 +279,6 @@ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
|
||||
OnscreenTextChanged(output);
|
||||
}
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
DisplayInfo.ShowingSoftKeyboard = false;
|
||||
|
@ -547,8 +547,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
(*env)->DeleteLocalRef(env, args[0].l);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
JNIEnv* env;
|
||||
JavaGetCurrentEnv(env);
|
||||
|
@ -681,7 +681,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
|
@ -202,6 +202,7 @@ static void ProcessMouseInput(float delta) {
|
||||
Input_SetNonRepeatable(CCMOUSE_L, mods & MOUSE_LEFTBUTTON);
|
||||
Input_SetNonRepeatable(CCMOUSE_R, mods & MOUSE_RIGHTBUTTON);
|
||||
Input_SetNonRepeatable(CCMOUSE_M, mods & MOUSE_SIDEBUTTON);
|
||||
Mouse_ScrollVWheel(-state->dz * 0.5f);
|
||||
|
||||
if (!vc_hooked) {
|
||||
Pointer_SetPosition(0, Window_Main.Width / 2, Window_Main.Height / 2);
|
||||
@ -219,7 +220,9 @@ void Window_ProcessEvents(float delta) {
|
||||
ProcessMouseInput(delta);
|
||||
}
|
||||
|
||||
void Cursor_SetPosition(int x, int y) { } /* TODO: Dreamcast mouse support */
|
||||
void Cursor_SetPosition(int x, int y) {
|
||||
if (vc_hooked) VirtualCursor_SetPosition(x, y);
|
||||
}
|
||||
|
||||
void Window_EnableRawMouse(void) { Input.RawMode = true; }
|
||||
void Window_DisableRawMouse(void) { Input.RawMode = false; }
|
||||
@ -347,10 +350,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
VirtualKeyboard_SetText(text);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) {
|
||||
VirtualKeyboard_Display3D();
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
VirtualKeyboard_Close();
|
||||
}
|
||||
|
@ -526,10 +526,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
VirtualKeyboard_SetText(text);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) {
|
||||
VirtualKeyboard_Display3D();
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
VirtualKeyboard_Close();
|
||||
}
|
||||
|
@ -518,7 +518,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
|
@ -184,7 +184,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
*#########################################################################################################################*/
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { /* TODO implement */ }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { /* TODO implement */ }
|
||||
|
||||
|
||||
|
@ -323,8 +323,6 @@ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
|
||||
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
keyboardHide();
|
||||
if (!DisplayInfo.ShowingSoftKeyboard) return;
|
||||
|
@ -193,7 +193,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
*#########################################################################################################################*/
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { /* TODO implement */ }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { /* TODO implement */ }
|
||||
|
||||
|
||||
|
@ -150,7 +150,7 @@ static void ProcessMouseInput(float delta) {
|
||||
Input_SetNonRepeatable(CCMOUSE_L, mData.buttons & PS2MOUSE_BTN1);
|
||||
Input_SetNonRepeatable(CCMOUSE_R, mData.buttons & PS2MOUSE_BTN2);
|
||||
Input_SetNonRepeatable(CCMOUSE_M, mData.buttons & PS2MOUSE_BTN3);
|
||||
Mouse_ScrollVWheel(mData.wheel);
|
||||
Mouse_ScrollVWheel(mData.wheel * 0.5f);
|
||||
|
||||
if (!vc_hooked) {
|
||||
Pointer_SetPosition(0, Window_Main.Width / 2, Window_Main.Height / 2);
|
||||
@ -177,7 +177,9 @@ void Window_ProcessEvents(float delta) {
|
||||
ProcessKeyboardInput();
|
||||
}
|
||||
|
||||
void Cursor_SetPosition(int x, int y) { } // Makes no sense for PS Vita
|
||||
void Cursor_SetPosition(int x, int y) {
|
||||
if (vc_hooked) VirtualCursor_SetPosition(x, y);
|
||||
}
|
||||
|
||||
void Window_EnableRawMouse(void) { Input.RawMode = true; }
|
||||
void Window_UpdateRawMouse(void) { }
|
||||
@ -321,10 +323,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
VirtualKeyboard_SetText(text);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) {
|
||||
VirtualKeyboard_Display3D();
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
VirtualKeyboard_Close();
|
||||
}
|
||||
|
@ -378,10 +378,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
VirtualKeyboard_SetText(text);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) {
|
||||
VirtualKeyboard_Display3D();
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
VirtualKeyboard_Close();
|
||||
}
|
||||
|
@ -179,10 +179,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
VirtualKeyboard_SetText(text);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) {
|
||||
VirtualKeyboard_Display3D();
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
VirtualKeyboard_Close();
|
||||
}
|
||||
|
@ -351,7 +351,6 @@ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
|
||||
/* TODO implement */
|
||||
}
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { /* TODO implement */ }
|
||||
|
||||
|
||||
|
@ -445,7 +445,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { SDL_StartTextInput(); }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { SDL_StopTextInput(); }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
|
@ -477,7 +477,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { SDL_StartTextInput(win_handle); }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { SDL_StopTextInput(win_handle); }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
|
@ -233,7 +233,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
*#########################################################################################################################*/
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { /* TODO implement */ }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { /* TODO implement */ }
|
||||
|
||||
|
||||
|
@ -291,7 +291,6 @@ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
|
||||
swkbdClose(&kbd);
|
||||
}
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { /* TODO implement */ }
|
||||
|
||||
|
||||
|
@ -540,7 +540,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
|
@ -724,8 +724,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
interop_SetKeyboardText(str);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
keyboardOpen = false;
|
||||
if (!Input_TouchMode) return;
|
||||
|
@ -602,7 +602,6 @@ static void OnscreenKeyboard_DrawDRC(void) {
|
||||
|
||||
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
if (!keyboardOpen) return;
|
||||
|
@ -754,7 +754,6 @@ static void InitRawMouse(void) {
|
||||
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
|
@ -1198,8 +1198,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw2D(Rect2D* r, struct Bitmap* bmp) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { }
|
||||
|
||||
static cc_bool rawMouseInited, rawMouseSupported;
|
||||
|
@ -231,10 +231,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
VirtualKeyboard_SetText(text);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) {
|
||||
VirtualKeyboard_Display3D();
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
VirtualKeyboard_Close();
|
||||
}
|
||||
|
@ -193,10 +193,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
VirtualKeyboard_SetText(text);
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) {
|
||||
VirtualKeyboard_Display3D();
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
VirtualKeyboard_Close();
|
||||
}
|
||||
|
@ -761,7 +761,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
|
||||
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { }
|
||||
void OnscreenKeyboard_SetText(const cc_string* text) { }
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
void OnscreenKeyboard_Close(void) { }
|
||||
|
||||
|
||||
|
@ -539,8 +539,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
|
||||
text_input.text = str;
|
||||
}
|
||||
|
||||
void OnscreenKeyboard_Draw3D(void) { }
|
||||
|
||||
void OnscreenKeyboard_Close(void) {
|
||||
DisplayInfo.ShowingSoftKeyboard = false;
|
||||
[text_input resignFirstResponder];
|
||||
|
Loading…
x
Reference in New Issue
Block a user