• Advertisement

Archived

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

2D LoadBitmap through Header files??

This topic is 5994 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

Can I make a header file, that calls to OpenGLs long LoadBitmap function, and then make my own function where I just pass params like filename ect, so that I just hae on line instead of a 100 line script to load an image??? This way, when I want to make image 1: myimagefunc(imagename, size, x, y, ect); then my image is loaded more cleanly? Or does someone have advice on a small script I can use? "I've sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do'Urden Edited by - Drizzt DoUrden on August 22, 2001 10:33:07 PM Edited by - Drizzt DoUrden on August 22, 2001 10:47:00 PM Edited by - Drizzt DoUrden on August 22, 2001 10:47:41 PM

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster

Uh, can you say basic programming concept?

Declare the function in your .h file:


int MyImageFunc(char* imagename, int size, int x, int y);


Then define the function in your .c or .cpp file:


int MyImageFunc(char* imagename, int size, int x, int y)
{
// this is where you put your code to load an image
return return_code; // make sure you return a return code
}



Share this post


Link to post
Share on other sites
I kind of figured it would be something like that, but I was thinking to myself about the

BITMAPFILEHEADER and stuff like that, where would that go, the header file or the cpp file? Thats the part that confused me. or wich one would I write the ID in?

Instead of having to declare all of this, in my cpp file, i want it in my .h file and in my cpp file I can say. All right, i want to load my charecter GK into my game now. So, I need to load his bitmap.

void LoadIt(imageBitmap, location, ect);

and from there on I have the bitmap loaded into my game. And in the header file called messyopengl(or whatever) I have the big ,messy all capitolized script they want me to use.

I never tried to make my own header file and use it in my program before, thats why I am having this trouble.

"I''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''Urden

Edited by - Drizzt DoUrden on August 22, 2001 11:21:08 PM

Share this post


Link to post
Share on other sites
You should put your function definition in the source file. And also, I would suggest that if you want your code organized that you keep it in multiple source files.

Share this post


Link to post
Share on other sites
I dont think I am saying this correctly:

I want to make a function that calls opengl functions.I want to declare the function with its normal params and ALL OF ITS INFO- in a header file. With this function , I want to be able to call many different bmps at different times. so the function is int loadIt:


include myHeaderFile
/// my player
loadIt(ID_Player, params needed to pass to create it through the more advanced function in the header file);

//later in my game, i find a need for an npc so:
loadIt(ID_NPC12202202, all the params needed);


now, i have my charecters created with a id to refer to.
So I can make a struct:

struct MainPlayer
{
str;
spd;
}ID_Player;

So there you have it. A fully loaded charecter with only 5 lines of code, compared to a 120 line code, that , I am sorry if I am wrong about this( I am just beggingintto tread the texture amppning chapter of this book)I have to write very time I have to load a bitmap. Do you have any idea how insane that is??? An rpg would require 20, 000 lines of code just to load charecters.


"I''''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''''Urden

Share this post


Link to post
Share on other sites
bah. I figured it out. Thanks, your posts did help me, after I realized you made sense and I didnt. Lol. Thank you.


"I''''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''''Urden

Share this post


Link to post
Share on other sites

  • Advertisement