SDL_GPUViewport(3type)

πŸ’… NAME πŸ’…

SDL_GPUViewport β€” it's a struct, bestie, and it's literally the thing that describes a viewport ✨


πŸŽ€ SYNOPSIS πŸŽ€

Okay so first you gotta pull in the header, no cap:

#include <SDL3/SDL_gpu.h>

And here's the whole entire glow-up, six floats, that's it, that's the queen πŸ‘‘

typedef struct SDL_GPUViewport
{
    float x;          /**< The left offset of the viewport. */
    float y;          /**< The top offset of the viewport. */
    float w;          /**< The width of the viewport. */
    float h;          /**< The height of the viewport. */
    float min_depth;  /**< The minimum depth of the viewport. */
    float max_depth;  /**< The maximum depth of the viewport. */
} SDL_GPUViewport;

So like, let's break it down because the way this is structured is giving main character energy 🌸

  • float x β€” the left offset of the viewport. Where it starts horizontally, periodt.
  • float y β€” the top offset of the viewport. Where it starts vertically, iykyk.
  • float w β€” the width of the viewport. How wide she is πŸ’–
  • float h β€” the height of the viewport. How tall she is πŸ¦‹
  • float min_depth β€” the minimum depth of the viewport. The shallow end, lowkey.
  • float max_depth β€” the maximum depth of the viewport. The deep end, highkey.

It's giving "six numbers walk into a render pass" and honestly? Obsessed. πŸ”₯


🌈 AVAILABILITY 🌈

This struct has been serving looks since SDL 3.2.0. Available, iconic, no notes. ✨


πŸ‘‘ SEE ALSO πŸ‘‘


Simple Directmedia Layer wrote this one, and we're repping SDL 3.4.18 over here, so like, you're reading the current era, fr fr πŸ’œ

Bye bestie, go set a viewport, slay πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from