PDA

View Full Version : Problem of SDL_FLIP



arthurprs
12-07-2007, 02:08 AM
Declaration

_pic_bg : PSDL_Surface;
backbuffer: PSDL_Surface;



INIT

if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) then
begin
Close;
end;
backbuffer:= SDL_SetVideoMode(640,480,32,SDL_SWSURFACE);


Load the BMP
_pic_bomb := SDL_LoadBMP('resbmp/bomb1.bmp');


dst.x:=x*25;
dst.y:=y*25;
dst.h:= 25;
dst.w:= 25;
src.x:=0;
src.y:=0;
src.h:=25;
src.w:=25;
SDL_BlitSurface(_pic_bg,@src,backbuffer,@dst);
SDL_flip(backbuffer); // <<< ERROR HERE


I have a problem in the flip =/
what is the problem ?

paul_nicholls
12-07-2007, 04:02 AM
Have you checked to see if backbuffer is nil before using it?
Perhaps SDL_SetVideoMode is failing for some reason?
cheers
Paul

arthurprs
12-07-2007, 05:21 PM
Have you checked to see if backbuffer is nil before using it?
Perhaps SDL_SetVideoMode is failing for some reason?
cheers
Paul

Please explaim more, im new to SDL :oops:

tsr
12-07-2007, 06:49 PM
backbuffer:= SDL_SetVideoMode(640,480,32,SDL_SWSURFACE or SDL_DOUBLEBUF);
if backbuffer = nil then
begin
//something wrong
end;

I added there "or SDL_DOUBLEBUF" lets try it.

WILL
12-07-2007, 07:45 PM
A trick I used when I was first using JEDI-SDL --or any new API library-- was to look at working example source and compare it to mine and see what was different. Then just mimic what was done in the example and strip away stuff until you get an error or the specific result you're looking for.

Unfortunately noone has gone to the lengths of creating a basic functionality of JEDI-SDL tutorial so I have nothing to make reference to.

arthurprs
12-07-2007, 08:47 PM
A trick I used when I was first using JEDI-SDL --or any new API library-- was to look at working example source and compare it to mine and see what was different. Then just mimic what was done in the example and strip away stuff until you get an error or the specific result you're looking for.

Unfortunately noone has gone to the lengths of creating a basic functionality of JEDI-SDL tutorial so I have nothing to make reference to.

I read your tutorials and how you can see it appers to be right the code,
i will test what tsr write.

arthurprs
12-07-2007, 09:17 PM
backbuffer:= SDL_SetVideoMode(640,480,32,SDL_SWSURFACE or SDL_DOUBLEBUF);
if backbuffer = nil then
begin
//something wrong
end;

I added there "or SDL_DOUBLEBUF" lets try it.

Its missing the doublebuf =]

problem solved ;]

arthurprs
12-07-2007, 09:17 PM
How can i write some text to the screen ?

dont found anything in the demos =/

technomage
13-07-2007, 12:46 AM
you need to look in the JEDI-SDL v1.0 for libraries called SFont or SDLMonoFonts. There are demos on how to use these within the SFont/SDLMonoFont directories.

savage
13-07-2007, 02:26 AM
Or you can also use SDL_ttf if you would rather use True Type Fonts.

arthurprs
13-07-2007, 04:06 AM
Sfont / SDLMonoFont / SDL_ttf

:?

wich one use ?

WILL
13-07-2007, 05:20 AM
...oooor... you could instead use your own font sheet and use bitmap fonts. ;) More colorful!

In fact you don't get to do too much of that with TTF fonts. :p

I use this technique in some of my other games. The next part in my tutorial series will be using my FontsUnit.pas I use in all my games. (well, a simplier version anyway)

I'll send you a copy of my canceled 'Subject 33' game's source so you can have a look at it. It's fairly simple in concept so you can se how you could start your own if you need more features.

arthurprs
13-07-2007, 06:36 PM
...oooor... you could instead use your own font sheet and use bitmap fonts. ;) More colorful!

In fact you get to do much of that with TTF fonts. :p

I use this technique in some of my other games. The next part in my tutorial series will be using my FontsUnit.pas I use in all my games. (well, a simplier version anyway)

I'll send you a copy of my canceled 'Subject 33' game's source so you can have a look at it. It's fairly simple in concept so you can se how you could start your own if you need more features.

Fonts on SDL is complicated, i read some demo codes.....
thinking im go use TTF fonts but i can't run any demo =/
i have to put de .ttf file on same dif as the exe ?

tsr
13-07-2007, 07:42 PM
http://lazyfoo.net/SDL_tutorials/index.php
There are great tutorials about SDL. Samples in C++ but it is very very similar and I have no problems to write in Pascal.

arthurprs
14-07-2007, 01:42 AM
http://lazyfoo.net/SDL_tutorials/index.php
There are great tutorials about SDL. Samples in C++ but it is very very similar and I have no problems to write in Pascal.

I found something interesting (pixel check colision check), vry useful site ;]

tnx!

WILL
17-07-2007, 06:03 PM
Check your 'Messages' arthurprs. I sent you a PM about my source. It used to flash when you had a new message to alert you, but that was lost a few updates ago. We'll be putting it back when we get the chance. :)

arthurprs
17-07-2007, 08:30 PM
Check your 'Messages' arthurprs. I sent you a PM about my source. It used to flash when you had a new message to alert you, but that was lost a few updates ago. We'll be putting it back when we get the chance. :)

I have played and take a look at the code, simply awesome :shock:

you just write a large n¬? of functions to make your life easyer, constant units, :P i have never programmed something in that organization



*Just sorry my english :oops:

WILL
17-07-2007, 08:39 PM
Structure is everything. If it makes your coding easier in the long run, do it. ;)