Archived

This topic is now archived and is closed to further replies.

Text based Rpg

This topic is 5577 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have started programming my first game but i have hit a big problem; when the game starts up it displays 2 options, 1 is use old character and the other is create a new character, when you go to create new character u have to select a character image but i dont know how to *display* all the images in my window and let the *user select one*. anyone know of any tutorials on this, preferably in open gl? thx in advance

Share this post


Link to post
Share on other sites
*ahem* Why are you using OpenGL to create a text-based game? With all due respect that's like dispatching an F-16 to take out a caterpillar... get the picture?

Besides, I don't think there are any tutorials (at least that I know of) of doing exactly that and by no means in OpenGL.

If I were creating a text game I'd just set up a simple form with some rich text boxes (for color text), and have some areas for displaying images.
It'd be really easy to do in something like Visual Basic or Delphi (well I don't know much c++ anyways but it's surely possible of course using windows api or MFC or something...)

-- Ivyn --

[edited by - Ivyn on August 28, 2002 1:02:05 AM]

Share this post


Link to post
Share on other sites
I think if you read the post he mentions PICTURES, which means that even though it is text based, he does use some graphics in the game.

As for the problem, it sounds like you just need to get a list of the images available and display them next to each other. As to how you would specifically do that, perhaps seeing your code will allow us to modify it?

Share this post


Link to post
Share on other sites
I have sort of figured it out, all i really should have mentioned was the word buttons becasue thats what im trying to create here...
ive got my images to display but the problem is do i use standard windows reading mouse or direct input or somthign like that. and if i use standard windows reading mouse then whats the command to c if a pic has been clicked on? (wm_down?)

Share this post


Link to post
Share on other sites
quote:
I think if you read the post he mentions PICTURES, which means that even though it is text based, he does use some graphics in the game.


And if you had read my post you would have seen I mentioned some areas for displaying images.

-- Ivyn --

Share this post


Link to post
Share on other sites
First, never underestimate The Caterpillar.

As for the original question, you need to do something like:
Display the pictures side by side, and store the rectangle that defines the border of each in an array.
When you get a mouse down event (Windows: WM_LBUTTONDOWN, WM_LBUTTONUP), determine where the user clicked (Windows: WM_MOUSEMOVE) and compare it to your border array.
Once you figure out which border the click falls within, you know which picture to use.

I don''t speak OpenGL. Sorry.

For extra credit, highlite the border of the pic, as the user WM_MOUSEMOVEs over it.
-c

Share this post


Link to post
Share on other sites
another problem that i forgot to ask about; how do you load up different pages or parts of the GUI in the same window?
any help would greatly be apreiteiated.

[edited by - com on August 29, 2002 4:30:02 AM]

Share this post


Link to post
Share on other sites
anyone at all can answer me that question?


anyway, ive been getting on with my interface but i have been struck by 2 errors that confuse me:


  
void PaintWindow(HDC hdc) //Line 31!!!!!

{
// set our mapping mode as text. this means 1 logical unit = 1 pixel.

SetMapMode(hdc, MM_TEXT);

// this function will draw the bitmap without stretching.

/*BitBlt(hdc,
0, 0, g_iScreenWidth, g_iScreenHeight,
g_hDCBitmap, 0, 0, SRCCOPY);
*/


// this function will stretch the bitmap so that it fits in the window.

StretchBlt(hdc,
0, 0, g_iScreenWidth, g_iScreenHeight,
g_hDCBitmap, 0, 0, g_iBitmapWidth, g_iBitmapHeight, SRCCOPY);
//now we will add our buttons to the window.

HBRUSH create = CreatePatternBrush("create.bmp");
HPEN yellowpen = CreatePen(PS_SOLID, 1, RGB(255,255,0));
//created a brush with a image fill and a yellow pen.

HBRUSH oldbrush = SelectObject(hdc, (HBRUSH)create);
HPEN oldpen = (HPEN)SelectObject(hdc, (HPEN)yellowpen);
Rectangle(hdc, randomrect.left, randomrect.top, randomrect.right, randomrect.bottom);


}

and my erros are:
Compiling...
window.cpp
C:\WINDOWS\Desktop\rpg\rpg\window.cpp(31) : error C2144: syntax error : missing '';'' before type ''void''
C:\WINDOWS\Desktop\rpg\rpg\window.cpp(31) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
anyone who can help me plz?
thx in advance

Share this post


Link to post
Share on other sites
I bet you have included a header with a syntax error in it just before line 31.
I''ll wager it''s a class or a struct definition without a semicolon at the end.

Do I win five pounds?

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

Share this post


Link to post
Share on other sites
quote:
Original post by Ivyn
*ahem* Why are you using OpenGL to create a text-based game? With all due respect that''s like dispatching an F-16 to take out a caterpillar... get the picture?




I found that very funny.

yours truly,
evil sausage

Share this post


Link to post
Share on other sites