Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » User Settings and High Scores

This thread is locked; no one can reply to it. rss feed Print
User Settings and High Scores
Brian Simpson
Member #6,645
December 2005
avatar

I'm asking a lot of questions here at once, but I was wondering, I wanted to know how to make an "options" screen where you can set the screen resolution, sound volume, etc, and when you press "OK" it records it in some kind of file and then sets the settings to your game. Then when you reload your game, it would use these settings again because they were saved. That's my goal. Then I was wondering how you could save high scores in a file, then have them displayed, and announce when you beat the high score, etc. If you guys could help, that would be great. Thanks.

CGamesPlay
Member #2,559
July 2002
avatar

A pretty easy way for all of this:

You can also use binary files, like for your high scores.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Neil Walker
Member #210
April 2000
avatar

Hello,
My framework code does this. You store everything into an XML file and on loading it it sets up allegro for you (if you wish). It also has an auto save function so that if you change a settings, e.g. 'ScreenCaps.BufferType=TRIPLE', 'MyCustom->SetFloat("gravity",-9.8)', when you exit the system, they are saved back to the file without you having to code anything.

After changing any of the major graphics settings (like width/height/buffering/depth) you just call Framework->Restart() and it reinitialises everything.

Obviously you have to use my classes, which probably isn't what you wanted, but it does animations and graphics handling as well and you can get the framework to run in a timer based loop to control the whole game for you if you wish (you just pass in function pointers and it does the rest).

It'll be finished in a few days.

Or if you just wanted code for all the settings and custom values like high-scores and don't mind c++ then download the stuff from my sig and it is all in the one file (Configurator), complete with help file, just ignore the bit about animations and graphics.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Dustin Dettmer
Member #3,935
October 2003
avatar

For settings a simple 'blah=fubar' system seperated by lines works for me. If that scares you you could check out the config routines linked to.

For highscores, I'd say use allegro's xor packfile password routines and write out in some obscure binary format, while linking against allegro staticly.

Go to: