Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Window Flag wrapping #345

Open
Knoficooki opened this issue Jan 8, 2025 · 6 comments
Open

Missing Window Flag wrapping #345

Knoficooki opened this issue Jan 8, 2025 · 6 comments

Comments

@Knoficooki
Copy link

Knoficooki commented Jan 8, 2025

I have been looking a lot and can not find a wrapping for the Window flags, though it would be easy to implement and maintain.

raylib.h

typedef enum {
    FLAG_VSYNC_HINT         = 0x00000040,   // Set to try enabling V-Sync on GPU
    FLAG_FULLSCREEN_MODE    = 0x00000002,   // Set to run program in fullscreen
    FLAG_WINDOW_RESIZABLE   = 0x00000004,   // Set to allow resizable window
    FLAG_WINDOW_UNDECORATED = 0x00000008,   // Set to disable window decoration (frame and buttons)
    FLAG_WINDOW_HIDDEN      = 0x00000080,   // Set to hide window
    FLAG_WINDOW_MINIMIZED   = 0x00000200,   // Set to minimize window (iconify)
    FLAG_WINDOW_MAXIMIZED   = 0x00000400,   // Set to maximize window (expanded to monitor)
    FLAG_WINDOW_UNFOCUSED   = 0x00000800,   // Set to window non focused
    FLAG_WINDOW_TOPMOST     = 0x00001000,   // Set to window always on top
    FLAG_WINDOW_ALWAYS_RUN  = 0x00000100,   // Set to allow windows running while minimized
    FLAG_WINDOW_TRANSPARENT = 0x00000010,   // Set to allow transparent framebuffer
    FLAG_WINDOW_HIGHDPI     = 0x00002000,   // Set to support HighDPI
    FLAG_WINDOW_MOUSE_PASSTHROUGH = 0x00004000, // Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
    FLAG_BORDERLESS_WINDOWED_MODE = 0x00008000, // Set to run program in borderless windowed mode
    FLAG_MSAA_4X_HINT       = 0x00000020,   // Set to try enabling MSAA 4X
    FLAG_INTERLACED_HINT    = 0x00010000    // Set to try enabling interlaced video format (for V3D)
} ConfigFlags;

raylib-cpp could look like this:

enum class ConfigFlags {
    VSYNC_HINT         = 0x00000040,   // Set to try enabling V-Sync on GPU
    FULLSCREEN_MODE    = 0x00000002,   // Set to run program in fullscreen
    WINDOW_RESIZABLE   = 0x00000004,   // Set to allow resizable window
    WINDOW_UNDECORATED = 0x00000008,   // Set to disable window decoration (frame and buttons)
    WINDOW_HIDDEN      = 0x00000080,   // Set to hide window
    WINDOW_MINIMIZED   = 0x00000200,   // Set to minimize window (iconify)
    WINDOW_MAXIMIZED   = 0x00000400,   // Set to maximize window (expanded to monitor)
    WINDOW_UNFOCUSED   = 0x00000800,   // Set to window non focused
    WINDOW_TOPMOST     = 0x00001000,   // Set to window always on top
    WINDOW_ALWAYS_RUN  = 0x00000100,   // Set to allow windows running while minimized
    WINDOW_TRANSPARENT = 0x00000010,   // Set to allow transparent framebuffer
    WINDOW_HIGHDPI     = 0x00002000,   // Set to support HighDPI
    WINDOW_MOUSE_PASSTHROUGH = 0x00004000, // Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
    BORDERLESS_WINDOWED_MODE = 0x00008000, // Set to run program in borderless windowed mode
    MSAA_4X_HINT       = 0x00000020,   // Set to try enabling MSAA 4X
    INTERLACED_HINT    = 0x00010000    // Set to try enabling interlaced video format (for V3D)
};

Though it would be nice to rename them:

enum class WindowFlags {
    vsync_hint = 0x00000040,   // Set to try enabling V-Sync on GPU
    fullscreen_mode = 0x00000002,   // Set to run program in fullscreen
    
    mssa_4x_hint = 0x00000020,   // Set to try enabling MSAA 4X
    interlaced_hint = 0x00010000,    // Set to try enabling interlaced video format (for V3D)

    resizable   = 0x00000004,   // Set to allow resizable window
    undecorated = 0x00000008,   // Set to disable window decoration (frame and buttons)
    hidden      = 0x00000080,   // Set to hide window
    minimized   = 0x00000200,   // Set to minimize window (iconify)
    maximized   = 0x00000400,   // Set to maximize window (expanded to monitor)
    unfocused   = 0x00000800,   // Set to window non focused
    topmost     = 0x00001000,   // Set to window always on top
    always_run  = 0x00000100,   // Set to allow windows running while minimized
    transparent = 0x00000010,   // Set to allow transparent framebuffer
    highdpi     = 0x00002000,   // Set to support HighDPI
    mouse_passthrough = 0x00004000, // Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
    windowed_mode = 0x00008000, // Set to run program in borderless windowed mode
}
@RobLoach
Copy link
Owner

RobLoach commented Jan 8, 2025

In the Window constructor?
https://robloach.github.io/raylib-cpp/classraylib_1_1_window.html#a9a61cbac2a61611c0f0979f3ec43d98f

You're still able to use the c flags in c++. Is that what you're asking?

@Knoficooki
Copy link
Author

I know I am still able to, but I would actually prefer to use a wrapper in this case, because I only want to use the raylib namespace and not a global one

@Knoficooki
Copy link
Author

I mean you can probably also put something like:

namespace raylib {
    using WindowFlags = ConfigFlags;
}

I just want to be able to access it through the raylib namespace.

@RobLoach
Copy link
Owner

RobLoach commented Jan 8, 2025

That's an interesting idea. Perhaps adding that directly in Window.hpp?

namespace raylib {
    using ConfigFlags = ::ConfigFlags;
}

@Knoficooki
Copy link
Author

Yea I'd like that

@RobLoach
Copy link
Owner

RobLoach commented Jan 8, 2025

Would you like to submit a Pull Request for it? Want to make sure git credits appropriately 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants