SDL_Flip and SDL_Delay freaking me out

now beofre prople start telling me how poor my programming practises are i just
want to know why this might be happeneing.

if in my code looks like this

SDL_Delay(30);

SDL_Flip(screen);

it runs

if it looks like this

SDL_Flip(screen);

SDL_Delay(30);

it crashes

yes i still am having issues as to how to tun my main redraw loop, but this is
really fonzing me out.

If your code is correct, your problem is likely elsewhere. Can you
post a minimal example which demonstrates the same? If not, can you
email your code (cut down as much as possible).On 21/11/2007, neil at cloudsprinter.com wrote:

now beofre prople start telling me how poor my programming practises are i just
want to know why this might be happeneing.

if in my code looks like this

SDL_Delay(30);

SDL_Flip(screen);

it runs

if it looks like this

SDL_Flip(screen);

SDL_Delay(30);

it crashes

yes i still am having issues as to how to tun my main redraw loop, but this is
really fonzing me out.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

this is the main loop bit… all i’m really wondering is if there may be
something somewhere else i am doing that could affect this

i dont even know why i am using this loop update interval whotsit, i am
probably
using it wrong anyway

perhaps i shall remove all this frame reat nopnsence and go back to my very
basic loop thing.

void runeztris() {
static double lastFrameTime = 0.0;
static double cyclesLeftOver = 0.0;
double currentTime;
double updateIterations;
int k,j;

// bits[1].surface=cir_png;
j=0;k=0;
currentTime = SDL_GetTicks();
updateIterations = ((currentTime - lastFrameTime) + cyclesLeftOver);

if ( updateIterations > ( MAX_CYCLES_PER_FRAME * UPDATE_INTERVAL ) ) {
updateIterations = ( MAX_CYCLES_PER_FRAME * UPDATE_INTERVAL );
}

while (updateIterations > UPDATE_INTERVAL) {
updateIterations -= UPDATE_INTERVAL;

checkeztriskeys();

eztrisdropping();
checkitbro();
checknclear();
ploteztris();
}

SDL_Delay(30);

SDL_Flip(screen);

// updateGame(); /* Update game state a variable number of times */

//drawScene(); /* Draw the scene only once */
}

Quoting Brian <brian.ripoff at gmail.com>:> If your code is correct, your problem is likely elsewhere. Can you

post a minimal example which demonstrates the same? If not, can you
email your code (cut down as much as possible).

On 21/11/2007, neil at cloudsprinter.com wrote:

now beofre prople start telling me how poor my programming practises
are i just
want to know why this might be happeneing.

if in my code looks like this

SDL_Delay(30);

SDL_Flip(screen);

it runs

if it looks like this

SDL_Flip(screen);

SDL_Delay(30);

it crashes

yes i still am having issues as to how to tun my main redraw loop,
but this is
really fonzing me out.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

e-mail provided by Moose Internet Services
http://www.moose.co.uk/

Hey,

When a small, obviously insignificant change fixes/causes a crash in my programs, I know that there is a problem somewhere else. For me, this has always been from dereferencing a bad pointer or overrunning an array.

Jonny D> Date: Wed, 21 Nov 2007 11:57:32 +0000> From: neil at cloudsprinter.com> To: sdl at lists.libsdl.org> Subject: [SDL] SDL_Flip and SDL_Delay freaking me out> > > now beofre prople start telling me how poor my programming practises are i just> want to know why this might be happeneing.> > if in my code looks like this> > > SDL_Delay(30);> > SDL_Flip(screen);> > > it runs> > if it looks like this> > SDL_Flip(screen);> > SDL_Delay(30);> > it crashes> > yes i still am having issues as to how to tun my main redraw loop, but this is> really fonzing me out.> > _______________________________________________> SDL mailing list> SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Put your friends on the big screen with Windows Vista? + Windows Live?.
http://www.microsoft.com/windows/shop/specialoffers.mspx?ocid=TXT_TAGLM_CPC_MediaCtr_bigscreen_102007

I second that observation (:

Must be some kinda memory corruption_____

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Jonathan Dearborn
Sent: Wednesday, November 21, 2007 6:13 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out

Hey,

When a small, obviously insignificant change fixes/causes a crash in my
programs, I know that there is a problem somewhere else. For me, this has
always been from dereferencing a bad pointer or overrunning an array.

Jonny D


Date: Wed, 21 Nov 2007 11:57:32 +0000
From: neil at cloudsprinter.com
To: sdl at lists.libsdl.org
Subject: [SDL] SDL_Flip and SDL_Delay freaking me out

now beofre prople start telling me how poor my programming practises are i
just
want to know why this might be happeneing.

if in my code looks like this

SDL_Delay(30);

SDL_Flip(screen);

it runs

if it looks like this

SDL_Flip(screen);

SDL_Delay(30);

it crashes

yes i still am having issues as to how to tun my main redraw loop, but
this is
really fonzing me out.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Get the power of Windows + Web with the new Windows Live. Power up!
http://www.windowslive.com?ocid=TXT_TAGLM_Wave2_powerofwindows_112007

yea, i wiped out all that frame count crap i didnt know how i was using
wrongly
and it still occurs, i’ll have a good plod through the other functions
and hope
i can find the blaringly large error stood right infront of me slapping me in
the face with barge pole :wink:

i havnt really prgrammed a game this big before and now its getting to
the stage
where i just dont know what the fonze is going on anymore, but the code still
has a realtivley high sanity level, only i keep getting distaracted by
different bits that need doing, then not doing anything for a week, the coming
back and wondering just who the fonze wrote the code :wink:

Quoting Alan Wolfe :> I second that observation (:

Must be some kinda memory corruption


From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Jonathan Dearborn
Sent: Wednesday, November 21, 2007 6:13 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out

Hey,

When a small, obviously insignificant change fixes/causes a crash in my
programs, I know that there is a problem somewhere else. For me, this has
always been from dereferencing a bad pointer or overrunning an array.

Jonny D

Gratz on finding the corruption! (: (:

Those kinds of bugs can be such a “Fonzin” pain haha> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of neil at cloudsprinter.com
Sent: Thursday, November 22, 2007 10:51 AM
To: sdl at lists.libsdl.org
Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out

yea, i wiped out all that frame count crap i didnt know how i was using
wrongly
and it still occurs, i’ll have a good plod through the other functions
and hope
i can find the blaringly large error stood right infront of me slapping me
in
the face with barge pole :wink:

i havnt really prgrammed a game this big before and now its getting to
the stage
where i just dont know what the fonze is going on anymore, but the code
still
has a realtivley high sanity level, only i keep getting distaracted by
different bits that need doing, then not doing anything for a week, the
coming
back and wondering just who the fonze wrote the code :wink:

Quoting Alan Wolfe :

I second that observation (:

Must be some kinda memory corruption


From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On
Behalf Of Jonathan Dearborn
Sent: Wednesday, November 21, 2007 6:13 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out

Hey,

When a small, obviously insignificant change fixes/causes a crash in my
programs, I know that there is a problem somewhere else. For me, this has
always been from dereferencing a bad pointer or overrunning an array.

Jonny D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

you missread my random ramblings… i dint find or look any deeper for any
rpoblems yet… :frowning:

i’m guessing its an array overflow or something, seems to be my favorite hoppy
overloading arrays, i’ve been programming C for i dont know how many years and
i only just figured out a define of 5 means only 0-4 :wink:

also there is alot of piinters being thrown around so it could be one
of them, i
still dont know what defintley causes a memory leak and what definatley plugs
it…

i guess when i’m old and grey i might actually know what the fonze is going on
with C makefiles and SDL, and i can write a book for the rest of us.

p.s. UP THE FONZE! it’s the politically correct way of saying what you really
want! ( i keep trying to get some of my radio dj buddies to use it on air, but
as yet i have yet to hear them :wink: ) - one of my life missions, get everybody
’what the fonze’ ing

Quoting Alan Wolfe :> Gratz on finding the corruption! (: (:

Those kinds of bugs can be such a “Fonzin” pain haha

-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of neil at cloudsprinter.com
Sent: Thursday, November 22, 2007 10:51 AM
To: sdl at lists.libsdl.org
Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out

yea, i wiped out all that frame count crap i didnt know how i was using
wrongly
and it still occurs, i’ll have a good plod through the other functions
and hope
i can find the blaringly large error stood right infront of me slapping me
in
the face with barge pole :wink:

i havnt really prgrammed a game this big before and now its getting to
the stage
where i just dont know what the fonze is going on anymore, but the code
still
has a realtivley high sanity level, only i keep getting distaracted by
different bits that need doing, then not doing anything for a week, the
coming
back and wondering just who the fonze wrote the code :wink:

Quoting Alan Wolfe :

I second that observation (:

Must be some kinda memory corruption


From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On
Behalf Of Jonathan Dearborn
Sent: Wednesday, November 21, 2007 6:13 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out

Hey,

When a small, obviously insignificant change fixes/causes a crash in my
programs, I know that there is a problem somewhere else. For me, this has
always been from dereferencing a bad pointer or overrunning an array.

Jonny D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

e-mail provided by Moose Internet Services
http://www.moose.co.uk/

Have you considered a ‘safer’ programming language? Python is a
language with bindings to SDL through the pygame library. If you
accidentally go out of bounds on an array the interpreter will tell
you. C and C++ are very unforgiving languages.> i’m guessing its an array overflow or something, seems to be my favorite hoppy

overloading arrays, i’ve been programming C for i dont know how many years and
i only just figured out a define of 5 means only 0-4 :wink:

also there is alot of piinters being thrown around so it could be one
of them, i
still dont know what defintley causes a memory leak and what definatley plugs
it…
i guess when i’m old and grey i might actually know what the fonze is going on
with C makefiles and SDL, and i can write a book for the rest of us.

i like the pain!

anyway i’m going for a girlee language for people that cant really program by
learning flash action script 3 :wink: out of the window goes my years of trying to
keep my programs tight and worrying about exploding code! i’m a flash
developer
now! it’s designed to explode! and its the end users fault when it dosnt work!

Quoting Brian <brian.ripoff at gmail.com>:> Have you considered a ‘safer’ programming language? Python is a

language with bindings to SDL through the pygame library. If you
accidentally go out of bounds on an array the interpreter will tell
you. C and C++ are very unforgiving languages.

i’m guessing its an array overflow or something, seems to be my
favorite hoppy
overloading arrays, i’ve been programming C for i dont know how many
years and
i only just figured out a define of 5 means only 0-4 :wink:

also there is alot of piinters being thrown around so it could be one
of them, i
still dont know what defintley causes a memory leak and what
definatley plugs
it…
i guess when i’m old and grey i might actually know what the fonze
is going on
with C makefiles and SDL, and i can write a book for the rest of us.

“i like the pain!”

Hehe…being a good game coder takes blood sweat and tears. It really
sounds like you have the right attitude and aren’t afraid to put some elbow
grease into becoming better.

These kinds of problems shouldn’t be seen as failures; you are in fact
smarter now and will be less likely to make the same mistake in the future.
When you come across this problem again, you’ll know what the problem is and
be able to fix it more easily. IE congrats you just leveled up! (;

Keep at it, you can do it! (:

–Encouragement from a self taught game programmer like you, who now does it
professionally.> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of neil at cloudsprinter.com
Sent: Thursday, November 22, 2007 2:54 PM
To: sdl at lists.libsdl.org
Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out

i like the pain!

anyway i’m going for a girlee language for people that cant really program
by
learning flash action script 3 :wink: out of the window goes my years of trying
to
keep my programs tight and worrying about exploding code! i’m a flash
developer
now! it’s designed to explode! and its the end users fault when it dosnt
work!

Quoting Brian <brian.ripoff at gmail.com>:

Have you considered a ‘safer’ programming language? Python is a
language with bindings to SDL through the pygame library. If you
accidentally go out of bounds on an array the interpreter will tell
you. C and C++ are very unforgiving languages.

i’m guessing its an array overflow or something, seems to be my
favorite hoppy
overloading arrays, i’ve been programming C for i dont know how many
years and
i only just figured out a define of 5 means only 0-4 :wink:

also there is alot of piinters being thrown around so it could be one
of them, i
still dont know what defintley causes a memory leak and what
definatley plugs
it…
i guess when i’m old and grey i might actually know what the fonze
is going on
with C makefiles and SDL, and i can write a book for the rest of us.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi,
Memory corruption errors in C/C++ are not an issue when developing
on linux. Have you considered using valgrind to run your program?
Valgrind only runs on linux. If you are working on windows it can be
somewhat uncomfortable to set and install a linux just for that, but it
pays in the long run when you add up all the time you save fixing this
kind of things.

Facundo

sdl-request at lists.libsdl.org escribi?:> Message: 1

Date: Thu, 22 Nov 2007 18:51:28 +0000
From: neil at cloudsprinter.com
Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out
To: sdl at lists.libsdl.org
Message-ID:
<20071122185128.jizhpjdnms4kssw4 at webmail.cloudsprinter.com>
Content-Type: text/plain; charset=ISO-8859-1; format=“flowed”

yea, i wiped out all that frame count crap i didnt know how i was using
wrongly
and it still occurs, i’ll have a good plod through the other functions
and hope
i can find the blaringly large error stood right infront of me slapping me in
the face with barge pole :wink:

i havnt really prgrammed a game this big before and now its getting to
the stage
where i just dont know what the fonze is going on anymore, but the code still
has a realtivley high sanity level, only i keep getting distaracted by
different bits that need doing, then not doing anything for a week, the coming
back and wondering just who the fonze wrote the code :wink:

Hey,

I don’t know anything about Valgrind, but it’s probably similar to the “Fortify” program mentioned a while ago (http://www.geocities.com/SiliconValley/Horizon/8596/fortify.html). I’ve tried Fortify and it found a bunch of memory problems for me. There’s probably a better (newer) one out there that works for Windos. Anyone know?

Jonny D> Date: Thu, 22 Nov 2007 22:54:12 +0000> From: neil at cloudsprinter.com> To: sdl at lists.libsdl.org> Subject: Re: [SDL] SDL_Flip and SDL_Delay freaking me out> > > i like the pain!> > anyway i’m going for a girlee language for people that cant really program by> learning flash action script 3 :wink: out of the window goes my years of trying to> keep my programs tight and worrying about exploding code! i’m a flash> developer> now! it’s designed to explode! and its the end users fault when it dosnt work!> > Quoting Brian <brian.ripoff at gmail.com>:> > > Have you considered a ‘safer’ programming language? Python is a> > language with bindings to SDL through the pygame library. If you> > accidentally go out of bounds on an array the interpreter will tell> > you. C and C++ are very unforgiving languages.> >> >> i’m guessing its an array overflow or something, seems to be my> >> favorite hoppy> >> overloading arrays, i’ve been programming C for i dont know how many> >> years and> >> i only just figured out a define of 5 means only 0-4 ;)> >>> >> also there is alot of piinters being thrown around so it could be one> >> of them, i> >> still dont know what defintley causes a memory leak and what> >> definatley plugs> >> it…> >> i guess when i’m old and grey i might actually know what the fonze> >> is going on> >> with C makefiles and SDL, and i can write a book for the rest of us.> >> > _______________________________________________> SDL mailing list> SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Connect and share in new ways with Windows Live.
http://www.windowslive.com/connect.html?ocid=TXT_TAGLM_Wave2_newways_112007

well you know, all these program monitoring programs are great if you have a
clue what the output is all about and then what to do about it :wink: i just like
making games… afaict most behave relativley well as far as not exploding the
OS, and heck its only a silly game, you almost expect silly games to crash the
system :wink: ( awaits rants about writing non exploding code ) infact if a
silly game didnt cause me to have to reset the machine every once in a while
i’d have to wonder what it was really up to :wink:

Quoting Jonathan Dearborn :> Hey,

I don’t know anything about Valgrind, but it’s probably similar to
the “Fortify” program mentioned a while ago
(http://www.geocities.com/SiliconValley/Horizon/8596/fortify.html).
I’ve tried Fortify and it found a bunch of memory problems for me.
There’s probably a better (newer) one out there that works for
Windos. Anyone know?

Jonny D

Date: Thu, 22 Nov 2007 22:54:12 +0000> From: neil at cloudsprinter.com>
To: sdl at lists.libsdl.org> Subject: Re: [SDL] SDL_Flip and SDL_Delay
freaking me out> > > i like the pain!> > anyway i’m going for a
girlee language for people that cant really program by> learning
flash action script 3 :wink: out of the window goes my years of trying
to> keep my programs tight and worrying about exploding code! i’m a
flash> developer> now! it’s designed to explode! and its the end
users fault when it dosnt work!> > Quoting Brian
<brian.ripoff at gmail.com>:> > > Have you considered a 'safer’
programming language? Python is a> > language with bindings to SDL
through the pygame library. If you> > accidentally go out of bounds
on an array the interpreter will tell> > you. C and C++ are very
unforgiving languages.> >> >> i’m guessing its an array overflow or
something, seems to be my> >> favorite hoppy> >> overloading arrays,
i’ve been programming C for i dont know how many> >> years and> >> i
only just figured out a define of 5 means only 0-4 ;)> >>> >> also
there is alot of piinters being thrown around so it could be one> >>
of them, i> >> still dont know what defintley causes a memory leak
and what> >> definatley plugs> >> it…> >> i guess when i’m old and
grey i might actually know what the fonze> >> is going on> >> with C
makefiles and SDL, and i can write a book for the rest of us.> >> >
_______________________________________________> SDL mailing list>
SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Connect and share in new ways with Windows Live.
http://www.windowslive.com/connect.html?ocid=TXT_TAGLM_Wave2_newways_112007
e-mail provided by Moose Internet Services
http://www.moose.co.uk/