Jump to content


Photo

*SOLVED*view_hview and view_wview*SOLVED*


  • Please log in to reply
4 replies to this topic

#1 cori5555

cori5555

    GMC Member

  • New Member
  • 293 posts

Posted 22 July 2011 - 09:57 AM

Pretty simple question, which of the following does view_hview and view_wview do?

1. Show the Y/X of the bottom/right side of the view

Or...

2. Tell the height/width of the view

Alright -- What the help file says is #2

view_wview[0..7] Width of the view in the room.
view_hview[0..7] Height of the view in the room.


However while coding I've found that while putting "view_xview[0] + view_wview[0]" does not seem to give me the X of the right side of the view, the "Deactivating Instances" section of the guide seems to agree that this doesn't work. And seems to point out #1 as the proper answer...

{
  instance_activate_all();
  instance_deactivate_region(view_xview[0],view_yview[0],view_wview[0],view_hview[0],false,true);
}


Notice how that example code uses "view_wview[0]" and "view_hview[0]" instead of "view_xview[0] + view_wview[0]" and "view_yview[0] + view_hview[0]"?

So this is pretty much me wondering which one it is so once and for all I will finally know which one to use.

And if it is #1 then -- How do I then find the X/Y of the right/bottom of the view...?

Edited by cori5555, 22 July 2011 - 10:21 AM.

  • 0

#2 SenakuJin

SenakuJin

    GMC Member

  • New Member
  • 2765 posts

Posted 22 July 2011 - 10:01 AM

The function instance_deactivate_region(left,top,width,height,inside,notme), as shown uses width and height for argument 2 and 3.

So it is:

2. Tell the height/width of the view


view_xview[0] + view_wview[0] should give you the right side of the view, what is your code exactly?
  • 0

#3 ookami125

ookami125

    GMC Member

  • GMC Member
  • 217 posts
  • Version:GM:Studio

Posted 22 July 2011 - 10:01 AM

to find the right side of the view just add the width to the x value same for the bottom add the height to the y

edit:lol im a little slow

Edited by ookami125, 22 July 2011 - 10:02 AM.

  • 0

#4 beatson

beatson

    GMC Member

  • GMC Member
  • 317 posts
  • Version:GM8

Posted 22 July 2011 - 10:02 AM

view_wview[*] gives the actual width of the view. So if the width is set to 500, whether you're view is half way across the room or at the very left hand side, it will always return 500. To find the right/bottom of the view, simply do:
right = view_xview[0]+view_wview[0];
bottom = view_yview[0]+view_hview[0];

Edit: I'm even slower :/

Edited by beatson, 22 July 2011 - 10:03 AM.

  • 0

#5 cori5555

cori5555

    GMC Member

  • New Member
  • 293 posts

Posted 22 July 2011 - 10:06 AM

Thankyou everybody for such a quick response, the reason I was questioning it was because I thought it was #2 but it didn't seem to be working with what I was doing and #1 I didn't actually test... But either way it turned out the reason it wasn't working was because I had accidentally used method #1 while being confused about what those 2 codes actually did...
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users