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 ...
23yrold3yrold
Member #1,134
March 2001
avatar

1. Here's a Win32 one. See this? I also want the option of having no background, but in that case I'd like to be able to eliminate the child window's border. Can I change a window's style at runtime or am I stuck with it?

2. It's nice that one can use Win32 and Allegro together while eliminating conflicts with things like BITMAPs and RGBs. But what if I need a Win32 version of something Allegro overrides? I had to reproduce the Win32 RGB macro:

    #define WINRGB(r, g ,b)  ((DWORD) (((BYTE) (r) | \
          ((WORD) (g) << 8)) | \ 
          (((DWORD) (BYTE) (b)) << 16))) 

Is this the best way to handle that? What if I need a Windows BITMAP for something? How do I juggle that? Or can I?

3. Back in my newbie days, I thought it was a good idea to have a base class for enemies and derive a class for every new enemy type I needed (see STL shooter). Then I thought it was bright to have one class running Lua scripts to handle every enemy I need (see current platformer). While the last is cool for implementing new enemies fast, it's slow. To get my speed back, I thought of going back to my old way. The thought of dozens of source files again doesn't amuse me much, but after I thought about it for a while, I'm thinking it may be the way to go. I was afraid of wasting memory or something; not sure. Can I get some input on this?

All for now :)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

nonnus29
Member #2,606
August 2002
avatar

#3 I've been working on a shooter in c and after I got over feeling like I had one arm tied behind my back (no classes) I just made a game object struct with a variable to the 1. the objects type and 2. the objects state and a few other state specific things then have my "interface" functions coded specifically for the object ie bullets, particles enemies, explosions. Then I can keep one list of all the objects since there all the same type. I've only done the player and some enemies so far but its working okay. So my point is, maybe simplicity is the way to go....

Korval
Member #1,538
September 2001
avatar

Quote:

I also want the option of having no background, but in that case I'd like to be able to eliminate the child window's border. Can I change a window's style at runtime or am I stuck with it?

See ::ModifyStyle (or CWnd::ModifyStyle in MFC).

BTW, MSDN is an excellent reference for this sort of thing. It took me less than 5 minutes to hunt this down.

Quote:

Is this the best way to handle that? What if I need a Windows BITMAP for something? How do I juggle that? Or can I?

Doesn't Allegro redefine those as something else (like WIN_BITMAP or something)? Check winalleg.h.

Quote:

Back in my newbie days, I thought it was a good idea to have a base class for enemies and derive a class for every new enemy type I needed (see STL shooter).

It is a good idea.

Quote:

Then I thought it was bright to have one class running Lua scripts to handle every enemy I need (see current platformer). While the last is cool for implementing new enemies fast, it's slow. To get my speed back, I thought of going back to my old way. The thought of dozens of source files again doesn't amuse me much, but after I thought about it for a while, I'm thinking it may be the way to go. I was afraid of wasting memory or something; not sure. Can I get some input on this?

Any memory that extra classes take up is nothing compared to actual game data (sprites, tiles, etc).

Also, why does this method have to use "dozens of source files"? Unless you're one of the OOP fanatics who absolutely believes that each individual class needs its own .h/.cpp files, there's no problem.

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

See ::ModifyStyle (or CWnd::ModifyStyle in MFC).
BTW, MSDN is an excellent reference for this sort of thing. It took me less than 5 minutes to hunt this down.

This is Win32? It's not in win32.hlp, and I get only MFC references in my VC++ help files. I don't know the MSDN url; though I probably should :) .... EDIT: Okay, I found it on Google. I'm just not fond of looking stuff up on that site; it creeps on my 56k ;) EDIT2: I did a search for "modifystyle win32" on Google and it seems my answer is SetWindowLong(). I'll give that a go tomorrow ...

Quote:

Check winalleg.h.

Shall do ... EDIT: Okay; cool. Thanks :) Hmmm. From the look of this, I shouldn't even have to include windows.h if I'm already including winalleg.h ....

Quote:

Also, why does this method have to use "dozens of source files"? Unless you're one of the OOP fanatics who absolutely believes that each individual class needs its own .h/.cpp files, there's no problem.

That's me 8-) Okay, it's a good idea. Cool.

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Go to: