Skip to content

Commit 90d5e46

Browse files
committed
Remove dependency on libfmt
1 parent 7b8ed9d commit 90d5e46

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7+
- Remove dependency on libfmt
78
- Library update
8-
- fmt 11.2.0
99
- GRRMOD (670f84601a5086c4d3eeb03bd3041e3c0a7f0ace)
1010
- GRRLIB (c3f2acfee7a4a93e35ade02408daa1508c9309f5)
1111

CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,17 @@ pkg_check_modules(FREETYPE REQUIRED freetype2)
1717
pkg_check_modules(MXML REQUIRED mxml)
1818

1919
include(FetchContent)
20-
FetchContent_Declare(fmt
21-
URL https://github.com/fmtlib/fmt/archive/refs/tags/11.2.0.tar.gz
22-
)
2320
FetchContent_Declare(grrlib
2421
GIT_REPOSITORY https://github.com/GRRLIB/GRRLIB.git
2522
GIT_TAG c3f2acfee7a4a93e35ade02408daa1508c9309f5
2623
)
2724
FetchContent_Declare(grrmod
2825
URL https://codeload.github.com/GRRLIB/GRRMOD/tar.gz/670f84601a5086c4d3eeb03bd3041e3c0a7f0ace
2926
)
30-
set(FMT_INSTALL OFF CACHE BOOL "Don't install" FORCE)
3127
set(GRRLIB_INSTALL OFF CACHE BOOL "Don't install" FORCE)
3228
set(GRRMOD_INSTALL OFF CACHE BOOL "Don't install" FORCE)
3329
set(GRRMOD_USE_MP3 OFF CACHE BOOL "Don't use MP3" FORCE)
34-
FetchContent_MakeAvailable(fmt grrlib grrmod)
30+
FetchContent_MakeAvailable(grrlib grrmod)
3531

3632
file(GLOB_RECURSE SRC_FILES
3733
"${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp"
@@ -70,7 +66,6 @@ dkp_add_embedded_binary_library(data
7066

7167
target_link_libraries(Wii-Tac-Toe PRIVATE
7268
data
73-
fmt::fmt
7469
grrlib
7570
grrmod
7671
${PNG_LIBRARIES}

source/game.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#include <cstdio>
22
#include <cstdlib>
33
#include <ctime>
4+
#include <chrono>
45
#include <charconv>
56
#include <limits>
7+
#include <format>
68
#include <wiiuse/wpad.h>
79
#include <ogc/conf.h>
810
#include <ogc/lwp_watchdog.h>
911
#include "grrlib.h"
1012
#include "grrlib_class.h"
11-
#include "fmt/format.h"
12-
#include "fmt/chrono.h"
1313
#include "tools.h"
1414
#include "grid.h"
1515
#include "audio.h"
@@ -138,10 +138,10 @@ Game::Game(u16 GameScreenWidth, u16 GameScreenHeight) :
138138
// Build Start Screen background
139139
SplashImg->Draw(0, 0);
140140
GRRLIB_PrintfTTF(50, 310, DefaultFont,
141-
fmt::format(fmt::runtime(Lang->String("Programmer: {}")), "Crayon").c_str(),
141+
std::format(std::runtime_format(Lang->String("Programmer: {}")), "Crayon").c_str(),
142142
11, 0xFFFFFFFF);
143143
GRRLIB_PrintfTTF(50, 330, DefaultFont,
144-
fmt::format(fmt::runtime(Lang->String("Graphics: {}")), "Mr_Nick666").c_str(),
144+
std::format(std::runtime_format(Lang->String("Graphics: {}")), "Mr_Nick666").c_str(),
145145
11, 0xFFFFFFFF);
146146
text = Lang->String("Press The A Button");
147147
GRRLIB_PrintfTTF((ScreenWidth / 2) - (GRRLIB_WidthTTF(DefaultFont, text.c_str(), 20) / 2),
@@ -232,7 +232,7 @@ void Game::Paint()
232232
if(ShowFPS == true)
233233
{
234234
CalculateFrameRate();
235-
const auto strFPS = fmt::format("FPS: {}", FPS);
235+
const auto strFPS = std::format("FPS: {}", FPS);
236236
GRRLIB_PrintfTTF(14, 444, DefaultFont, strFPS.c_str(), 17, 0xFFFFFFFF);
237237
GRRLIB_PrintfTTF(16, 446, DefaultFont, strFPS.c_str(), 17, 0x808080FF);
238238
GRRLIB_PrintfTTF(15, 445, DefaultFont, strFPS.c_str(), 17, 0x000000FF);
@@ -484,7 +484,7 @@ void Game::MenuScreen(bool CopyScreen)
484484
Rectangle(0, 385, ScreenWidth, 95, 0x000000FF, 1);
485485

486486
GRRLIB_PrintfTTF(500, 40, DefaultFont,
487-
fmt::format(fmt::runtime(Lang->String("Ver. {}")), "1.1.0").c_str(),
487+
std::format(std::runtime_format(Lang->String("Ver. {}")), "1.1.0").c_str(),
488488
12, 0xFFFFFFFF);
489489

490490
if(CopyScreen == true)
@@ -742,8 +742,8 @@ bool Game::ControllerManager()
742742
WPAD_Rumble(WPAD_CHAN_ALL, 1); // Rumble on
743743
WIILIGHT_TurnOn();
744744

745-
const std::time_t now = std::time(nullptr);
746-
const auto path = fmt::format("sd:/Screenshot {:%F %H%M%S}.png", *std::localtime(&now));
745+
const auto now = std::chrono::time_point_cast<std::chrono::seconds>(std::chrono::system_clock::now());
746+
const auto path = std::format("sd:/Screenshot {:%F %H%M%S}.png", now);
747747

748748
if(ScreenShot(path) == true)
749749
{
@@ -774,7 +774,7 @@ void Game::Clear()
774774
GameGrid->Clear();
775775
CurrentPlayer = PlayerToStart;
776776
PlayerToStart = !PlayerToStart; // Next other player will start
777-
text = fmt::format(fmt::runtime(Lang->GetTurnOverMessage()), WTTPlayer[CurrentPlayer].GetName());
777+
text = std::format(std::runtime_format(Lang->GetTurnOverMessage()), WTTPlayer[CurrentPlayer].GetName());
778778
RoundFinished = false;
779779
Copied = false;
780780
ChangeCursor();
@@ -790,7 +790,7 @@ void Game::TurnIsOver()
790790
{ // A winner is declare
791791
GameWinner = (GameWinner == WTTPlayer[0].GetSign()) ? 0 : 1;
792792
WTTPlayer[GameWinner].IncScore();
793-
text = fmt::format(fmt::runtime(Lang->GetWinningMessage()),
793+
text = std::format(std::runtime_format(Lang->GetWinningMessage()),
794794
WTTPlayer[GameWinner].GetName(), WTTPlayer[!GameWinner].GetName());
795795
RoundFinished = true;
796796
SymbolAlpha = 5;
@@ -805,7 +805,7 @@ void Game::TurnIsOver()
805805
else
806806
{
807807
CurrentPlayer = !CurrentPlayer; // Change player's turn
808-
text = fmt::format(fmt::runtime(Lang->GetTurnOverMessage()), WTTPlayer[CurrentPlayer].GetName());
808+
text = std::format(std::runtime_format(Lang->GetTurnOverMessage()), WTTPlayer[CurrentPlayer].GetName());
809809
}
810810

811811
Copied = false;

0 commit comments

Comments
 (0)