Last visit was: It is currently Thu Dec 05, 2024 12:00 pm


All times are UTC-05:00




Post new topic Reply to topic  [9 posts ] 
    Author Message
     Post subject:First attempt at an SDL game...
    PostPosted:Fri May 15, 2009 9:45 pm 
    User avatar
     

    Joined:Sun Feb 12, 2006 8:56 pm
    Posts:1019
    Website:http://eddieringle.com
    Location:Detroit, MI
    So I have finished my first real SDL game (it is my first real C/C++ app as well) and I am just going to post it here in hopes that I get some suggestions.

    I am planning on switching from SDL to OpenGL for rendering, and I want to know why the sound effect plays a bit too late. Other than that, I'm looking to others for suggestions.

    EDIT:
    The attached file is the OpenGL version, plus it has a few bugfixes. I removed the link to the old version.
    EDIT2:
    And another new version, this cuts off most of the fat due to the inclusion of unnecessary libraries. I also fixed the app config error in the Windows builds.
    EDIT3:
    Okay, _now_ that application configuration error is fixed. I blame Microsoft for distributing different versions of files.


    Attachments:
    pong-1.3.zip [1.12MiB]
    Downloaded 1250 times

    _________________
    -- Eddie Ringle

    Check out Elysian Shadows and consider backing us on Kickstarter!

    ====================================

    Image


    Last edited by eddieringle on Tue May 19, 2009 7:17 pm, edited 7 times in total.
    Top
    Offline  
     Post subject:Re: First attempt at an SDL game...
    PostPosted:Sat May 16, 2009 1:26 am 
    User avatar
     

    Joined:Mon Oct 13, 2008 8:40 am
    Posts:171
    AOL:VaiusArkollos
    Location:Nowhere
    The link isn't working.

    _________________
    Nothing is true; Everything is permitted.


    Top
    Offline  
     Post subject:Re: First attempt at an SDL game...
    PostPosted:Sat May 16, 2009 7:27 am 
    User avatar
     

    Joined:Sun Feb 12, 2006 8:56 pm
    Posts:1019
    Website:http://eddieringle.com
    Location:Detroit, MI
    Whoops, thanks for pointing it out. Fixed now.

    _________________
    -- Eddie Ringle

    Check out Elysian Shadows and consider backing us on Kickstarter!

    ====================================

    Image


    Top
    Offline  
     Post subject:Re: First attempt at an SDL game...
    PostPosted:Sat May 16, 2009 11:00 am 
    Literally Nine
    User avatar
     

    Joined:Sat Apr 02, 2005 3:31 pm
    Posts:1171
    Location:The vicinity of an area adjacent to a location.
    Quote:
    The source is included, as well as Windows and Linux builds:
    http://files.idlesoft.net/dl.php?f=pong.zip
    Your download script is buggy. It's calling it the MIME type "text/html", so I end up getting "pong.zip.html", which is fine, because I can just rename it to .zip, but I shouldn't have to.

    Also, what is this? No Makefile?

    _________________
    - Tycho

    Image


    Top
    Offline  
     Post subject:Re: First attempt at an SDL game...
    PostPosted:Sat May 16, 2009 11:49 am 
    Literally Nine
    User avatar
     

    Joined:Sat Apr 02, 2005 3:31 pm
    Posts:1171
    Location:The vicinity of an area adjacent to a location.
    Got it to compile on Mac OS X by downloading SDL, SDL_mixer, SDL_image, SDL_ttf, and some weird SDL_gfxPrimitives library, and then doing a hackish compile like this:
    Code:
    Alcarin:pong steven$ g++ -O2 -std=c++98 -Wall -Wunused -Wundef -pedantic -fno-strict-aliasing -I ../SDL_gfxPrimitives-1.5/ -I /Library/Frameworks/SDL.framework/Headers -I /Library/Frameworks/SDL_mixer.framework/Headers -I /Library/Frameworks/SDL_image.framework/Headers -I /Library/Frameworks/SDL_ttf.framework/Headers -framework AppKit -framework SDL -framework SDL_mixer -framework SDL_image -framework SDL_ttf -o linux/pong.mac ../SDL_gfxPrimitives-1.5/SDL_gfxPrimitives.c *.cpp SDLMain.m Paddle.cpp: In member function ‘void Paddle::handle_input()’: Paddle.cpp:46: warning: enumeration value ‘SDLK_UNKNOWN’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_FIRST’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_BACKSPACE’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_TAB’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_CLEAR’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_RETURN’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_PAUSE’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_ESCAPE’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_SPACE’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_EXCLAIM’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_QUOTEDBL’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_HASH’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_DOLLAR’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_AMPERSAND’ not handled in switch Paddle.cpp:46: warning: enumeration value ‘SDLK_QUOTE’ not handled in switch [... snip ...] Paddle.cpp:51: warning: enumeration value ‘SDLK_UNKNOWN’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_FIRST’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_BACKSPACE’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_TAB’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_CLEAR’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_RETURN’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_PAUSE’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_ESCAPE’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_SPACE’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_EXCLAIM’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_QUOTEDBL’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_HASH’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_DOLLAR’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_AMPERSAND’ not handled in switch Paddle.cpp:51: warning: enumeration value ‘SDLK_QUOTE’ not handled in switch [... snip ...] Paddle.cpp:59: warning: enumeration value ‘SDLK_UNKNOWN’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_FIRST’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_BACKSPACE’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_TAB’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_CLEAR’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_RETURN’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_PAUSE’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_ESCAPE’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_SPACE’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_EXCLAIM’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_QUOTEDBL’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_HASH’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_DOLLAR’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_AMPERSAND’ not handled in switch Paddle.cpp:59: warning: enumeration value ‘SDLK_QUOTE’ not handled in switch [... snip ...] Paddle.cpp:64: warning: enumeration value ‘SDLK_UNKNOWN’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_FIRST’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_BACKSPACE’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_TAB’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_CLEAR’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_RETURN’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_PAUSE’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_ESCAPE’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_SPACE’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_EXCLAIM’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_QUOTEDBL’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_HASH’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_DOLLAR’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_AMPERSAND’ not handled in switch Paddle.cpp:64: warning: enumeration value ‘SDLK_QUOTE’ not handled in switch [... snip ...] cc1obj: warning: command line option "-std=c++98" is valid for C++/ObjC++ but not for ObjC SDLMain.m:8:2: warning: #import is a GCC extension SDLMain.m:9:2: warning: #import is a GCC extension In file included from SDLMain.m:9: SDLMain.h:8:2: warning: #import is a GCC extension In file included from SDLMain.m:9: SDLMain.h:11: warning: struct has no named members SDLMain.m:10:2: warning: #import is a GCC extension SDLMain.m:11:2: warning: #import is a GCC extension SDLMain.m:68: warning: struct has no named members Alcarin:pong steven$
    The SDLMain.m warnings are no fault of your own.

    So it looks like as far as warnings go, you're just missing a 'default' case on your switch statements in Paddle.cpp on lines 46, 51, 59, 64 (something like 'default: break;' would silence it). So nothing really bad there.

    Is your game supposed to have some sort of A.I. controlling the 2nd paddle?

    _________________
    - Tycho

    Image


    Top
    Offline  
     Post subject:Re: First attempt at an SDL game...
    PostPosted:Sat May 16, 2009 2:40 pm 
    User avatar
     

    Joined:Sun Feb 12, 2006 8:56 pm
    Posts:1019
    Website:http://eddieringle.com
    Location:Detroit, MI
    No, haven't really looked into AI yet. Any pointers on how I can learn to do that would be nice. Although, I got really hooked on beating myself at one point...

    And SDL_gfx is an external library that allows me to draw geometric shapes.

    _________________
    -- Eddie Ringle

    Check out Elysian Shadows and consider backing us on Kickstarter!

    ====================================

    Image


    Top
    Offline  
     Post subject:Re: First attempt at an SDL game...
    PostPosted:Sat May 16, 2009 10:00 pm 
    Literally Nine
    User avatar
     

    Joined:Sat Apr 02, 2005 3:31 pm
    Posts:1171
    Location:The vicinity of an area adjacent to a location.
    SDL_gfx and SDL_gfxPrimitives are two different libraries.

    _________________
    - Tycho

    Image


    Top
    Offline  
     Post subject:Re: First attempt at an SDL game...
    PostPosted:Sun May 17, 2009 5:57 pm 
    User avatar
     

    Joined:Sun Feb 12, 2006 8:56 pm
    Posts:1019
    Website:http://eddieringle.com
    Location:Detroit, MI
    Okay, updated the main post with the latest version.

    Rendering is now done using OpenGL, but there is one bug in Linux. The Windows build works fine, but when you run the Linux build it will be obvious what is wrong. The quad that the text is textured onto is completely white, instead of blended like in the Windows build.

    _________________
    -- Eddie Ringle

    Check out Elysian Shadows and consider backing us on Kickstarter!

    ====================================

    Image


    Top
    Offline  
     Post subject:Re: First attempt at an SDL game...
    PostPosted:Mon May 18, 2009 1:30 pm 
    User avatar
     

    Joined:Sun Feb 12, 2006 8:56 pm
    Posts:1019
    Website:http://eddieringle.com
    Location:Detroit, MI
    Also, the windows build runs fine on my home computer, but as soon as I run it at school it crashes and gives an application configuration incorrect error. Any ideas?

    EDIT: Fixed.

    _________________
    -- Eddie Ringle

    Check out Elysian Shadows and consider backing us on Kickstarter!

    ====================================

    Image


    Top
    Offline  
    Display posts from previous: Sort by 
    Post new topic Reply to topic

      All times are UTC-05:00


      Who is online

      Users browsing this forum: No registered users and 1 guest


      You cannot post new topics in this forum
      You cannot reply to topics in this forum
      You cannot edit your posts in this forum
      You cannot delete your posts in this forum
      You cannot post attachments in this forum

      Search for:
      Jump to:  
      cron
      Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
      Theme created by Miah with assistance from hyprnova