Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Pop-up window  (Read 3784 times)

0 Members and 1 Guest are viewing this topic.

Ennio

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 40
    • View Profile
Pop-up window
« on: December 26, 2011, 05:17:25 PM »

Hi everybody, merry xmas :D

I'm trying to implement in my game a pop-up window wich appears in some situation. Something like "Your diary has been updated", wich appears like friends login advise on skype or msn...you know?

I create a window to do that...but the only way to display it on screen is by calling GoSystemExclusive, while i want to allow player to continue playing while showing advise, and let it autoclose after some time...

And this is the first problem...the second one is that i'd like to have the animation...any idea how to program the window tho pop up like skype/msn advise?

Thank you for help :)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Pop-up window
« Reply #1 on: December 26, 2011, 06:27:05 PM »

Actually you don't need GoSystemExclusive(), just set the window's .Visible property to true.
As for animation, if you mean a fade-in effect, you can achieve it by changing the window's alpha. See this post, there's a script for fading the actor, but you can do the same with your window.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Ennio

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 40
    • View Profile
Re: Pop-up window
« Reply #2 on: December 26, 2011, 06:40:34 PM »

Yea! It works, thank you!
For animation fade is a good solution, but the effect i intend is a bit different: i want the window scroll up from the bottom of the screen, you know, like when someone write you on skype and you are browsing other window
Logged

Ennio

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 40
    • View Profile
Re: Pop-up window
« Reply #3 on: December 27, 2011, 11:59:26 AM »

I've made it, and it works perfect.
The solution is pretty simple:

(myWindow.Script)
Code: [Select]
//the starting position is at the bottom left of the screen (1024x768)
this.X = 2;
this.Y = 768;
var move;

//by increasing or decreasing "i" the pop-up window movement speed increase or decrease
for (var i = 0; i<=this.Height; i = i+2)
{
  Sleep(1);
  move = 768 - i;
  this.Y = move;
}

//wait some time before window scrolls down and disappear
Sleep(3000);

for (var j = 0; j<=this.Height; j = j+2)
{
  Sleep(1);
  move = (Scene.Height - this.Height) + j;
  this.Y = move;
}

Now i'm facing another problem...if player click on the window...he can drag and drop it, and obviously i don't want it to be...
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Pop-up window
« Reply #4 on: December 27, 2011, 05:33:03 PM »

Just a note, avoid too short periods when calling Sleep. That way the speed of your fading effect will be dependent on the framerate of your game. Use at least 20 milliseconds (consider for example 60 frames per second, that would mean one frame takes 16.6 milliseconds to draw (1000 / 60), sleep will never be shorter than the frame time).

Now i'm facing another problem...if player click on the window...he can drag and drop it, and obviously i don't want it to be...
Just set window's "Transparent" property to true in WindowEdit. That way it will ignore mouse clicks completely.
« Last Edit: December 27, 2011, 05:36:21 PM by Mnemonic »
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Ennio

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 40
    • View Profile
Re: Pop-up window
« Reply #5 on: December 27, 2011, 05:55:54 PM »

Just a note, avoid too short periods when calling Sleep....Use at least 20 milliseconds

Precious advise, thank you!

Just set window's "Transparent" property to true in WindowEdit. That way it will ignore mouse clicks completely.

Great! :)
Logged
 

Page created in 0.056 seconds with 20 queries.