Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » A few questions

This thread is locked; no one can reply to it. rss feed Print
A few questions
Paladin
Member #6,645
December 2005
avatar

I have a few questions on my mind and I think it would just be easier to ask them all in one thread to save time. Well, here they are.

1. In one of my test programs, I want to set the keyboard rate to a certain amount. I tried using the allegro function:

but that didn't work. How can I do this?

2. I want to try a few things in 3d and I was wondering, what should I use? AllegGL, OpenGL, D3D, DirectX, etc? And where would I start? Should I just make a simple program where you can rotate a cube, or try something? I thought I would start with OpenGL since it seems good, but I don't know. Suggestions would be great.

3. I'm interesting in making a small library that can load and play .mp3 files, .ogg files, and .midi files, but I'm not sure where to start. I know that there are already libraries to do this, but as dumb as this sounds, I'd rather learn for myself. Would anyone happen to know a good place to start?

Thanks a lot guys. ;D

miran
Member #2,407
June 2002

Quote:

2. I want to try a few things in 3d and I was wondering, what should I use? AllegGL, OpenGL, D3D, DirectX, etc? And where would I start? Should I just make a simple program where you can rotate a cube, or try something? I thought I would start with OpenGL since it seems good, but I don't know. Suggestions would be great.

You should use OpenGL. OpenGL does 3D graphics. Not less, not more. If you need to do other things besides 3D graphics, like for example accept input from the keyboard and mouse, play sounds and other things, you should also use Allegro. Allegro does keaboard, mouse, joystick, sound, music, timers and all those other things. To be able to use Allegro and OpenGL together you should use AllegroGL. AllegroGL makes it possible to use Allegro with OpenGL. To learn about OpenGL you should read the official documentation, called the blue book (programmer's reference) and the red book (programmer's guidlines). You should also read NeHe's OpenGL tutorials.

Quote:

3. I'm interesting in making a small library that can load and play .mp3 files, .ogg files, and .midi files, but I'm not sure where to start. I know that there are already libraries to do this, but as dumb as this sounds, I'd rather learn for myself. Would anyone happen to know a good place to start?

Go back and strike 3D graphics out of your schedule. Because if you want to learn how to play mp3, ogg, midi and other music files by yourself, then be prepared to spend a lot of time learning. At least a few years...

--
sig used to be here

Paladin
Member #6,645
December 2005
avatar

Ok, well if it's really that hard, then in that case I'll just stick with the 3d and use libraries. I can't believe it would take years, but oh well. Do you know how to fix my first problem?

Onewing
Member #6,152
August 2005
avatar

Quote:

Go back and strike 3D graphics out of your schedule. Because if you want to learn how to play mp3, ogg, midi and other music files by yourself, then be prepared to spend a lot of time learning. At least a few years...

Emphasis mine.

If you are wanting to make a library that others use to play all kinds of file types, that's one thing, if you want to make some source that can handle all your music needs, that's another (because the second option is free to use available libraries and it's for you). For example, I made a dj.h and dj.cpp file that handles my music needs by interfacing with the alogg library. I just wanted one file to talk with the library so all I had to do for the rest of my program was talk to the dj. It was a pretty quick hack, so it doesn't handle a lot of things (like MIDI or mp3), but it get's the ogg files going and that's what I needed. I just add things to the dj's playlist, tell it if I want it set for shuffle and then let it do it's thing. Food for thought.

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Paladin
Member #6,645
December 2005
avatar

Well yea, that was basically my plan onewing. I figured I would learn how to do mp3's and such, but really my main focus is just ogg cause I don't have to pay for a license. I think. :-/

count
Member #5,401
January 2005

Something like this schould work.

if ( !keypressed() ) { pressDelay = 0; }
      

if ( keypressed() ) 
{ 
  if ( pressDelay == 0 ) {
    handle_input();
    pressDelay = 20;
  }
}
if (pressDelay != 0 ) pressDelay--;

Go to: