Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


2D LoadBitmap through Header files??


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Drizzt DoUrden   Members   -  Reputation: 100

Like
Likes
Like

Posted 22 August 2001 - 02:50 PM

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

Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 22 August 2001 - 03:59 PM


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
}





#3 Drizzt DoUrden   Members   -  Reputation: 100

Like
Likes
Like

Posted 22 August 2001 - 04:07 PM

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

#4 Midnight Coder   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 August 2001 - 04:29 PM

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.

#5 Drizzt DoUrden   Members   -  Reputation: 100

Like
Likes
Like

Posted 22 August 2001 - 04:42 PM

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

#6 Drizzt DoUrden   Members   -  Reputation: 100

Like
Likes
Like

Posted 22 August 2001 - 06:13 PM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS