[SOLVED] How do I center the window?

Get help using Construct 2

Post » Fri Apr 08, 2016 12:01 am

I've set up a system that remember and sets a custom window width/height every time you start the game, the only problem is that when it triggers, the game window is not centered on my screen. Is there some java code allowing me to do that?
Last edited by Danwood on Sat Apr 09, 2016 2:02 am, edited 1 time in total.
B
65
S
22
G
4
Posts: 358
Reputation: 6,555

Post » Fri Apr 08, 2016 12:27 am

Are you talking about centering in a browser? Phone?

Do you have an example/screenshot?
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Fri Apr 08, 2016 12:32 am

oosyrag wrote:Are you talking about centering in a browser? Phone?

Do you have an example/screenshot?


Centering the game window (in windows)
B
65
S
22
G
4
Posts: 358
Reputation: 6,555

Post » Fri Apr 08, 2016 12:47 am

With NW.js? Do you have any fullscreen scaling?

Should be automatically centered... If you're talking about your game in a window centered on the users screen/desktop, I don't think that can be done within the program, it will be up to the user to manually reposition the window.

Or maybe I still don't understand what you are talking about.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Fri Apr 08, 2016 12:57 am

oosyrag wrote:If you're talking about your game in a window centered on the users screen/desktop


Yes that is my issue. The prblem is whenever the window changes from NW.js it is no longer centered on the desktop, so the user must manually reposition it, and that's what i want to prevent. It's a minor thing, i now xD
B
65
S
22
G
4
Posts: 358
Reputation: 6,555

Post » Fri Apr 08, 2016 7:21 am

@Danwood

You could test this little app (64b) to test center position if you want.
Works on Win7 64b, I don't trest on win8.1/win10 atm.
Image Image
B
22
S
13
G
135
Posts: 871
Reputation: 70,320

Post » Fri Apr 08, 2016 9:02 am

MadSpy wrote:@Danwood

You could test this little app (64b) to test center position if you want.
Works on Win7 64b, I don't trest on win8.1/win10 atm.


That works! how to integrate it in my project? :D
B
65
S
22
G
4
Posts: 358
Reputation: 6,555

Post » Fri Apr 08, 2016 10:58 am

I quickly created a node-webkit-advanced plugin with node-webkit original features plus extra features (Quit app, SetWindowPositionToCenter, enter fullscreen, leave fullscreen, trigger when lost focus, trigger on focus, force quit app when on close event...)
Image Image
B
22
S
13
G
135
Posts: 871
Reputation: 70,320

Post » Fri Apr 08, 2016 11:09 am

MadSpy wrote:I quickly created a node-webkit-advanced plugin with node-webkit original features plus extra features (Quit app, SetWindowPositionToCenter, enter fullscreen, leave fullscreen, trigger when lost focus, trigger on focus, force quit app when on close event...)


Is it hard to do, could i do it myself too or i need to get the plugin?
B
65
S
22
G
4
Posts: 358
Reputation: 6,555

Post » Fri Apr 08, 2016 9:27 pm

I think you can close this thread as Solved - I will post the download link for this plugin soon
Image Image
B
22
S
13
G
135
Posts: 871
Reputation: 70,320

Next

Return to How do I....?

Who is online

Users browsing this forum: OBLIVION, unicornspitfire, zenox98 and 11 guests