Skip to content
Ninu Laari edited this page Jan 2, 2025 · 1 revision

Fix memos

RendererBase overscoping (26.11.2024)

Instead of attempting to abstract all the different renderers into subclasses call by call at the same time, reduce scope by first abstracting just the currently used one.

Namespace Usage

Encapsulate related variables within namespaces to avoid global scope and reduce the need for g prefixes.

namespace Engine {
    namespace Core {
        int framecount = 0;
        bool running = false;
    }

    namespace Graphics {
        SDL_Window* gWindow = nullptr;
        SDL_Renderer* gRenderer = nullptr;
        SDL_Texture* gTexture = nullptr;
        float clearColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
        int screen_width = 480;
        int screen_height = 320;
    }
}

Class Member Variables:

If variables are logically tied to a class, use member variables (mWindow, mSurface) instead of global scope, adhering to encapsulation principles.

Clone this wiki locally