Newbie Questions

Started by
5 comments, last by Ibanez 22 years, 6 months ago
Hi! I am hoping someone can help with a couple of (probably stoopid) questions I have... 1) I am using DX8 with VC++, to draw bitmaps on the screen (at a decent speed) I have been drawing them as a textured rectangle - this is the only way I could think of to do it (since the demise of DirectDraw), is this normal? It seems like there should be an easier way... 2) I want to create an app (using the Application Wizard on VC++ ) that uses DirectSound and DirectInput, but I cant get the HWND variable I need to init them (You dont seem to have access to the WinMain function when using the App Wizard). What is the best way to get this? Any tips or advise you guys might have will be appreciated, I think I have been to every DX tutorial site on the web and have had no luck.
Advertisement
I don''t know about the second one.. but the first one:

Texturing a rectangle is the standard as far as I know. Thats what all programmers I know do, and its probably what the pro''s do.

"He who fights with monsters should look to it that he himself does not become a monster... when you gaze long into the abyss, the abyss also gazes into you..."~Friedrich Nietzsche
------------------------------Put THAT in your smoke and pipe it
Thanks for the quick reply dude. This leads me to another question... What is the best way to copy a tile from a tileset bitmap to the screen, surely I dont have to create a texture object for every possible tile do I?
That''s an excellent question, I''d like to know this too. Might be helpful for future reference.
Peon
Can''t you set the source rectangle?

In any case, to answer your original question 2, AppWizard creates and MFC skeleton application. MFC is an encapsulation of the Win32 API and common application procedures into a decent toolkit (some will stop by just to say it''s crap - whatever). The only way yo obtain the HWND is to ask for it from the CWnd derivative that your application uses as primary display. All visual objects are CWnds (just like all Win32 controls are windows - hence the OS name), so they all (are supposed to) provide implementations of the CWnd base methods or fall back on CWnd. There''s probably something along the lines of GetWindow(), GetHWND() or GetHandle().

If you''re focused on creating DirectX games (as opposed to general applications), most people would advise you not to use MFC - and I''d agree as it contains a lot of functionality that you simply wont need. So next time you create a new project, create a new "Win32 Application".

Good luck.
Just put a group of tiles in a single bitmap
u can then specify the texture coordinate for each tile

hope this helps
Cool, sorted out the HWND thing, you were about 10 minutes too late, Oluseyi! Thanks anyway, you were exactly right.

For future reference, my code to do this is:
CWnd* winpoint = GetForegroundWindow();
HWND hWnd = winpoint->GetSafeHwnd();
(Embarrasingly easy innit?)

As for the texture offsets, you referring to the tuxture coordinates (u,v) kayx?

This topic is closed to new replies.

Advertisement