Euphoria
eu::core::ViewportDefinition Struct Reference

#include <viewportdef.h>

Public Member Functions

 ViewportDefinition (const Recti &screen, float w, float h)
 

Static Public Member Functions

static ViewportDefinition from_fit_with_black_bars (float width, float height, int window_width, int window_height)
 The viewport is scaled, with aspect in mind, and centered. More...
 
static ViewportDefinition from_extend (float width, float height, int window_width, int window_height)
 The viewports height or width is extended to match the screen. More...
 
static ViewportDefinition from_screen_pixel (int window_width, int window_height)
 The viewport matches the screen pixel by pixel. More...
 

Public Attributes

Recti screen_rect
 
float virtual_width
 
float virtual_height
 

Detailed Description

Definition at line 8 of file viewportdef.h.

Constructor & Destructor Documentation

◆ ViewportDefinition()

eu::core::ViewportDefinition::ViewportDefinition ( const Recti screen,
float  w,
float  h 
)

Definition at line 99 of file viewportdef.cc.

Member Function Documentation

◆ from_extend()

ViewportDefinition eu::core::ViewportDefinition::from_extend ( float  width,
float  height,
int  window_width,
int  window_height 
)
static

The viewports height or width is extended to match the screen.

Fits the viewport, scaling it to the max and then fits the viewport without stretching. This means that the viewport isnt the same size as requested.

Definition at line 54 of file viewportdef.cc.

◆ from_fit_with_black_bars()

ViewportDefinition eu::core::ViewportDefinition::from_fit_with_black_bars ( float  width,
float  height,
int  window_width,
int  window_height 
)
static

The viewport is scaled, with aspect in mind, and centered.

Fits the viewport, scaling it, keeping the aspect ratio. Black bars may appear if the aspect ration doesnt match

Definition at line 9 of file viewportdef.cc.

◆ from_screen_pixel()

ViewportDefinition eu::core::ViewportDefinition::from_screen_pixel ( int  window_width,
int  window_height 
)
static

The viewport matches the screen pixel by pixel.

Definition at line 84 of file viewportdef.cc.

Member Data Documentation

◆ screen_rect

Recti eu::core::ViewportDefinition::screen_rect

Definition at line 10 of file viewportdef.h.

◆ virtual_height

float eu::core::ViewportDefinition::virtual_height

Definition at line 13 of file viewportdef.h.

◆ virtual_width

float eu::core::ViewportDefinition::virtual_width

Definition at line 12 of file viewportdef.h.


The documentation for this struct was generated from the following files: