473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Easy or not?

Hi,
Ok my problem is hard to explain... I'm making a directdraw based program
and of course maps. I can put texture on my map but I want to save those
information in a structure with a x, y and a texture variable assigned to
that coord in order to recreate the map over and over again. Think about it,
how would you make that structure or anything else that would do the job...?
First I came with a very stupid conclusion:
struct DDMAP
{
int x[64];
int y[64];
int texture[255];//Assume I have 255 texture in a file
};
But when I came up to save it I saw that it was impossible. Try to save
that:

x1,y1 = texture #10
x1,y2 = texture #120

See what I mean!

Thanks for any help,
Max.
Jul 19 '05 #1
2 1647
!Q

"Maximus" <ik*********@videotron.ca> wrote in message
news:gy*********************@weber.videotron.net.. .
Hi,
Ok my problem is hard to explain... I'm making a directdraw based program
and of course maps. I can put texture on my map but I want to save those
information in a structure with a x, y and a texture variable assigned to
that coord in order to recreate the map over and over again. Think about it, how would you make that structure or anything else that would do the job...? First I came with a very stupid conclusion:
struct DDMAP
{
int x[64];
int y[64];
int texture[255];//Assume I have 255 texture in a file
};
But when I came up to save it I saw that it was impossible. Try to save
that:

x1,y1 = texture #10
x1,y2 = texture #120

See what I mean!

Thanks for any help,
Max.


const int MAP_WIDTH = 64;
const int MAP_HEIGHT = 64;

const int NUM_TEXTURES = 256;

unsigned char map[MAP_HEIGHT][MAP_WIDTH];
Texture textures[NUM_TEXTURES];

map[j][i] = texture index

so to draw it you would do something like:

drawTexture(x, y, textures[map[j][i]]);

pretty static, pretty simple

!Q
Jul 19 '05 #2
!Q

"!Q" <sa*****@spammer.com> wrote in message
news:bp**********@lust.ihug.co.nz...

"Maximus" <ik*********@videotron.ca> wrote in message
news:gy*********************@weber.videotron.net.. .
Hi,
Ok my problem is hard to explain... I'm making a directdraw based program and of course maps. I can put texture on my map but I want to save those
information in a structure with a x, y and a texture variable assigned to that coord in order to recreate the map over and over again. Think about

it,
how would you make that structure or anything else that would do the

job...?
First I came with a very stupid conclusion:
struct DDMAP
{
int x[64];
int y[64];
int texture[255];//Assume I have 255 texture in a file
};
But when I came up to save it I saw that it was impossible. Try to save
that:

x1,y1 = texture #10
x1,y2 = texture #120

See what I mean!

Thanks for any help,
Max.


const int MAP_WIDTH = 64;
const int MAP_HEIGHT = 64;

const int NUM_TEXTURES = 256;

unsigned char map[MAP_HEIGHT][MAP_WIDTH];
Texture textures[NUM_TEXTURES];

map[j][i] = texture index

so to draw it you would do something like:

drawTexture(x, y, textures[map[j][i]]);

pretty static, pretty simple

!Q


I may have misunderstood your question.. if a texture can go _anywhere_ and
it is not simply a tile-based approach you would store the information like:

struct TextureInf {
int x, y;
unsigned char textureRef;
};

std::list<TextureInf> textures;

then you could draw them like:

for (std::list<TextureInf>::iterator it = textures.begin(); it !=
textures.end(); ++it) {
drawTexture(it->x, it->y, textures[it->textureRef]);
}

!Q

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Russ Perry Jr | last post by:
I'm using "ID" and "Value" in the generic sense here... Let's say one page I had a <html:select> with a collection like this: <html:options collection="items" property="key"...
0
by: PatchFactory Support | last post by:
Description: Professional and easy-to-use patch building environment that can help you to create instant patch packages for software and file updating. Generated patch packages are small size...
4
by: NBURGAN | last post by:
We are currently searching for a reporting tool with graphics for our end users who are using Oracle's standard edition. We are not using the Oracle's AS. The tool needs to be easy to use and...
19
by: Canon EOS | last post by:
Hi, I am really new in .net and pocket PC development. My background are purely C/C++/VC++. Have developed on Mobile Java for a year and felt completely insecure with it because all codes can...
8
by: Adam Clauss | last post by:
I have a folder containing many subfolders (and subfolders and....) all containing various .cs files. Is there any "easy" way to get them all added to the solution. Preferable would be that the...
2
by: Thomas | last post by:
Hi, I there anybody here that are designing applications with asp.net without html in aspx files? The problem is that aspx files is a dependency, and I would like to avoid having that...
5
by: LedZep | last post by:
What up, All I need to do is enter a last name in a text box, query a MSAccess database and display the name with the corresponding columns. This is no problem, but when there are more than one...
1
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real...
13
by: Ghislain Tanguay | last post by:
I have a compiled vb.net app and I want to give the user a choice to launch it from the start line command and pass it a parameter or not. How can I do that in my code? Is it possible? Ex. :...
409
by: jacob navia | last post by:
I am trying to compile as much code in 64 bit mode as possible to test the 64 bit version of lcc-win. The problem appears now that size_t is now 64 bits. Fine. It has to be since there are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.