mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
Fix defining keys to act as mouse buttons not working in C client
This commit is contained in:
parent
87eb5ea978
commit
e6384d0100
@ -124,14 +124,14 @@ namespace ClassicalSharp {
|
||||
|
||||
public void Render(double delta) {
|
||||
game.Graphics.Mode2D(game.Width, game.Height);
|
||||
if (activeScreen == null || !activeScreen.HidesHud)
|
||||
statusScreen.Render(delta);
|
||||
bool showHUD = activeScreen == null || !activeScreen.HidesHud;
|
||||
if (showHUD) statusScreen.Render(delta);
|
||||
|
||||
if (activeScreen == null || !activeScreen.HidesHud && !activeScreen.RenderHudOver)
|
||||
if (showHUD && !activeScreen.RenderHudOver)
|
||||
hudScreen.Render(delta);
|
||||
if (activeScreen != null)
|
||||
activeScreen.Render(delta);
|
||||
if (activeScreen != null && !activeScreen.HidesHud && activeScreen.RenderHudOver)
|
||||
if (showHUD && activeScreen.RenderHudOver)
|
||||
hudScreen.Render(delta);
|
||||
|
||||
if (overlays.Count > 0)
|
||||
|
@ -52,9 +52,9 @@ namespace ClassicalSharp {
|
||||
if (down) return true;
|
||||
|
||||
// Key --> mouse mappings
|
||||
if (button == MouseButton.Left && IsKeyDown(KeyBind.MouseLeft)) return true;
|
||||
if (button == MouseButton.Left && IsKeyDown(KeyBind.MouseLeft)) return true;
|
||||
if (button == MouseButton.Middle && IsKeyDown(KeyBind.MouseMiddle)) return true;
|
||||
if (button == MouseButton.Right && IsKeyDown(KeyBind.MouseRight)) return true;
|
||||
if (button == MouseButton.Right && IsKeyDown(KeyBind.MouseRight)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ Int32 Camera_ActiveIndex;
|
||||
#define Cam_IsForward_Third() (Camera_ActiveIndex == 2)
|
||||
|
||||
static Vector3 PerspectiveCamera_GetDirVector(void) {
|
||||
struct Entity* p = &LocalPlayer_Instance.Base;
|
||||
Vector2 rot = Camera_Active->GetOrientation();
|
||||
Vector3 dir = Vector3_GetDirVector(rot.X, rot.Y);
|
||||
|
||||
@ -209,13 +208,6 @@ static Vector3 ThirdPersonCamera_GetPosition(Real32 t) {
|
||||
return camPos;
|
||||
}
|
||||
|
||||
static Vector3 ThirdPersonCamera_GetTarget(void) {
|
||||
struct Entity* p = &LocalPlayer_Instance.Base;
|
||||
Vector3 eyePos = Entity_GetEyePosition(p);
|
||||
eyePos.Y += Camera_BobbingVer;
|
||||
return eyePos;
|
||||
}
|
||||
|
||||
static bool ThirdPersonCamera_Zoom(Real32 amount) {
|
||||
Real32* dist = Cam_IsForward_Third() ? &dist_forward : &dist_third;
|
||||
Real32 newDist = *dist - amount;
|
||||
|
@ -498,7 +498,6 @@ static bool Cw_Callback_4(struct NbtTag* tag) {
|
||||
static bool Cw_Callback_5(struct NbtTag* tag) {
|
||||
if (!IsTag(tag->Parent->Parent->Parent, "CPE")) return false;
|
||||
if (!IsTag(tag->Parent->Parent->Parent->Parent, "Metadata")) return false;
|
||||
struct LocalPlayer*p = &LocalPlayer_Instance;
|
||||
|
||||
if (IsTag(tag->Parent->Parent, "EnvColors")) {
|
||||
if (IsTag(tag, "R")) { cw_colR = NbtTag_I16(tag); return true; }
|
||||
|
@ -623,9 +623,9 @@ static void Game_Render3D(Real64 delta, Real32 t) {
|
||||
Selections_Render(delta);
|
||||
Entities_RenderHoveredNames(delta);
|
||||
|
||||
bool left = Mouse_IsPressed(MouseButton_Left);
|
||||
bool middle = Mouse_IsPressed(MouseButton_Middle);
|
||||
bool right = Mouse_IsPressed(MouseButton_Right);
|
||||
bool left = InputHandler_IsMousePressed(MouseButton_Left);
|
||||
bool middle = InputHandler_IsMousePressed(MouseButton_Middle);
|
||||
bool right = InputHandler_IsMousePressed(MouseButton_Right);
|
||||
InputHandler_PickBlocks(true, left, middle, right);
|
||||
if (!Game_HideGui) HeldBlockRenderer_Render(delta);
|
||||
}
|
||||
|
@ -209,17 +209,16 @@ void Gui_FreeOverlay(struct Screen* overlay) {
|
||||
|
||||
void Gui_RenderGui(Real64 delta) {
|
||||
GfxCommon_Mode2D(Game_Width, Game_Height);
|
||||
if (Gui_Active == NULL || !Gui_Active->HidesHUD) {
|
||||
Elem_Render(Gui_Status, delta);
|
||||
}
|
||||
bool showHUD = Gui_Active == NULL || !Gui_Active->HidesHUD;
|
||||
if (showHUD) { Elem_Render(Gui_Status, delta); }
|
||||
|
||||
if (Gui_Active == NULL || !Gui_Active->HidesHUD && !Gui_Active->RenderHUDOver) {
|
||||
if (showHUD && !Gui_Active->RenderHUDOver) {
|
||||
Elem_Render(Gui_HUD, delta);
|
||||
}
|
||||
if (Gui_Active) {
|
||||
Elem_Render(Gui_Active, delta);
|
||||
}
|
||||
if (Gui_Active && !Gui_Active->HidesHUD && Gui_Active->RenderHUDOver) {
|
||||
if (showHUD && Gui_Active->RenderHUDOver) {
|
||||
Elem_Render(Gui_HUD, delta);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ Int32 input_classicViewDists[4] = { 8, 32, 128, 512 };
|
||||
DateTime input_lastClick;
|
||||
Real32 input_fovIndex = -1.0f;
|
||||
|
||||
static bool InputHandler_IsMousePressed(MouseButton button) {
|
||||
bool InputHandler_IsMousePressed(MouseButton button) {
|
||||
if (Mouse_IsPressed(button)) return true;
|
||||
|
||||
/* Key --> mouse mappings */
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
struct Screen;
|
||||
|
||||
bool InputHandler_IsMousePressed(MouseButton button);
|
||||
bool InputHandler_SetFOV(Int32 fov, bool setZoom);
|
||||
void InputHandler_PickBlocks(bool cooldown, bool left, bool middle, bool right);
|
||||
void InputHandler_Init(void);
|
||||
|
@ -27,4 +27,4 @@ void DisplayDevice_Init(void) {
|
||||
DisplayDevice_Meta[1] = screen;
|
||||
DisplayDevice_Meta[2] = rootWin;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user