allegro in windowed mode
ebbo6

Lets pretend I'm making a game for Windows. And lets also pretend that this game is being played in a window. I know that to do this, I need to start up Allegro like this:

install_allegro(SYSTEM_NONE, &errno, atexit);

Now this is fine and dandy, until I want to use timers and play sounds. Does anyone have any bright ideas on how i could (easily) add sound and timers to a windowed graphical application????? please help, thanks alot

vpenquerch

Maybe there's something I'm missing, but how about calling:
install_allegro(SYSTEM_AUTODETECT,&errno,atexit) ?
You will need that to install the vtables to windows specific implementations of sound, timers ....
Running in a window is just a matter of, when calling set_gfx_mode, not using GFX_AUTODETECT, but something that pops a window in windows (GDI I think it's called)

Marty Dill

You could use GFX_DIRECTX_WIN with set_gfx_mode().

Goku

On that note, do you have to do all that nasty Win32 API setup yourself to get Allegro running windowed, or can you just switch your install_allegro () and set_gfx_mode () calls to get it windowed?

-Goku

ebbo6

Okay... I looked into your suggestions. If I use GFX_DIRECTX_WIN, it does put it in windowed mode, and if I use SYSTEM_AUTODETECT I can use all of the sound and timer functions. But my problem is that I was want to use Windows GUI functions with my window. More specifically, a Windows menu bar. I looked in the source for the directx port, and I didn't see any easy/portable ways of doing this. Suggestions?

Funklord

Hi guys, this is almost exactly what I was looking for, can anyone recommend any good tiny (or huge) docs on this (maybe found deeply hidden within the allegro sources)?
I am using Borland C++ builder 5
What I am trying to accomplish:
let's say you have a normal GUI window (which you already designed in BCB) then when it gets focus, it will display a tiny 320x200 bitmap in the middle of it with allegro drawing the graphics on that, catching keyboard clicks and playing sound even??
(I think I almost quoted what ebbo6 just said =)
Anyone else have any input on this?

Daniel_C_McKinnon

Definatly!
Don't use Wingdowz!! It sucks!
It's useless! Everyone should know
that by now!

ebbo6

Funklord:

If you just want an application that does real-time graphics, its not that hard. The /wintests/dibhello.c example gives excellent insight on the details of that. If you want quick keyboard access, try GetAsyncKeyState(VK_?). It is just as good as Allegro's key[KEY_?]. The real problems come in with sound and timers, for which I have not yet found an easy solution.

Thread #150851. Printed from Allegro.cc