GithubHelp home page GithubHelp logo

odins1970 / display_settings Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yal-gamemaker/display_settings

0.0 0.0 0.0 75 KB

Brings back the GM8-era display_set_all function

Home Page: https://yellowafterlife.itch.io/gamemaker-display-settings

C++ 28.14% C 1.86% Game Maker Language 10.20% HTML 46.56% Batchfile 13.25%

display_settings's Introduction

display_settings

This DLL adds back the display_set_all function on Windows. The syntax is as following:

display_set_all(width, height, frequency, coldepth, flags)➜bool

Changes one or more display parameters.

Width and height are in pixels.

Frequency is in hertz (e.g. 60).

Color depth can be 16 or 32 (I don't suggest touching it).

Flags can be:

  • 0
    Default behaviour (change and that's it)
  • display_settings_flag_fullscreen
    Uses CDS_FULLSCREEN - settings will generally revert upon exiting the game.
  • display_settings_flag_test
    Uses CDS_TEST - tests whether the combination of settings is supported without applying.
    (display_test_all is included as a convenience shorthand and uses this)

width/height/frequency/coldepth can be set to 0 to leave them untouched.

Returns whether successful.

display_test_all(width, height, frequency, coldepth)➜bool

A shorthand for display_set_all(width, height, frequency, coldepth, display_settings_flag_test).

display_set_size(width, height)➜bool

A shorthand for display_set_all(width, height, 0, 0, 0).

display_set_frequency(frequency)➜bool

A shorthand for display_set_all(0, 0, frequency, 0, 0).

display_set_colordepth(frequency)➜bool

A shorthand for display_set_all(0, 0, frequency, 0, 0).

Examples

// changes resolution to 1920x1080
display_set_size(1920, 1080);
// sets refresh rate to 75Hz if supported, to 60Hz otherwise
if (display_test_all(0, 0, 75, 0)) {
    display_set_frequency(75);
} else display_set_frequency(60);
// error handling
if (!display_set_all(1920, 1080, 75, 0, 0)) {
    show_message("Couldn't change to 1920x1080@75Hz!");
}

Installing

  • GameMaker: Studio:
    Import the GMEZ by right-clicking Extensions folder in the resource tree and picking "Import extension"
  • GameMaker Studio 2 Import the YYMP[S] by drag and dropping it onto your workspace or picking menu:Tools➜Import Local Package
    (use YYMP in GMS≤2.2.5 an YYMPS in newer versions)

Meta

Author: YellowAfterlife
License: MIT

display_settings's People

Contributors

yellowafterlife avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.