Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic bitmap manipulation (in C, in win32) 1

Status
Not open for further replies.

zanza

Programmer
Feb 18, 2002
89
US
who here has played adventure? how about the 14 million clones? well, im writing another one. except mine is just a tad different. im not claiming excellence, just having fun. :)

anyway, this will be a text rpg with windows for the main text i/o, inventory, stats, a map, etc. now, everything else is working ok and is fairly simple. but i have no clue how to do the map. my objective is something like what morrowind has, a scrolling map with a rotating arrow in the middle for the player.

i think that also knowing how i do player navigation in this game would perhaps help with this. i basically have a "world" struct hold regions, and the regions hold towns, dungeons, etc. the most important member of the region struct though is the tile struct. it looks like this...

struct Tile
{
struct Tile *north, *south, *east, *west;
struct Tile *ne, *nw, *se, *sw;

char *description;
};

as you can see, it makes some sort of an octally linked list for ease of navigation and there will be a pointer to which tile the player is on at all times. the navigation system, as described, works fine.

now, this is all written in C and the windowing is done in the win32 api. can anyone either point me to a page that is something like what im asking (yes ive googled it) or does anyone know how one would do this using this system of navigation?

if nothing else, thanks for reading this far. ^_^

žÅNžÅ
 
zanza, to draw your map dynamically and display it in your window you want to look at the Platform SDK: Windows GDI.

Have you done any drawing in windows by handling the WM_PAINT message? If not you need to find a tutorial or book that covers that subject.

Here is a short overview to draw your map. You create both a memory device context and a bitmap for drawing your map in (CreateCompatibleBitmap, CreateCompatibleDC) After creating and setting up these resources and others like Fonts, Brushes etc., you use the various drawing functions in the GDI ( FillRect, TextOut etc.), to draw the map.

After the map has been drawn in the memory device context you use bitblt() to transfer it to the screen device context.

-pete
 
pete, you rock. ^_^ danke, i will put this to use asap.

žÅNžÅ
 
first of all, hi everyone as this is my first post. I hope you won't get angry at my English, as this is not my first language.

I'm not sure if this is what you're asking, but I made a very basic game (uni assignement, no time :) ) with VC6.0 and DirectDraw 8.0 (easier). To sum up, it's a little shoot'em up, viewed from the top. The map is composed of an array of several BMP pics (n vertical pics * n horizontal pics) and you can scroll quite smoothly in either ways.

Though I have a very "special" (hum !) way to program C++ apps (I missed some points in Object Oriented Programming) and my classes might seem weird, the graphical engine (display and clipping of sprites + map) has some relevant algorithms and might give you some clues and technics to handle images.

I can send you the source code if you feel it might help you. You can use it the way you want.

Contact me at glopglop49@yahoo.fr (yes, a damn frog :) )

 
Zanza, I'm trying to get a hold of you. mazelmuda@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top