Making a Menu in DirectX

Started by
3 comments, last by hollowIchigo 17 years, 1 month ago
I have the source code for the game bash from the book begining game programming by Jonathan S. Harbour and I was trying to add a Menu to the game but can't seem to do so. I tried this: void Menu(HWND hwnd) { ClearScene(BLACK); Poll_Mouse(); int X = Mouse_X(); int Y = Mouse_Y(); if(d3ddev->BeginScene()) { DrawText(100,100,"NEW", font, 3,20,20); d3ddev->EndScene(); } d3ddev->Present(NULL,NULL,NULL,NULL); } cource that didn't go so well. If u could help me i'd appriciate it. Also, i've noticed that when I try to load an Xfile exported from max with a texture, it says it couldn't find the texture file. anyone else have used the book Jonathan wrote? if so, please help me. I've been trying for weeks trying to figure out why it wont load the texture when I export it from max. thank you in advance.
Advertisement
I don't have the book, and I also don't fully understand the problem. When you say "that didn't go so well", what do you mean, exactly? Do you mean that nothing is drawn? Do you have a problem drawing text at all, or only in the context of the specific game example?

Regarding the model's texture, I imagine that has to do with the path. If the file contains a relative path, you're probably running from another location where it's wrong.
Regarding the text, it just goes to the game instead of showing the text. I figured that directX had to render what was between BeginScene and EndScene when ever it saw first. Not sure if i'm making sense.
Quote:Original post by hollowIchigo
Regarding the text, it just goes to the game instead of showing the text. I figured that directX had to render what was between BeginScene and EndScene when ever it saw first. Not sure if i'm making sense.
It does have to, but if you only call it once, you'll only render one frame, which will be gone in a fraction of a second. What does DrawText() do? Does it use D3D, or is it GDI stuff?
DrawText is a function made by Jonathan to write text to the screen. although there is a DrawText function in DirectX

This topic is closed to new replies.

Advertisement