Cleanup / Wextra

Added -Wextra and fixed warnings that appeared

Converted olcPixelGameEngine to unix line endings because it was
annoying me
This commit is contained in:
Thomas Muller 2021-05-01 17:30:05 -04:00
parent 439051e52c
commit 3029d22fd8
Signed by: thomas
GPG key ID: AF006EB730564952
4 changed files with 5115 additions and 5106 deletions

View file

@ -4,7 +4,7 @@ project(main)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
include_directories(src)
add_definitions(-g)

View file

@ -20,6 +20,8 @@ bool App::OnUserCreate()
bool App::OnUserUpdate(float delta)
{
(void)delta;
Vector2<int> screen = {ScreenWidth(), ScreenHeight()};
Vector2<int> mouse = {GetMouseX(), GetMouseY()};

View file

@ -3201,8 +3201,8 @@ namespace olc
PGEX::PGEX(bool bHook) { if(bHook) pge->pgex_Register(this); }
void PGEX::OnBeforeUserCreate() {}
void PGEX::OnAfterUserCreate() {}
void PGEX::OnBeforeUserUpdate(float& fElapsedTime) {}
void PGEX::OnAfterUserUpdate(float fElapsedTime) {}
void PGEX::OnBeforeUserUpdate(float& fElapsedTime) { (void)fElapsedTime; }
void PGEX::OnAfterUserUpdate(float fElapsedTime) { (void)fElapsedTime; }
// Need a couple of statics as these are singleton instances
// read from multiple locations
@ -3305,6 +3305,7 @@ namespace olc
olc::rcode CreateDevice(std::vector<void*> params, bool bFullScreen, bool bVSYNC) override
{
#if defined(OLC_PLATFORM_WINAPI)
(void)bFullScreen;
// Create Device Context
glDeviceContext = GetDC((HWND)(params[0]));
PIXELFORMATDESCRIPTOR pfd =
@ -3329,6 +3330,7 @@ namespace olc
#endif
#if defined(OLC_PLATFORM_X11)
(void)bFullScreen;
using namespace X11;
// Linux has tighter coupling between OpenGL and X11, so we store
// various "platform" handles in the renderer
@ -3368,6 +3370,7 @@ namespace olc
#endif
}
#else
(void)bFullScreen;
glEnable(GL_TEXTURE_2D); // Turn on texturing
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
#endif
@ -3520,6 +3523,7 @@ namespace olc
void ReadTexture(uint32_t id, olc::Sprite* spr) override
{
(void)id;
glReadPixels(0, 0, spr->width, spr->height, GL_RGBA, GL_UNSIGNED_BYTE, spr->GetData());
}
@ -4237,6 +4241,8 @@ namespace olc
olc::rcode SaveImageResource(olc::Sprite* spr, const std::string& sImageFile) override
{
(void)spr;
(void)sImageFile;
return olc::rcode::OK;
}
};

View file

@ -7,6 +7,7 @@ class Vector2 {
public:
Vector2() = default;
Vector2(T x, T y) : m_x(x), m_y(y) {}
Vector2(const Vector2<T> &other) = default;
T x() { return m_x; }
T y() { return m_y; }