Skip to content

Commit 95404c4

Browse files
committed
Improve code style
1 parent 418c28b commit 95404c4

File tree

7 files changed

+23
-19
lines changed

7 files changed

+23
-19
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ jobs:
143143
- name: Build
144144
shell: pwsh
145145
run: .\tools\cmdline\axmol -p winuwp -a x64 -O3 -xc '-DAX_RENDER_API=d3d11'
146+
winuwp-d3d12:
147+
runs-on: windows-latest
148+
steps:
149+
- uses: actions/checkout@v6
150+
151+
- name: Build
152+
shell: pwsh
153+
run: .\tools\cmdline\axmol -p winuwp -a x64 -O3 -xc '-DAX_RENDER_API=d3d12'
146154
win32-clang-ogl:
147155
runs-on: windows-latest
148156
steps:

axmol/base/Director.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ void Director::calculateDeltaTime()
401401
// new delta time. Re-fixed issue #1277
402402
if (_nextDeltaTimeZero)
403403
{
404-
_deltaTime = 1e-6;
404+
_deltaTime = 1e-6f;
405405
_nextDeltaTimeZero = false;
406406
_lastUpdate = std::chrono::steady_clock::now();
407407
}
@@ -414,7 +414,7 @@ void Director::calculateDeltaTime()
414414
_deltaTime = std::chrono::duration_cast<std::chrono::microseconds>(now - _lastUpdate).count() / 1000000.0f;
415415
_lastUpdate = now;
416416
}
417-
_deltaTime = MAX(1e-6, _deltaTime);
417+
_deltaTime = MAX(1e-6f, _deltaTime);
418418
}
419419

420420
#if defined(_AX_DEBUG) && _AX_DEBUG
@@ -1288,7 +1288,7 @@ void Director::resume()
12881288
#endif
12891289

12901290
_paused = false;
1291-
_deltaTime = 1e-6;
1291+
_deltaTime = 1e-6f;
12921292
// fix issue #3509, skip one fps to avoid incorrect time calculation.
12931293
setNextDeltaTimeZero(true);
12941294
}

axmol/base/Director.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ class AX_DLL Director
610610
EventCustom* _eventAfterGfxDrop = nullptr;
611611

612612
/* delta time since last tick to main loop */
613-
float _deltaTime = 1e-6;
613+
float _deltaTime = 1e-6f;
614614
bool _deltaTimePassedByCaller = false;
615615

616616
/* The _renderView, where everything is rendered, RenderView is a abstract class,cocos2d-x provide RenderViewImpl

extensions/ImGui/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,9 @@ public:
6969
```
7070
More about use imgui widgets, please see: https://github.com/ocornut/imgui
7171
72-
## Tested devices
72+
## Supported platforms
7373
74-
* win32
75-
* macOS
76-
* Android
74+
All platforms supported by axmol.
7775
7876
## Notes
7977

extensions/ImGui/src/ImGui/ImGuiPresenter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ THE SOFTWARE.
2626
#include <assert.h>
2727
#if defined(AX_PLATFORM_PC)
2828
# include "backends/imgui_impl_glfw.h"
29-
# include "backends/imgui_impl_axmol.h"
3029
#else
3130
# include "backends/imgui_impl_axmol_sw.h"
3231
#endif
32+
#include "backends/imgui_impl_axmol.h"
3333
#include "imgui_internal.h"
3434
#include "misc/freetype/imgui_freetype.h"
3535

@@ -292,7 +292,7 @@ void ImGuiPresenter::init()
292292
IMGUI_CHECKVERSION();
293293
ImGui::CreateContext();
294294
ImGuiIO& io = ImGui::GetIO();
295-
(void)io;
295+
296296
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
297297
// io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
298298
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
@@ -327,7 +327,7 @@ void ImGuiPresenter::init()
327327
auto window = static_cast<RenderViewImpl*>(Director::getInstance()->getRenderView())->getWindow();
328328
ImGui_ImplGlfw_InitForAxmol(window, true);
329329
#else
330-
ImGui_ImplAxmolSW_InitForAxmol(Director::getInstance()->getRenderView(), true);
330+
ImGui_ImplAxmolSW_Init(Director::getInstance()->getRenderView(), true);
331331
#endif
332332
ImGui_ImplAxmol_Init();
333333

extensions/ImGui/src/ImGui/backends/imgui_impl_axmol_sw.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static bool ImGui_ImplAxmol_HitTest(const ImVec2& p)
105105
static int s_CapturedTouchId = -1;
106106

107107
// Functions
108-
bool ImGui_ImplAxmolSW_InitForAxmol(RenderView* window, bool install_callbacks)
108+
bool ImGui_ImplAxmolSW_Init(RenderView* window, bool install_callbacks)
109109
{
110110
ImGuiIO& io = ImGui::GetIO();
111111
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
@@ -114,11 +114,8 @@ bool ImGui_ImplAxmolSW_InitForAxmol(RenderView* window, bool install_callbacks)
114114
ImGui_ImplAxmolSW_Data* bd = IM_NEW(ImGui_ImplAxmolSW_Data)();
115115
io.BackendPlatformUserData = (void*)bd;
116116
io.BackendPlatformName = "imgui_impl_axmol_sw";
117-
// io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
118-
io.BackendFlags |=
119-
ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
120-
// io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform
121-
// side (optional)
117+
// We can honor io.WantSetMousePos requests (optional, rarely used)
118+
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos;
122119

123120
bd->Window = window;
124121
bd->Time = 0.0;
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#pragma once
2-
#include "imgui_impl_axmol.h"
2+
3+
#include "imgui.h"
34
#include "axmol/platform/RenderView.h"
45

56
/// ImGui Axmol SingleWindow platform spec APIs
6-
IMGUI_IMPL_API bool ImGui_ImplAxmolSW_InitForAxmol(ax::RenderView* window, bool install_callbacks);
7+
IMGUI_IMPL_API bool ImGui_ImplAxmolSW_Init(ax::RenderView* window, bool install_callbacks);
78
IMGUI_IMPL_API void ImGui_ImplAxmolSW_Shutdown();
89
IMGUI_IMPL_API void ImGui_ImplAxmolSW_NewFrame();

0 commit comments

Comments
 (0)