Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Jedi SDL - how to start?

  1. #1

    Jedi SDL - how to start?

    Hi all. I'm wanna make my game. I know basics of Omega components but they are not supported for Linux. So I trying to start with SDL library. And I have a "little" problem. If found THIS tutorial, but I don't have ANY basics for C. I have a friends who programme in this language but it's stupid ask for everything friends. Maybe someone know where I can find any tutorials, arts or other helping things to start learn SDL? And I'm sorry for my weak english :/ Thanks anyway...

  2. #2

    Jedi SDL - how to start?

    What sort of game are you thinking of writing?

    2D or 3D?

    Both will use SDL to create the main window, but 3D uses OpenGL from that point on.

    2D with SDL is really easy once you've got the hang of it. I'm sure there are many tutorials available. The good news is that the C examples can be very useful for showing you the calls you need to make. The techniques are interchangable.

    In the JEDI-SDL package, there are lots of examples which show you how SDL can be used. They cover Initialising the subsystems, graphics, input, sound, music.. amongst others.

    It won't take long to get into it.

    At the moment everything I do uses SDL.. but I created wrapper classes long ago to hide away all of the low level calls.

    I was going to do a SDL tutorial a long time ago, but I never got around to it.

  3. #3

    Jedi SDL - how to start?

    Have a look in our articles section ( http://www.pascalgamedevelopment.com/articles.php ) and look at the article by WILL which is an introduction to using JEDI-SDL. You may also want to have a look at http://jedi-sdl.pascalgamedevelopment.com for documentation, though this is included in the latest release found on that page.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  4. #4

    Jedi SDL - how to start?

    Quote Originally Posted by jasonf
    Both will use SDL to create the main window, but 3D uses OpenGL from that point on.
    I know, I know. I wanna make game with 2D graphic and possible 3D addons like explosions or fire. I'ill read documenation and examples. Thanks again guys.

  5. #5
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Jedi SDL - how to start?

    Well the good news is that 2D is super easy with OpenGL. Plus it'll take full advantage of your 3D hardware. And later mixing 3D and 2D would be a breeze.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  6. #6

    Jedi SDL - how to start?

    Hi again guys. In this time I know basics of using SDL, SDL_Image and SDL_TFF. But it's still only basics. So I have some questions to you:
    :arrow: I know how to draw image, set it position. But how can I set an transparent color for image? You know, I mean when I have for eg. #ff00ff background color I want to set this color as Alpha.
    :arrow: In Lazarus, Delphi we put Timer and we can timing. In Omega we have an OmegaTimer. But how can I set timer in JEDI-SDL?
    :arrow: And more, but not everything suddenly

    Thanks for any responds.

    And I again sorry for my weak English, tell me where I make mistakes, I will try to don't do it in future...

  7. #7

    Jedi SDL - how to start?

    Quote Originally Posted by Loodziek
    Hi again guys. In this time I know basics of using SDL, SDL_Image and SDL_TFF. But it's still only basics. So I have some questions to you:
    :arrow: I know how to draw image, set it position. But how can I set an transparent color for image? You know, I mean when I have for eg. #ff00ff background color I want to set this color as Alpha.
    :arrow: In Lazarus, Delphi we put Timer and we can timing. In Omega we have an OmegaTimer. But how can I set timer in JEDI-SDL?
    :arrow: And more, but not everything suddenly

    Thanks for any responds.

    And I again sorry for my weak English, tell me where I make mistakes, I will try to don't do it in future...
    *1- [pascal]
    SDL_SetColorKey(surface, // surface is the surface that want to set a transparent color
    SDL_RLEACCEL or SDL_SRCCOLORKEY,
    SDL_MapRGB(surface.format, r, g, b)); // this color will be transparent[/pascal]


    *2-
    I don't know i use a few lines of code and a SDL_delay to do it, but in (VRY SLOW) pcs the game will run at diferent speed ;/


    sorry me weak english too ;p
    im from brazil and you ?
    From brazil (:

    Pascal pownz!

  8. #8
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Jedi SDL - how to start?

    Hey Loodziek, glad to hear you're progressing with SDL.

    Quote Originally Posted by Loodziek
    :arrow: I know how to draw image, set it position. But how can I set an transparent color for image? You know, I mean when I have for eg. #ff00ff background color I want to set this color as Alpha.
    Ah, this one is quite easy, you just have to set the transparent color for the surface you wish to draw, as arthurprs says.

    Here is a ]SDL_SetColorKey function[/url]. The notation assumes you are using a C-type language, but it's the same thing in all other languages.

    Quote Originally Posted by Loodziek
    :arrow: In Lazarus, Delphi we put Timer and we can timing. In Omega we have an OmegaTimer. But how can I set timer in JEDI-SDL?
    There are 2 ways you can create your game.

    :arrow: Threaded -- using a triggered event for your main code-block and others for drawing, networking, etc... Not the easiest way to do it at the beginning.

    :arrow: Non-threaded -- using a simple 'main loop' where you'll only exit this loop when the game is done or you wish to close it.

    Both ways you should build a 'game mode/state' system into your game code so that it will become easier to change from different areas within your game. ie. Game Menu, in-game action, paused game, credits screen, level loading, initial startup, etc...

    Quote Originally Posted by Loodziek
    :arrow: And more, but not everything suddenly
    Feel free to ask! SDL is great as it handles so much. It's pretty much the only other library besides DirectX to support all the features you'd want in your game from music to graphics to input controls and so on.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #9

    Jedi SDL - how to start?

    Hi Loodziek

    Issue one of the Delphi Gamer magazine has a Tutorial on S2DL which is a simple wrapper library for SDL. You can get the library at

    http://www.cairnsgames.co.za/files/s2dl.zip

    the magazine is available at

    http://mag.delphigamer.com

    Hope this helps

    Dean
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  10. #10

    Jedi SDL - how to start?

    @technomage
    Yep, I read this issue when it's only appear, but I want test pure SDL power But thanks for respond.

    @arthurprs
    Am from Poland, Arthur. I have a question. When I try to compile your source:
    [pascal]SDL_SetColorKey(surface, // surface is the surface that want to set a transparent color
    SDL_RLEACCEL or SDL_SRCCOLORKEY,
    SDL_MapRGB(surface.format, r, g, b)); // this color will be transparent[/pascal]

    It's ok when I compile it in Delphi 7, but when I try to compile it in Lazarus it's isn't works:

    Error image

    What's going on?

    @WILL
    I'ill try

    Thanks a lot again.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •