1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Cosmetic: apply clang-format

This commit is contained in:
Mathieu Schroeter 2023-06-20 22:19:25 +02:00
parent 914878634a
commit 1e8e8213a7
No known key found for this signature in database
GPG Key ID: 8B9145A5FA9DA8A8
15 changed files with 51 additions and 50 deletions

View File

@ -57,7 +57,7 @@ void
CDecor::MapInitColors ()
{
// FIXME: add big-endian support
const auto MapRGB = [](Uint8 r, Uint8 g, Uint8 b) {
const auto MapRGB = [] (Uint8 r, Uint8 g, Uint8 b) {
return r << 16 | g << 8 | b << 0;
};
@ -515,7 +515,7 @@ CDecor::GenerateMap ()
Point pos, cel;
Sint32 dx, rank, i;
auto DrawMap = [&]() -> bool {
auto DrawMap = [&] () -> bool {
if (!m_SurfaceMap)
return true;

View File

@ -1915,9 +1915,8 @@ CDecor::CelOkForAction (
cel.x--;
cel.y--;
if (
!bStrong || bTransport || bVehicule ||
m_blupi[rank].perso == 8) // disciple ?
if (!bStrong || bTransport || bVehicule || m_blupi[rank].perso == 8) // disciple
// ?
{
error = Errors::MISC; // pas assez fort
}
@ -1970,9 +1969,8 @@ CDecor::CelOkForAction (
cel.x--;
cel.y--;
if (
!bStrong || bTransport || bVehicule ||
m_blupi[rank].perso == 8) // disciple ?
if (!bStrong || bTransport || bVehicule || m_blupi[rank].perso == 8) // disciple
// ?
{
error = Errors::MISC; // pas assez fort
}

View File

@ -125,7 +125,8 @@ CPixmap::CreateMainTexture ()
Sint32
CPixmap::Blit (
Sint32 dstCh, SDL_Texture * src, const SDL_Rect & dstRect, double angle, SDL_RendererFlip flip)
Sint32 dstCh, SDL_Texture * src, const SDL_Rect & dstRect, double angle,
SDL_RendererFlip flip)
{
Sint32 res;
auto target = SDL_GetRenderTarget (g_renderer);
@ -150,8 +151,7 @@ CPixmap::Blit (
if (this->mainTexture)
SDL_SetRenderTarget (g_renderer, target ? target : this->mainTexture);
res = SDL_RenderCopyEx (
g_renderer, src, nullptr, &dstRect, angle,
nullptr, flip);
g_renderer, src, nullptr, &dstRect, angle, nullptr, flip);
if (this->mainTexture)
SDL_SetRenderTarget (g_renderer, target);
}
@ -159,8 +159,7 @@ CPixmap::Blit (
{
SDL_SetRenderTarget (g_renderer, m_SDLTextureInfo[dstCh].texture);
res = SDL_RenderCopyEx (
g_renderer, src, nullptr, &dstRect, angle,
nullptr, flip);
g_renderer, src, nullptr, &dstRect, angle, nullptr, flip);
SDL_SetRenderTarget (g_renderer, target);
}
@ -436,8 +435,7 @@ CPixmap::Cache (
switch (mode)
{
case FIX:
case FIX_REVERSABLE:
{
case FIX_REVERSABLE: {
if (channel == CHBACK && (ow < LXIMAGE () || oh < LYIMAGE ()))
{
if (!wideName.empty ())
@ -467,8 +465,7 @@ CPixmap::Cache (
}
case EXPAND:
case EXPAND_REVERSABLE:
{
case EXPAND_REVERSABLE: {
auto isFlipped = flip == SDL_FLIP_HORIZONTAL;
SDL_Rect src, dst;

View File

@ -106,7 +106,9 @@ public:
void FromGameToDisplay (Sint32 & x, Sint32 & y);
Sint32 Blit (
Sint32 dstCh, SDL_Texture * src, const SDL_Rect & dstRect, double angle, SDL_RendererFlip flip);
Sint32 dstCh, SDL_Texture * src, const SDL_Rect & dstRect, double angle,
SDL_RendererFlip flip);
protected:
Sint32 BltFast (
Sint32 dstCh, size_t srcCh, Rect dstR, Rect srcR,
@ -136,8 +138,10 @@ protected:
SDL_Cursor * m_lpCurrentCursor;
SDL_Cursor * m_lpSDLCursors[MAXCURSORS];
SDL_Surface * m_lpSDLBlupi;
public:
SDL_Texture * mainTexture;
protected:
std::unordered_map<size_t, TextureInfo> m_SDLTextureInfo;
};

View File

@ -24,7 +24,7 @@
class Platform
{
private:
static std::function<void(const SDL_Event &)> handleEvent;
static std::function<void (const SDL_Event &)> handleEvent;
private:
static void timer (void *);
@ -33,5 +33,5 @@ public:
enum Type { JS, SDL };
static Platform::Type getType ();
static void run (std::function<void(const SDL_Event &)> handleEvent);
static void run (std::function<void (const SDL_Event &)> handleEvent);
};

View File

@ -24,7 +24,7 @@
#include "../event.h"
#include "../platform.h"
std::function<void(const SDL_Event &)> Platform::handleEvent;
std::function<void (const SDL_Event &)> Platform::handleEvent;
Platform::Type
Platform::getType ()
@ -33,12 +33,12 @@ Platform::getType ()
}
void
Platform::run (std::function<void(const SDL_Event &)> handleEvent)
Platform::run (std::function<void (const SDL_Event &)> handleEvent)
{
Platform::handleEvent = handleEvent;
Platform::timer (nullptr);
emscripten_set_main_loop (
[]() {
[] () {
SDL_Event event;
while (SDL_PollEvent (&event))
{

View File

@ -21,7 +21,7 @@
#include "../event.h"
#include "../platform.h"
std::function<void(const SDL_Event &)> Platform::handleEvent;
std::function<void (const SDL_Event &)> Platform::handleEvent;
Platform::Type
Platform::getType ()
@ -30,11 +30,11 @@ Platform::getType ()
}
void
Platform::run (std::function<void(const SDL_Event &)> handleEvent)
Platform::run (std::function<void (const SDL_Event &)> handleEvent)
{
SDL_TimerID updateTimer = SDL_AddTimer (
g_timerInterval,
[](Uint32 interval, void * param) -> Uint32 {
[] (Uint32 interval, void * param) -> Uint32 {
CEvent::PushUserEvent (EV_UPDATE);
return interval;
},

View File

@ -127,7 +127,7 @@ CSound::Create ()
Mix_AllocateChannels (MAXSOUND);
Mix_HookMusicFinished ([]() { CEvent::PushUserEvent (EV_MUSIC_STOP); });
Mix_HookMusicFinished ([] () { CEvent::PushUserEvent (EV_MUSIC_STOP); });
return true;
}

View File

@ -145,7 +145,11 @@ public:
TTF_SetFontDirection (this->font, TTF_DIRECTION_RTL);
}
~Font () { this->cache.Clear (); TTF_CloseFont (this->font); }
~Font ()
{
this->cache.Clear ();
TTF_CloseFont (this->font);
}
TTF_Font * GetFont () { return this->font; }
@ -390,9 +394,7 @@ public:
TTF_SetFontScriptName (this->arabicWhite->GetFont (), "Arab");
}
~Fonts ()
{
}
~Fonts () {}
void Clear ()
{