Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Pages: [1] 2  All

Author Topic: resizing windows  (Read 10166 times)

0 Members and 1 Guest are viewing this topic.

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
resizing windows
« on: July 26, 2008, 06:01:17 AM »

Hey guys i just wanted to know if there was a way to resize windows. That included the all the elements in that window. So say the window is too big, then i can go and make it smaller.

Cheers,
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

DocBass

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 136
    • View Profile
Re: resizing windows
« Reply #1 on: July 26, 2008, 10:01:43 AM »

Do you mean in the engine while the game is running? Resizing the window in the editor is trivial so I will skip that...

Yeah you can change the size of a window. Just set something like

Code: [Select]
Window.Width = 300;
Window.Height = 400;

with "Window" being a reference to the window that you want to change.

You can also scale the entities within a window. So for example if you have a window that contains an entity, which of course contains a sprite. You could do:

Code: [Select]
var entcontainer = Window.GetControl("entitycontainer"); //entitycontainer is the name of your entity object in the window
var entity = entcontainer.GetEntity(); //extracts entity out of the container
entity.Scalable = true; //Make sure your entity can be scaled, not necessary depending on entity def
entity.Scale = 50; //Scale entity to 50% of actual size

That's a rough guideline of how you could resize what's in the window. You should able to do what you want pretty much, I didn't try setting the entities sizes manually but you can give it a shot. Not sure if it works as I've never tried it and never needed too. You can try messing with the other window elements based on the small example above. Let me know if that helps at all.
Logged

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: resizing windows
« Reply #2 on: July 26, 2008, 10:44:05 AM »

Hey man, I tried it but it didn't work. Which I thought it wouldn't because those attributes arn't past on to the Window class.

Cheers ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

DocBass

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 136
    • View Profile
Re: resizing windows
« Reply #3 on: July 26, 2008, 11:28:01 AM »

Hey man, I tried it but it didn't work. Which I thought it wouldn't because those attributes arn't past on to the Window class.

Cheers ::beer
Myles Blasonato.

It works, I did it myself. Try it with a tiled background and you will see the window changes size. Can you post your code? I would suggest reading all of the documentation on the Window object.
« Last Edit: July 26, 2008, 11:33:40 AM by DocBass »
Logged

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: resizing windows
« Reply #4 on: July 28, 2008, 01:14:23 AM »

Ok, so it only works with Tiled backgrounds. Which sucks cause I tend not to use them.

Cheers ::beer
Myles Blasonato
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
Re: resizing windows
« Reply #5 on: July 28, 2008, 02:16:38 AM »

you can make any window at any size you want. Tiled or not.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: resizing windows
« Reply #6 on: July 28, 2008, 03:12:03 AM »

Well I tested and it doesn't work. I'm not sure what's wrong.

Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

DocBass

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 136
    • View Profile
Re: resizing windows
« Reply #7 on: July 28, 2008, 09:08:54 AM »

Well I tested and it doesn't work. I'm not sure what's wrong.



You can post your code first off, which might help. It does work, there is just a mistake somewhere. And again, read the documentation if you have any questions, it really is pretty well put together. Show us what you have and we could probably identify where the problem is. You can use fake names for the variables if you wanted to hide what you're creating of course.
Logged

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: resizing windows
« Reply #8 on: August 12, 2008, 03:02:38 AM »

DocBass, what is my code going to do, I did what you posted and I have tried over and over. Do i need to use sprites to do this or can i just use png's? I have posted my code anyway.

I tried scale on the png and sprite and it didn't work and resizing the window only resizes the control box. I resized the button and if I look at the debug box it has scale at 500 but again the image hasn't increased in size, I am assuming that it increased the control box since it does say that the scale is 500. Also "adad" is a sprite.

Code: [Select]
interface = Game.LoadWindow("interface\system\inGameGUI.window");

global entcontainer = interface.GetControl("adad");
entcontainer.Scalable = true;
entcontainer.Scale = 500;

Also getEntity isn't a method that belongs to the window class.

« Last Edit: August 12, 2008, 03:12:52 AM by mylesb »
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: resizing windows
« Reply #9 on: August 12, 2008, 06:42:04 AM »

Your code is quite different from the on DocBass supplied.

Code: WME Script
  1. var entcontainer = Window.GetControl("entitycontainer");
  2. var entity = entcontainer.GetEntity();
  3. entity.Scalable = true;
  4. entity.Scale = 50;
  5.  

you're setting entcontainer directly while DocBass queried entitycontainer first to get back the attached entity and then set the scale of the entity, not the entitycontainer...
« Last Edit: August 12, 2008, 06:44:20 AM by metamorphium »
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: resizing windows
« Reply #10 on: August 13, 2008, 01:53:12 AM »

getEntity doesn't work
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: resizing windows
« Reply #11 on: August 13, 2008, 09:15:49 AM »

it works. Your code doesn't work. And it's GetEntity, not getEntity.

If you want us to help you, you should really post your code and window definition. Simply stating that something doesn't work, will never get us anywhere.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: resizing windows
« Reply #12 on: August 13, 2008, 02:07:42 PM »

Meta I used GetEntity and it didn't work, it's ok though cause I just resized the window in photoshop and re-imported it.

Thanks for the help anyway guys.

Cheers ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: resizing windows
« Reply #13 on: August 23, 2008, 08:20:09 AM »

Hey guys, again I need help with the same problem. Here is my code:
Code: [Select]
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
var entcontainer = WinMenu.GetControl("Talk");
var entity = entcontainer.GetEntity();
entity.Scalable = true;
entity.Scale = 50; 

I have also tried the following:
Code: [Select]
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
WinMenu.Scalable = true;
WinMenu.Scale = 50; 


I use sprites for the graphics in the menu and other GUI windows but for some reason when I try to scale them, it doesn't work. I don't want to scale the control, I want to scale the image. I don't use tiled images, only sprites.

Cheers ::beer
Myles Blasonato
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: resizing windows
« Reply #14 on: August 23, 2008, 08:22:39 AM »

Post your window definition. Especially the part which defines your "Talk" entitycontainer.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
Pages: [1] 2  All
 

Page created in 0.076 seconds with 25 queries.