[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
66
S
22
G
4
Posts: 360
Reputation: 6,584

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
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

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
66
S
22
G
4
Posts: 360
Reputation: 6,584

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
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

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
66
S
22
G
4
Posts: 360
Reputation: 6,584

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
25
S
14
G
139
Posts: 877
Reputation: 72,512

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
66
S
22
G
4
Posts: 360
Reputation: 6,584

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
25
S
14
G
139
Posts: 877
Reputation: 72,512

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
66
S
22
G
4
Posts: 360
Reputation: 6,584

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
25
S
14
G
139
Posts: 877
Reputation: 72,512

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests