GetScreenHeight

From ZDoom Wiki

Jump to: navigation, search

int GetScreenHeight (void)

Usage

Returns the vertical resolution. For example, if you are playing in 800x600 it will return 600. This is mainly useful for formatting hudmessages which you want to put in the same position on all screens when using SetHudSize.

Return value

The vertical resolution of the screen.

Examples

This script places an @ symbol at the left hand side of the screen, 100 pixels from the bottom.

script 1 (void)
{
    int h = GetScreenHeight();
    SetHudSize(GetScreenWidth(), h, 1);
 
    h = (h - 100) << 16;

    HudMessage(s:"@"; HUDMSG_PLAIN, 1,
        CR_BLUE, 0.1, h + 0.1, 10.0);
}

The application of this is that upon building a custom graphic for a HUD, you may want to position info/health/meters/etc. around the edge of the screen according to some positioning system, without necessarily resizing them. See also the command SetFont.

Personal tools