raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming

Home Page:http://www.raylib.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does MaximiseWindow() work on Mac?

st203 opened this issue · comments

Issue description

MaximiseWindow() not working. The initial window size (272x160) is kept. Apologies if this is a user error.

Environment

2020 M11 Mac (ARM), OpenGL version string: 2.1 Metal - 88.1

Code Example

#include <raylib.h>

int main(void)
{
    const int screenWidth = 272;
    const int screenHeight = 160;

    InitWindow(screenWidth, screenHeight, "raylib - parallax example");
    MaximizeWindow();

    Texture2D bg = LoadTexture("images/bg.png");
    Texture2D mg = LoadTexture("images/mg.png");
    Texture2D fg = LoadTexture("images/fg.png");

    float bg_spd = 0.0f;
    float mg_spd = 0.0f;
    float fg_spd = 0.0f;

    SetTargetFPS(60);

    while (!WindowShouldClose())
    {
        bg_spd -= 1.0f;
        mg_spd -= 2.0f;
        fg_spd -= 3.0f;

        if (bg_spd <= -bg.width) bg_spd = 0;
        if (mg_spd <= -mg.width) mg_spd = 0;
        if (fg_spd <= -fg.width) fg_spd = 0;

        BeginDrawing();

            ClearBackground(GetColor(0x052c46ff));

            DrawTextureEx(bg, (Vector2){ bg_spd, 0 }, 0.0f, 1.0f, WHITE);
            DrawTextureEx(bg, (Vector2){ bg_spd + bg.width, 0 }, 0.0f, 1.0f, WHITE);

            DrawTextureEx(mg, (Vector2){ mg_spd, 0 }, 0.0f, 1.0f, WHITE);
            DrawTextureEx(mg, (Vector2){ mg_spd + mg.width, 0 }, 0.0f, 1.0f, WHITE);

            DrawTextureEx(fg, (Vector2){ fg_spd, 0 }, 0.0f, 1.0f, WHITE);
            DrawTextureEx(fg, (Vector2){ fg_spd + fg.width, 0 }, 0.0f, 1.0f, WHITE);

        EndDrawing();
    }

    UnloadTexture(bg);
    UnloadTexture(mg);
    UnloadTexture(fg);

    CloseWindow();

    return 0;
}

Hello,

Try setting the flag resizable SetWindowState(FLAG_WINDOW_RESIZABLE); before calling MaximizeWindow(); (reference).

Best regards.

commented

@st203 Yes, it should work, but you should set the mention flag