Jump to content
  • Advertisement
Sign in to follow this  
ESDesigner

Creating a "higscore list" with SDL using a joystick

This topic is 4517 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone! I need your advice and help in making a high score list that will work with a joystick. I am making a school project and I am using SDL and need to create a 'profile' that needs to work with a joystick. I have made a menu but I need to input name, age and some other variables. To do this I thought of how old time high score lists are built (and I don’t need more then three letters or numbers for the variables). I don't know how you are going to choose a letter. Is it a good idea to create a bitmap font where you choose letters by tilting the Y-axis and accept the change with a button? You could then save these variables to a save file. Any ideas of how I go about. I could probably make it work with a keyboard, but I really need it to work with a joystick (and yes I know that different joysticks act differently). I hope you understand what I am trying to achieve=)

Share this post


Link to post
Share on other sites
Advertisement
Here's the way I would design it:

Make an array of acceptable chars (A-Z, a-z, 0-9, backspace, end). Then make it so that pressing up on the joypad/stick cycles up through the array and and pressing down cycles down. On a joy button press append, backspace, or end depending on the character.

Whenever the string changes simple create a new text surface.

Share this post


Link to post
Share on other sites
No offense, but I hate highscores where you can't type in the name/other stuff. On consoles, I just accept whatever is the defualt one. Typing is the way to go.

And SDL_ttf can handle fonts for you, if you don't need speedy font-rendering.

Share this post


Link to post
Share on other sites
Ok, that was also my thought (arrays I mean). I am still a little bit confused of how you specify up and down cycles with joyaxismotion, could you show me an example?

Share this post


Link to post
Share on other sites
some psuedo code:

if( joy stick is pressed up )
{
position++
}
if( joy stick is pressed down )
{
position--
}
if( button is pressed )
{
name += letters[ position ]
}

Of course you'll have to add in array bounds checking, and handle when the user presses back or end.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!