start fullscreen, resolution, aspect, exit game?

0 favourites
  • 6 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I want to create game that can:

    1) Start in fullscreen (and hide cursor, as well as start in specified resolution, instead of using desktop resolution only)

    2) Can switch resolution in-game

    3) Can enumerate list of available system resolutions, instead of

    using hardcoded list

    4) Can store resolution settings in config (ini) or registry and start next time in saved resolution

    5) Can switch to windowed mode and back with standard ALT+WIN (or browser standard F11) or in-game menu item.

    6) Can keep proper aspect ratio in any fullscreen resolution, as well as any windowed mode including user stretched mode (i wish window to autocorrect ver and hor resolution as same time user resizing it, to keep aspect ratio)

    7) Can have at least 3 UI presets for 4:3, 16:9 and 16:10 displays and switch to them automaticaly according to current resolution aspect ratio.

    Or at least fixed 16:9 in every aspect, with no funny glitches.

    8) Can exit fullscreen game with menu item "exit" in addition to Alt+F4 or X button in window.

    9) Can do all of above on every posible exported platform\format (all node-webkit wrappers for linux, osx and windows are minimum i need).

    How can i achive that with Constuct 2? I dont see any in editor options for that!

    A the moment i only managed to launch node-webkit in fullscreen by editing \Construct 2\exporters\html5\node-webkit\package.json and adding

    "fullscreen": true,

    in window section. But it only allows to launch game in same resolution as desktop have now, and it upscales layout by keeping fixed horizontal aspect, vertical aspect meanwhile gets bigger, if im going from wider 16:9 to no so wider 16:10 or 4:3, if i go to anything wider than 16:9, then vertical aspect is fixed, but foreground level element with paralax set to 100 goes beyond layout and appears above black bars, while fixed background covers only 16:9 area.

    As for rest - im almost out of ideas!

    Im thinking about using javascript window.close() as function for exit button or using this github.com/rogerwang/node-webkit/wiki/Window for closing, changing resolution, switching to windowed and fullscreen, but i have no idea where in Construct 2 i should put these js functions to be called whenever button pressed in game.

    Well, im thinking about ugly hack - manually editing html file after export and adding some overlay above game with exit button that call these JS functions, but thats a lot of extra work and really ugly, comparing to native in-game expirience.

    Also i would like to auto pause game on unfocused or minimized window or during using, but yet have no idea how to make it in Constuct 2.

    Can anyone please give some tips, share portions of code from your games that would do this, or maybe Scirra guys can add these features to their TO-DO list (and with high priority, because its one of the must have features that Constuct 2 really needs ASAP) so that in near features that would be built-in and can be done easy way?

    P.S. - I can do most of that in flash with some projectors like Zinc with no problem, but here its a real problem!

  • Use the Browser object's 'Request fullscreen' and 'Cancel fullscreen' actions. You can request fullscreen on startup with node-webkit. The Browser 'close' action should also exit (although there's a bug about that sometimes crashing that is being investigated). C2 automatically pauses the game when minimized (or invisible, like switching to another tab in a browser).

    Generally I think it's best to avoid messing with the user's resolution - 2D games can run fullscreen just fine on most computers.

  • *tips*

    Yes it's possible to edit the package.json to launch nw with fullscreen or kiosk mode set to "true" ... but in this case the project is launch with a fullscreen WHITE window and seems also spend time doing this.

    It's far better to use the C2 specific "loader" system and request a fullscreen at start using a empty "black" layer and then "go to" your layout when the loader system is completed (this should be instant unless in preview mode).

  • You can request fullscreen on startup with node-webkit.

    Unfortunately there is only option to maximize the window. When I export to EXE with node-webkit, after maximizing the game it still has the top bar and the bottom bar (with tray and opened apps).

  • tecbug

    Use the browser object.. request full screen.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It works :)

    Thanks.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)