The Daily Click ::. Forums ::. Klik Coding Help ::. How to display a subapp always center of screen?
 

Post Reply  Post Oekaki 
 

Posted By Message

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
13th September, 2009 at 17:19:38 -

Hi there!

Maybe I'm a little stupid right now, but I can't find a solid way to display a subapp as a sprite always at the center of the screen. I can't set it at the player, because the player is not always centered. Maybe I'm a little stupid right now, but how do I center subapps independant of the player position, frame position, frame width and height?

Many thx for your help

 
www.paulinthenet.de
www.gungirl2.com

Sumo148

Super amazing fantastic user

Registered
  26/01/2009
Points
  530

360 OwnerThe Cake is a LieVIP MemberPokemon Ball!I am an April FoolI donated an open source projectSanta Hat
13th September, 2009 at 17:37:39 -

Put a sub app in your game frame.

Always> Set position of sub app to (X,Y)

Play around with the numbers until it becomes centered.

 
n/a

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
13th September, 2009 at 17:43:30 -

This is not going to work, because the frame position is dynamic.

 
www.paulinthenet.de
www.gungirl2.com

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1968

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
13th September, 2009 at 17:49:21 -

Use the "Window Control" extension, and make sure you tick the box "Popup Window" (let me know if you don't want it a popup - the formula is slightly different then)

* Start of Frame (or whatever)
-> SubApp: Set X Position to (ScreenXSize( "Window Control" )-(X Right( "Sub-Application" )-X Left( "Sub-Application" )))/2
-> SubApp: Set Y Position to (ScreenYSize( "Window Control" )-(Y Bottom( "Sub-Application" )-Y Top( "Sub-Application" )))/2

 
n/a

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
13th September, 2009 at 17:51:32 -

I have to do all this because I can't use the 'popup window' option anymore (clickteam can't fix an issue with that in HWA version). But big thanks so far

 
www.paulinthenet.de
www.gungirl2.com

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1968

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
13th September, 2009 at 18:02:46 -

Really?
You can try this:

* Always (or whatever)
-> SubApp: Set X Position to ((ScreenXSize( "Window Control" )-(X Right( "Sub-Application" )-X Left( "Sub-Application" )))/2)-WinXPos( "Window Control" )
-> SubApp: Set Y Position to ((ScreenYSize( "Window Control" )-(Y Bottom( "Sub-Application" )-Y Top( "Sub-Application" )))/2)-WinYPos( "Window Control" )

I don't think it's going to work if your level scrolls though - that would take some more adjustments.
Also, it will cut off parts of the subapp if they don't overlap the main window (eg. if it's only 640x480 windowed, and the player drags the window away from the center of the screen) - that would be unavoidable.

What's the subapp for? There may be a simpler alternative...

Edited by Sketchy

 
n/a

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
13th September, 2009 at 19:19:36 -

The screen is scrolling. I set the screen X and Y with an object that "smoothes" the X and Y of the current frame to the position of the player object.

The sub application is my start-button-menu. Whenever the player presses the start button, a menu pops up showing him his items, quest status etc.

Until now this has functioned by using "window popup" + "modal" settings. But these settings are not possible in full screen if you use HWA (which I do!). Since I want the player to use full screen when he likes, a change is unavoidable.

But how do I display the sub app properly?

 
www.paulinthenet.de
www.gungirl2.com

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1968

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
13th September, 2009 at 19:51:54 -

-> Set X Position to (((X Right Frame-X Left Frame)-(X Right( "Sub-Application" )-X Left( "Sub-Application" )))/2)+X Left Frame
-> Set Y Position to (((Y Bottom Frame-Y Top Frame)-(Y Bottom( "Sub-Application" )-Y Top( "Sub-Application" )))/2)+Y Top Frame

That will display the subapp always in "the centre of the visible part of the frame" (not technically the same thing as "the centre of the screen").



 
n/a

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
13th September, 2009 at 20:19:19 -

omg this was so easy to solve... thx a bunch, I feel so stupid right now, but it works fine now

I'll leave this topic so somebody can find this information and profit from it.

 
www.paulinthenet.de
www.gungirl2.com
   

Post Reply



 



Advertisement

Worth A Click