Window

About


Akel windows are components that are added to the application. Their parameters can be modified through functions. They are all linked to a renderer. Because of the youth of Akel, their functioning will change a lot during its development.

Syntax


class CustomComponent : public Ak::WindowComponent
{
    public:
        void onAttach() override
        {
            Ak::WindowComponent::onAttach();
            Ak::WindowComponent::title = "My Window";
            Ak::WindowComponent::size = Ak::Maths::Vec2<int>(1280, 750);
            Ak::WindowComponent::resizable = true;
            Ak::WindowComponent::fetchSettings;
        }

        void onEvent(Ak::Input& input) override
        {
            Ak::WindowComponent::onEvent(input);
        }
        void onQuit() override
        { 
            Ak::WindowComponent::onQuit();
        }
};

Member functions


Return type Function Specifiers
WindowComponent()
~WindowComponent()
void onAttach() override
void onEvent(Ak::Input& input) override
void onQuit() override
SDL_Window* getNativeWindow() inline - const - noexcept

Constructor


Creates a new WindowComponent.

// Prototype
WindowComponent();

// Usage
class CustomComponent : public Ak::WindowComponent
{
    public :
        CustomComponent() : Ak::WindowComponent() {}
};

Destructor


Deletes the WindowComponent.

// Prototype
~WindowComponent();

// Usage

// Automatic

onAttach()


Inits the component at the begenning of the application call.

// Prototype
void onAttach() override;

// Usage
CustomComponent::onAttach() override
{
    Ak::WindowComponent::onAttach();
    /* ... */
}

onEvent(Ak::Input& input)


Updates the window when the application that contains that component will update the events.

// Prototype
void onEvent(Ak::Input& input) override;

// Usage
CustomComponent::onEvent(Ak::Input& input) override
{
    Ak::WindowComponent::onEvent(input);
    /* ... */
}

onQuit()


Quit function that is called when the component is destroyed.

// Prototype
void onQuit() override;

// Usage
CustomComponent::onQuit() override
{
    Ak::WindowComponent::onQuit();
    /* ... */
}

getNativeWindow()


Get the native SDL2 window pointer.

// Prototype
inline SDL_Window* getNativeWindow() const noexcept

// Usage
SDL_Window* win = Ak::WindowComponent::getNativeWindow();

Settings


Type Setting
std::string title
std::string icon
Ak::Maths::Vec2<int> size
Ak::Maths::Vec2<int> pos
Ak::Maths::Vec2<int> minSize
Ak::Maths::Vec2<int> maxSize
float brightness
float opacity
bool fullscreen
bool border
bool resizable
bool visible
bool vsync
bool maximize
bool minimize