Tscope5
|
Go to the source code of this file.
Functions | |
Basic operations | |
A display can either be a window or a fullscreen display. There are three basic display operations:
| |
int | ts5_install_display () |
void | ts5_clear_display () |
double | ts5_flip_display () |
Setting the display target | |
Tscope5 supports multiple displays (each call to ts5_install_display() opens a new display).
You can also redirect drawing to memory bitmaps (see bitmaps.c) using ts5_set_drawing_target(). | |
int | ts5_set_active_display (const int display) |
int | ts5_get_active_display () |
TS5_BITMAP * | ts5_set_drawing_target (TS5_BITMAP *target) |
TS5_BITMAP * | ts5_get_drawing_target () |
Display adapter settings | |
A display adapter is a physical monitor that is attached to the computer. Tscope5 supports multiple display adapters. Functions are available to query the number and dimensions of each display adapter. | |
int | ts5_get_num_display_adapters () |
void | ts5_get_display_adapter_size (const int adapter, double *w, double *h) |
double | ts5_get_display_adapter_width (const int adapter) |
double | ts5_get_display_adapter_height (const int adapter) |
Display settings | |
Before opening a display various settings can be requested using the functions below. Once a display is opened the settings remain until the end of the program. | |
int | ts5_set_display_adapter (const int adapter) |
int | ts5_get_display_adapter (const int display) |
void | ts5_set_display_size (double w, double h) |
void | ts5_get_display_size (const int display, double *w, double *h) |
double | ts5_get_display_width (const int display) |
double | ts5_get_display_height (const int display) |
void | ts5_set_display_position (double x, double y) |
void | ts5_get_display_position (const int display, double *x, double *y) |
double | ts5_get_display_x (const int display) |
double | ts5_get_display_y (const int display) |
int | ts5_set_refreshrate (const int rate) |
int | ts5_get_refreshrate (const int display) |
int | ts5_set_display_mode (const int mode) |
int | ts5_get_display_mode (const int display) |
int | ts5_set_vsync_mode (const int mode) |
int | ts5_get_vsync_mode (const int display) |
Definition in file display.c.
int ts5_install_display | ( | ) |
Open a new display.
TS5_FULLSCREEN_WINDOW mode:
TS5_FULLSCREEN mode:
TS5_WINDOWED mode:
The new display is the drawing target for future drawing operations.
void ts5_clear_display | ( | ) |
Clear the current drawing target.
The drawing target can either be a display or a bitmap (to clear a bitmap: set it as drawing target and call ts5_clear_display()).
The background color is controlled by ts5_set_background_color().
double ts5_flip_display | ( | ) |
Make what has been drawn visible on the screen.
All drawing operations (primitives, text, bitmaps, ...) are performed on a back buffer. Once you have finished drawing you should call this function to make your drawings visible on the screen. After a call to this function the back buffer is not cleared.
int ts5_set_active_display | ( | const int | display | ) |
Set the active display.
display | Index of the display. |
The 'active' display is the display that will be used for drawing operations.
int ts5_get_active_display | ( | ) |
TS5_BITMAP* ts5_set_drawing_target | ( | TS5_BITMAP * | target | ) |
Set the active drawing target.
target | Pointer to the bitmap that will be used for drawing operations. |
TS5_BITMAP* ts5_get_drawing_target | ( | ) |
int ts5_get_num_display_adapters | ( | ) |
Get the number of display adapters that are connected to the system.
void ts5_get_display_adapter_size | ( | const int | adapter, |
double * | w, | ||
double * | h | ||
) |
Get the size of the monitor attached to a display adapter.
adapter | Index of the display adapter. |
w | Variable that will store the width. |
h | Variable that will store the height. |
w and h are the maximum size of a window that can be opened on that adapter.
Pass 0 to get the size of the display adapter for the next display.
You can pass NULL for values you are not interested in.
double ts5_get_display_adapter_width | ( | const int | adapter | ) |
double ts5_get_display_adapter_height | ( | const int | adapter | ) |
int ts5_set_display_adapter | ( | const int | adapter | ) |
Set the display adapter for the next display that will be opened.
adapter | Index of the active display adapter. |
A display adapter corresponds to a physical display that is attached to the computer. The first adapter has index 1, etc.
The display is attached to adapter 1 by default.
int ts5_get_display_adapter | ( | const int | display | ) |
void ts5_set_display_size | ( | double | w, |
double | h | ||
) |
Set the size of the next display.
w | Width of the next display in pixels. |
h | Height of the next display in pixels. |
The default width and height is 320 x 240. This is also the minimum.
void ts5_get_display_size | ( | const int | display, |
double * | w, | ||
double * | h | ||
) |
Get the size of a display.
display | Index of the display. |
w | Variable that will store the width. |
h | Variable that will store the height. |
Set display to 0 to get the width of the next display.
You can pass NULL for values you are not interested in.
double ts5_get_display_width | ( | const int | display | ) |
double ts5_get_display_height | ( | const int | display | ) |
void ts5_set_display_position | ( | double | x, |
double | y | ||
) |
Set the position of the next display.
x | Horizontal position of the display on the desktop. |
y | Vertical position of the display on the desktop. |
Only meaningful for non-fullscreen displays.
CARTESIAN coordinates: Center of the display is the origin, default position is the center of the display.
COMPUTER coordinates: The upper left corner of the display is the origin, default position is top left corner of the display.
void ts5_get_display_position | ( | const int | display, |
double * | x, | ||
double * | y | ||
) |
Get the position of a display.
display | Index of the display. |
x | Variable that will store the horizontal position. |
y | Variable that will store the vertical position. |
Only meaningful for non-fullscreen displays.
Set display to 0 to get the x position of the next display.
You can pass NULL for values you are not interested in.
double ts5_get_display_x | ( | const int | display | ) |
double ts5_get_display_y | ( | const int | display | ) |
int ts5_set_refreshrate | ( | const int | rate | ) |
Set the requested refreshrate for the next display.
rate | Refreshrate in cycles per second. |
The refreshrate can only be changed for real fullscreen displays.
Even then this is only a request.
The default value 0 (let the system choose).
int ts5_get_refreshrate | ( | const int | display | ) |
int ts5_set_display_mode | ( | const int | mode | ) |
Set the display mode for the next display.
mode | Window mode. Can be TS5_WINDOWED, TS5_FULLSCREEN or TS5_FULLSCREEN_WINDOW. |
In TS5_WINDOWED mode the window can have any dimension that will fit on the physical display and the position of the window on the display can be adjusted. Multiple TS5_WINDOWED displays can be combined on one physical display. The refreshrate is always the refreshrate of the physical display.
In TS5_FULLSCREEN_WINDOW mode the display always has the dimension of the desktop. The refreshrate is always the refreshrate of the physical display. Only one TS5_FULLSCREEN_WINDOW display can be used per physical display.
TS5_FULLSCREEN modes are the most flexible: any combination of display dimension and refreshrate that is supported by the monitor can be set. Does not seem to work on Mac.
The default window mode is TS5_WINDOWED.
int ts5_get_display_mode | ( | const int | display | ) |
int ts5_set_vsync_mode | ( | const int | mode | ) |
Set the vsync mode for the next display.
mode | Vsync mode. Can be TS5_VSYNC_WHATEVER, TS5_VSYNC_ON or TS5_VSYNC_OFF. |
The default vsync mode is TS5_VSYNC_ON.