PDA

View Full Version : Starting with SDL



CheGueVerra
11-01-2008, 03:50 AM
Hi guys,

I've just started to look around, reading articles and past posts.
I've decided to start working with the JEDI-SDL and I'm currently
looking at the demos that come with the lib.

I'm going to fiddle with the Shooting demo to understand the basics
of the lib.

If you have any suggestions or links that can help me it will be cool



CheGueVerra

arthurprs
11-01-2008, 04:20 AM
http://userpage.fu-berlin.de/~molski/fpsdl/
:)

CheGueVerra
11-01-2008, 06:46 PM
Thanks, for the link, the Shooting demo that is in the SpriteEngine demo
folder, uses each element of the Chapters of that link, that helped me to
understand more the lib.

I noticed though that all the classes were cluttered together, so my first task,
will be some refactoring, so it will be easier to modify behavior and add
features. I'm not sure that a manager for all Sprites in the Sprite engine is a
good idea .. has anyone followed that path before?

When I work I try to have the least global vars as possible, I noticed that
most exemples do the opposite, is this a standard in game programming,
because my refactoring mind will go crazy accepting those pratices...

:evil:

CheGueVerra

arthurprs
11-01-2008, 08:54 PM
Global vars can not be avoided in games, at least in my point of view

pstudio
11-01-2008, 10:44 PM
I would say it depends on the programmer and how he decides to construct the game. A well structured game (according to OOPD) can be made without global vars, but sometimes it may just be easier to make a variable global.

About the examples, I have the impression that they were made quick (thereby not caring to much about OOPD) to demonstrate SDL and not to demonstrate how you would program a well designed game.

CheGueVerra
11-01-2008, 11:10 PM
Thanks for your answers,

I was wondering if I was attacking this in the right mind set, the last post
gives me the confirmation that I wanted.

I know that in the everyday, boring, Application development, in a rare case
I might use global vars, but I try to restrain from doing so.


Once I refactored it, without any new additions, but just better OOPD
can I post the code here somewhere to get the advice of the game gurus that
are members of this site?

CheGueVerra

CheGueVerra
12-01-2008, 06:59 PM
Well, I have finished refactoring the Shooting demo,

It was good way for me to learn how all the pieces go together. (In that demo)

I'm going to start plying with it and see, how easy it is to add features and
such.

Anyone have some tips on how to create a scoreboard on the screen?

I would appreciate if anyone would look at the refactorred code.

For comments, code review, or share good pratice.

CheGueVerra

CheGueVerra
13-01-2008, 06:53 AM
Well, where I stand currently:

I've got the scoreboard in there but for now I'm using the
TTF_RenderText_Shaded method, which is ok for the demo I created
but would like to get a better look and feel on it, suggestions?

Other than that, the next item on my list is the user starting with 3 planes,
which means preparing the battlefield for reentry and such. I would like to
add this on the scoreboard in something of the sorts
Which would take the a spaced reserved a the bottom of the screen.

StandardText + UserScore + OffSet Space(Dynamic) + [SpritePlayerLife]*n

I'm also going to start working on some silly story line...

I've been using GraphicGale to explore the editing of the images for the sprites
BTW, I just colored a copy of the original plane to be a laser firing enemy
and reversed, the original laser image work.

The hardest part for me will be the time consumed by my little graphic talents...

I'm having fun, changes from reading all those Medicals libs and APIs.

CheGueVerra

CheGueVerra
13-01-2008, 01:08 PM
Well the scoreboard looks the way I wanted it to, So i'm pretty happy about that.

The reentry, simple, but effective, I guess.

Still haven't started the story line, but I have a couple of ideas of game play I want to try first.

Going to bed, it's been a long time since developing kept me awake all night.

CheGueVerra

yassersoft
17-11-2009, 08:49 PM
How I get a pixel color with SDL?. Like GetColor() C function

Stoney
18-11-2009, 10:34 PM
How I get a pixel color with SDL?. Like GetColor() C function


Take a look at function SDL_GetPixel( SrcSurface : PSDL_Surface; x : integer; y : integer ) : Uint32; from SDLUtils.pas (shipped with JEDI-SDL).

circular
02-04-2011, 09:37 PM
New link : http://www.freepascal-meets-sdl.net/