List Info

Thread: RE: Problems with SDL_DisplayFormat returning nil




RE: Problems with SDL_DisplayFormat returning nil
country flaguser name
United Kingdom
2007-08-02 02:56:49

Hi Defre (Fred ?)

Unfortunately I hadn't setup the display with SDL_SetVideoMode as I
was testing the function in isolation :o( Once I setup the display my
function worked as expected. Thanks for also pointing out about the
memory leak scenario. I'll fix that one before it comes back to bite me.

Is there a test to see if the SDL Display has been setup so that I
could add an Assert or some other test in my code ?

Thanks for your help.

Ian


> Did you set up the display with SDL_SetVideoMode ?
> Anyway, be careful with " Surface := SDL_DisplayFormat (Surface) ;",
since
> the old surface won't be automatically freed: this will cause a
memory leak.

2007/8/1, Ian Munro < ian.munro%40grosvenortechnology.com">ian.munrogrosvenortechnology.com
<;mailto:ian.munro%40grosvenortechnology.com> >:
&gt;
> Hello,
&gt;
> I'm getting a strange problem and I'm hoping that someone can spot
where
> I'm going wrong. The following function loads an image file (bmp or
png)
> into a surface, sets it up ready to display and stores it in a list.
&gt;
> Everything works fine until the "Surface := SDL_DisplayFormat
(Surface)&quot;
> call. Before the call "Surface" points to something but after the call
>; it is returned as nil.

.

<http://geo.yahoo.com/serv?s=97359714/grpId=3077490/grpspId=1705006497/m
sgId=4251/stime=1185996447/nc1=4776369/nc2=4699084/nc3=4025304>


This email is intended solely for the person to whom it is addressed and may contain confidential or legally privileged information. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. Please notify the author by replying to this email and destroying all copies of the email and attachments. Access to this email by anyone else is unauthorised.

Email may be susceptible to data corruption, interception, unauthorised amendment, viruses and delays or the consequences thereof. Any views or opinions presented are solely those of the author and do not necessarily represent those of Grosvenor Technology Ltd.

Grosvenor Technology Ltd. (incorp. Newmark Technology Ltd.) is a company registered in England with company number 2412554.
The Grosvenor Technology Ltd. Registered Office address is Millars Three, Southmill Road, Bishop's Stortford, Herts, CM23

[Non-text portions of this message have been removed]

__._,_.___
SPONSORED LINKS
Drive Traffic

Sponsored Search

can help increase

your site traffic.

Yoga Groups

Find Enlightenment

&amp; exchange insights

with other members

Re: Problems with SDL_DisplayFormat returning nil
country flaguser name
United States
2007-08-02 05:40:29

Defre or Fred, as you want.

Maybe SDL_GetVideoSurface, which will return a pointer to the surface if
initialised or nil otherwise, will help you.

Fred

2007/8/2, Ian Munro < ian.munro%40grosvenortechnology.com">ian.munrogrosvenortechnology.com>:
>
&gt; Hi Defre (Fred ?)
>
> Unfortunately I hadn't setup the display with SDL_SetVideoMode as I
> was testing the function in isolation :o( Once I setup the display my
> function worked as expected. Thanks for also pointing out about the
> memory leak scenario. I'll fix that one before it comes back to bite me.
>
> Is there a test to see if the SDL Display has been setup so that I
> could add an Assert or some other test in my code ?
>
> Thanks for your help.
&gt;
> Ian
>
>
&gt; > Did you set up the display with SDL_SetVideoMode ?
> > Anyway, be careful with " Surface := SDL_DisplayFormat (Surface) ;",
> since
&gt; > the old surface won't be automatically freed: this will cause a
> memory leak.
&gt;
> 2007/8/1, Ian Munro < ian.munro%40grosvenortechnology.com">ian.munrogrosvenortechnology.com<ian.munro%40grosvenortechnology.com>
&gt; <mailto:ian.munro%40grosvenortechnology.com> >:
&gt; >
>; > Hello,
&gt; >
>; > I'm getting a strange problem and I'm hoping that someone can spot
>; where
&gt; > I'm going wrong. The following function loads an image file (bmp or
> png)
>; > into a surface, sets it up ready to display and stores it in a list.
&gt; >
>; > Everything works fine until the "Surface := SDL_DisplayFormat
&gt; (Surface)&quot;
>; > call. Before the call "Surface" points to something but after the call
>; > it is returned as nil.
>;
> .
>
> <http://geo.yahoo.com/serv?s=97359714/grpId=3077490/grpspId=1705006497/m
> sgId=4251/stime=1185996447/nc1=4776369/nc2=4699084/nc3=4025304>
>;
>
> This email is intended solely for the person to whom it is addressed and
> may contain confidential or legally privileged information. If you are not
> the intended recipient, be advised that you have received this email in
> error and that any use, dissemination, forwarding, printing or copying of
> this email is strictly prohibited. Please notify the author by replying to
> this email and destroying all copies of the email and attachments. Access to
> this email by anyone else is unauthorised.
>
> Email may be susceptible to data corruption, interception, unauthorised
> amendment, viruses and delays or the consequences thereof. Any views or
> opinions presented are solely those of the author and do not necessarily
> represent those of Grosvenor Technology Ltd.
>;
> Grosvenor Technology Ltd. (incorp. Newmark Technology Ltd.) is a company
> registered in England with company number 2412554.
> The Grosvenor Technology Ltd. Registered Office address is Millars Three,
&gt; Southmill Road, Bishop's Stortford, Herts, CM23
>;
> [Non-text portions of this message have been removed]
>
>;
>

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )