how can i know if a SDL window has been minimized???
i wanna pause my game if this condition = true
tks
see ya!
how can i know if a SDL window has been minimized???
i wanna pause my game if this condition = true
tks
see ya!
Try SDL_GetAppState()
http://sdldoc.csn.ul.ie/sdlgetappstate.php
~ Phil Thoren
Ricardo Ferrari (SPO-LAB) wrote:> how can i know if a SDL window has been minimized???
i wanna pause my game if this condition = true
tks
see ya!
E3-I: This message has been scanned for viruses and dangerous content
by UML’s antivirus scanning services.
Might I humbly suggest that you pause only if condition == true ? :)> ----- Original Message -----
From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org] On Behalf Of
Ricardo Ferrari (SPO-LAB)
Sent: Monday, September 15, 2003 12:00 PM
To: sdl at libsdl.org
Subject: [SDL] Minimizehow can i know if a SDL window has been minimized???
i wanna pause my game if this condition = true
tks
see ya!
Messagelol, i think he realizes that and just needs to know if theres an event or something when your window is minimized.
if i knew the answer to this question i could help you but i dont, sorry!----- Original Message -----
From: Jesse Patterson
To: sdl at libsdl.org
Sent: Monday, September 15, 2003 12:46 PM
Subject: RE: [SDL] Minimize
Might I humbly suggest that you pause only if condition == true ?
-----Original Message-----
From: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org] On Behalf Of Ricardo Ferrari (SPO-LAB)
Sent: Monday, September 15, 2003 12:00 PM
To: sdl at libsdl.org
Subject: [SDL] Minimize
how can i know if a SDL window has been minimized????
i wanna pause my game if this condition = true
tks
see ya!
The code for handling the event would be something like
switch(event.type)
{
case SDL_ACTIVEEVENT:
if (event.active.state == SDL_APPACTIVE)
{
minimized = event.active.gain;
}
}
The event mask is : SDL_ACTIVEEVENTMASK
In other code (SDL_GetAppState() & SDL_APPACTIVE) would be true if the
window is visible. Or so I would assume.
~ Phil Thoren
Atrix Wolfe wrote:> lol, i think he realizes that and just needs to know if theres an
event or something when your window is minimized.
if i knew the answer to this question i could help you but i dont, sorry!
----- Original Message ----- *From:* Jesse Patterson <mailto:sdl at realmsoflegend.net> *To:* sdl at libsdl.org <mailto:sdl at libsdl.org> *Sent:* Monday, September 15, 2003 12:46 PM *Subject:* RE: [SDL] Minimize Might I humbly suggest that you pause only if /*condition == true*/ ? :) -----Original Message----- *From:* sdl-admin at libsdl.org <mailto:sdl-admin at libsdl.org> [mailto:sdl-admin at libsdl.org] *On Behalf Of *Ricardo Ferrari (SPO-LAB) *Sent:* Monday, September 15, 2003 12:00 PM *To:* sdl at libsdl.org <mailto:sdl at libsdl.org> *Subject:* [SDL] Minimize how can i know if a SDL window has been minimized???? i wanna pause my game if this condition = true tks see ya!
E3-I: This message has been scanned for viruses and dangerous content
by UML’s antivirus scanning services.
Sorry( I’m gonna get flamed for the excessive noise I’ve been making )
minimized = (event.active.gain == 0) ? 1 : 0;
This is in the documentation/header files. When event.active.gain == 1,
the screen has been restored and is visible(!minimized).
~ Phil Thoren
Philip D.S. Thoren wrote:> The code for handling the event would be something like
switch(event.type)
{
case SDL_ACTIVEEVENT:
if (event.active.state == SDL_APPACTIVE)
{
minimized = event.active.gain;
} }
The event mask is : SDL_ACTIVEEVENTMASKIn other code (SDL_GetAppState() & SDL_APPACTIVE) would be true if the
window is visible. Or so I would assume.~ Phil Thoren
Atrix Wolfe wrote:
lol, i think he realizes that and just needs to know if theres an
event or something when your window is minimized.if i knew the answer to this question i could help you but i dont,
sorry!----- Original Message ----- *From:* Jesse Patterson <mailto:sdl at realmsoflegend.net> *To:* sdl at libsdl.org <mailto:sdl at libsdl.org> *Sent:* Monday, September 15, 2003 12:46 PM *Subject:* RE: [SDL] Minimize Might I humbly suggest that you pause only if /*condition == true*/ ? :) -----Original Message----- *From:* sdl-admin at libsdl.org <mailto:sdl-admin at libsdl.org> [mailto:sdl-admin at libsdl.org] *On Behalf Of *Ricardo Ferrari (SPO-LAB) *Sent:* Monday, September 15, 2003 12:00 PM *To:* sdl at libsdl.org <mailto:sdl at libsdl.org> *Subject:* [SDL] Minimize how can i know if a SDL window has been minimized???? i wanna pause my game if this condition = true tks see ya!
E3-I: This message has been scanned for viruses and dangerous content
by UML’s antivirus scanning services.
#minimized = (event.active.gain == 0) ? 1 : 0;
Shouldn’t
minimized = event.active.gain;
be sufficient? Since (int)true==1 and (int)false==0…
/Olof#
#This is in the documentation/header files. When event.active.gain == 1,
#the screen has been restored and is visible(!minimized).
#~ Phil Thoren
#Philip D.S. Thoren wrote:
#> The code for handling the event would be something like
#>
#> switch(event.type)
#> {
#> case SDL_ACTIVEEVENT:
#> if (event.active.state == SDL_APPACTIVE)
#> {
#> minimized = event.active.gain;
#> } }
#> The event mask is : SDL_ACTIVEEVENTMASK
#>
#> In other code (SDL_GetAppState() & SDL_APPACTIVE) would be true if the
#> window is visible. Or so I would assume.
#>
#> ~ Phil Thoren
#>
#> Atrix Wolfe wrote:
#>
#>> lol, i think he realizes that and just needs to know if theres an
#>> event or something when your window is minimized.
#>>
#>> if i knew the answer to this question i could help you but i dont,
#>> sorry!
#>>
#>>
#>> ----- Original Message -----
#>> From: Jesse Patterson <mailto:sdl at realmsoflegend.net>
#>> To: sdl at libsdl.org <mailto:sdl at libsdl.org>
#>> Sent: Monday, September 15, 2003 12:46 PM
#>> Subject: RE: [SDL] Minimize
#>>
#>> Might I humbly suggest that you pause only if /condition ==
#>> true/ ?
#>>
#>> -----Original Message-----
#>> From: sdl-admin at libsdl.org <mailto:sdl-admin at libsdl.org>
#>> [mailto:sdl-admin at libsdl.org] *On Behalf Of *Ricardo Ferrari
#>> (SPO-LAB)
#>> Sent: Monday, September 15, 2003 12:00 PM
#>> To: sdl at libsdl.org <mailto:sdl at libsdl.org>
#>> Subject: [SDL] Minimize
#>>
#>> how can i know if a SDL window has been minimized???
#>>
#>> i wanna pause my game if this condition = true
#>>
#>>
#>> tks
#>>
#>> see ya!
#>>
#>> ------------------------------------------------------------------------
#>> E3-I: This message has been scanned for viruses and dangerous content
#>> by UML’s antivirus scanning services.
#>
#>
#>
#_______________________________________________
#SDL mailing list
#SDL at libsdl.org
#http://www.libsdl.org/mailman/listinfo/sdl
except its reversed… minimized is true when gain is false
maybe…
minimized = (event.active.gain == 0);
would be enough?
i dont know if that works on all systems though (ive heard rumors it
doesnt)…> ----- Original Message -----
From: objarni@dd.chalmers.se (Olof Bjarnason)
To:
Sent: Monday, September 15, 2003 1:42 PM
Subject: Re: [SDL] Minimize#minimized = (event.active.gain == 0) ? 1 : 0;
Shouldn’t
minimized = event.active.gain;
be sufficient? Since (int)true==1 and (int)false==0…
/Olof
#This is in the documentation/header files. When event.active.gain == 1,
#the screen has been restored and is visible(!minimized).#~ Phil Thoren
#Philip D.S. Thoren wrote:
#> The code for handling the event would be something like
#>
#> switch(event.type)
#> {
#> case SDL_ACTIVEEVENT:
#> if (event.active.state == SDL_APPACTIVE)
#> {
#> minimized = event.active.gain;
#> } }
#> The event mask is : SDL_ACTIVEEVENTMASK
#>
#> In other code (SDL_GetAppState() & SDL_APPACTIVE) would be true if the
#> window is visible. Or so I would assume.
#>
#> ~ Phil Thoren
#>
#> Atrix Wolfe wrote:
#>
#>> lol, i think he realizes that and just needs to know if theres an
#>> event or something when your window is minimized.
#>>
#>> if i knew the answer to this question i could help you but i dont,
#>> sorry!
#>>
#>>
#>> ----- Original Message -----
#>> From: Jesse Patterson <mailto:sdl at realmsoflegend.net>
#>> To: sdl at libsdl.org <mailto:sdl at libsdl.org>
#>> Sent: Monday, September 15, 2003 12:46 PM
#>> Subject: RE: [SDL] Minimize
#>>
#>> Might I humbly suggest that you pause only if /condition ==
#>> true/ ?
#>>
#>> -----Original Message-----
#>> From: sdl-admin at libsdl.org <mailto:sdl-admin at libsdl.org>
#>> [mailto:sdl-admin at libsdl.org] *On Behalf Of *Ricardo Ferrari
#>> (SPO-LAB)
#>> Sent: Monday, September 15, 2003 12:00 PM
#>> To: sdl at libsdl.org <mailto:sdl at libsdl.org>
#>> Subject: [SDL] Minimize
#>>
#>> how can i know if a SDL window has been minimized???
#>>
#>> i wanna pause my game if this condition = true
#>>
#>>
#>> tks
#>>
#>> see ya!
#>>#>> ------------------------------------------------------------------------
#>> E3-I: This message has been scanned for viruses and dangerous content
#>> by UML’s antivirus scanning services.
#>
#>
#>#_______________________________________________
#SDL mailing list
#SDL at libsdl.org
#http://www.libsdl.org/mailman/listinfo/sdl
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Jesse Patterson wrote:
Might I humbly suggest that you pause only if /condition == true/ ?
If he’s using SDL with Pascal (KYlix, FPC via JEDI-SDL) like myself then
he’s right
s
Adilson.
minimized = (event.active.gain == 0) ? 1 : 0;
No.
On X11, you lose that flag when leaving the window. On MacOSX, you lose
that flag when the window loses keyboard focus.
Neither represent whether the window is minimized.
–ryan.
minimized = (event.active.gain == 0) ? 1 : 0;
No.
On X11, you lose that flag when leaving the window. On MacOSX, you lose
that flag when the window loses keyboard focus.
Neither represent whether the window is minimized.
You have to check event.active.state for the mask of:
SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, SDL_APPACTIVE
to determine what focus was gained or lost.
In your case, you want to check SDL_APPACTIVE.
Take a look at testwm.c in the test subdirectory of the SDL source archive.
See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment