mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -07:00
Compare commits
2 commits
062ffeab5c
...
df72c1aad1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df72c1aad1 | ||
|
|
40ab70b804 |
6 changed files with 68 additions and 13 deletions
|
|
@ -3,22 +3,27 @@ name: pre-commit
|
||||||
on:
|
on:
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
|
env:
|
||||||
|
PRE_COMMIT_VERSION: 4.6.0
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
pre-commit:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-python@v7
|
- uses: actions/setup-python@v7
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
- id: restore-pip-cache
|
- uses: actions/cache@v6
|
||||||
uses: actions/cache/restore@v6
|
|
||||||
with:
|
with:
|
||||||
key: pip-cache-v1-${{ github.workflow }}
|
key: pip-cache-v1-${{github.workflow}}-${{env.pythonLocation}}-${{env.PRE_COMMIT_VERSION}}
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
- uses: pre-commit/action@v3.0.1
|
- run: python -m pip install pre-commit=="${{ env.PRE_COMMIT_VERSION }}"
|
||||||
- uses: actions/cache/save@v6
|
shell: bash
|
||||||
if: steps.restore-pip-cache.outcome == 'success'
|
- run: python -m pip freeze --local
|
||||||
|
shell: bash
|
||||||
|
- uses: actions/cache@v6
|
||||||
with:
|
with:
|
||||||
key: pip-cache-v1-${{ github.workflow }}
|
path: ~/.cache/pre-commit
|
||||||
path: ~/.cache/pip
|
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||||
|
- run: pre-commit run --show-diff-on-failure --color=always --all-files
|
||||||
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -273,8 +273,16 @@ private:
|
||||||
|
|
||||||
if (evt.GetWheelRotation())
|
if (evt.GetWheelRotation())
|
||||||
{
|
{
|
||||||
float speed = 16.f * ScenarioEditor::GetSpeedModifier();
|
if (evt.GetWheelAxis() == wxMOUSE_WHEEL_VERTICAL)
|
||||||
POST_MESSAGE(SmoothZoom, (eRenderView::GAME, evt.GetWheelRotation() * speed / evt.GetWheelDelta()));
|
{
|
||||||
|
float speed = 16.f * ScenarioEditor::GetSpeedModifier();
|
||||||
|
POST_MESSAGE(SmoothZoom, (eRenderView::GAME, evt.GetWheelRotation() * speed / evt.GetWheelDelta()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float speed = ScenarioEditor::GetSpeedModifier();
|
||||||
|
POST_MESSAGE(RotateY, (evt.GetWheelRotation() * speed / evt.GetWheelDelta()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2012 Wildfire Games.
|
/* Copyright (C) 2026 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
|
|
@ -41,7 +41,8 @@ struct GameLoopState
|
||||||
struct Input
|
struct Input
|
||||||
{
|
{
|
||||||
float scrollSpeed[6]; // [fwd, bwd, left, right, cw-rotation, ccw-rotation]. 0.0f for disabled.
|
float scrollSpeed[6]; // [fwd, bwd, left, right, cw-rotation, ccw-rotation]. 0.0f for disabled.
|
||||||
float zoomDelta;
|
float zoomDelta{0.f};
|
||||||
|
float rotateDelta{0.f};
|
||||||
} input;
|
} input;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,14 @@ MESSAGEHANDLER(RotateAround)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MESSAGEHANDLER(RotateY)
|
||||||
|
{
|
||||||
|
if (!g_Game || g_Game->GetView()->GetCinema()->IsPlaying())
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_AtlasGameLoop->input.rotateDelta = msg->angle;
|
||||||
|
}
|
||||||
|
|
||||||
MESSAGEHANDLER(LookAt)
|
MESSAGEHANDLER(LookAt)
|
||||||
{
|
{
|
||||||
// TODO: different camera depending on msg->view
|
// TODO: different camera depending on msg->view
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,35 @@ bool InputProcessor::ProcessInput(GameLoopState* state)
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state->input.rotateDelta != 0.f)
|
||||||
|
{
|
||||||
|
float angle{4 * state->realFrameLength};
|
||||||
|
if (input.rotateDelta > 0 )
|
||||||
|
{
|
||||||
|
if (angle > input.rotateDelta)
|
||||||
|
{
|
||||||
|
angle = input.rotateDelta;
|
||||||
|
input.rotateDelta = 0.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
input.rotateDelta -= angle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
angle *= -1;
|
||||||
|
if (angle < input.rotateDelta)
|
||||||
|
{
|
||||||
|
angle = input.rotateDelta;
|
||||||
|
input.rotateDelta = 0.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
input.rotateDelta -= angle;
|
||||||
|
}
|
||||||
|
Rotate(camera, angle);
|
||||||
|
|
||||||
|
moved = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (moved)
|
if (moved)
|
||||||
{
|
{
|
||||||
camera.UpdateFrustum();
|
camera.UpdateFrustum();
|
||||||
|
|
|
||||||
|
|
@ -456,6 +456,10 @@ MESSAGE(RotateAround,
|
||||||
((Position, pos))
|
((Position, pos))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
MESSAGE(RotateY,
|
||||||
|
((float, angle))
|
||||||
|
);
|
||||||
|
|
||||||
MESSAGE(LookAt,
|
MESSAGE(LookAt,
|
||||||
((int, view)) // eRenderView
|
((int, view)) // eRenderView
|
||||||
((Position, pos))
|
((Position, pos))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue