Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » allegro in windowed mode

This thread is locked; no one can reply to it. rss feed Print
allegro in windowed mode
ebbo6
Member #733
November 2000

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
Member #233
April 2000

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
Member #277
April 2000
avatar

You could use GFX_DIRECTX_WIN with set_gfx_mode().

Goku
Member #686
September 2000
avatar

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
Member #733
November 2000

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
Member #467
June 2000
avatar

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?

----------------------
[ Me payge | Me shoutcast (128k) | Me in aktOin! | Me OS | Me friends ]

Age is inversely proportional to how much drink you've had - Funklord

Daniel_C_McKinnon
Member #685
October 2000

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

ebbo6
Member #733
November 2000

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.

Go to: