Jump to content

  • Log In with Google      Sign In   
  • Create Account


i think this is a newbie question...


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
15 replies to this topic

#1 raislam   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 02:51 AM

ok, i have been learning c++ for 4 years now and have been writing dos text-based programs... but, i got sick and tired of that, but i hadn''t found any books on loading bitmap files... i just want to load it to an offscreen surface so that i can use the RECT type to use them in a tile based game... what is the simplest way to load a bitmap to an offscreen surface? (could you explain how to do it either to load directly from a file instead of a rescource file?) thank you, ur help is very appreciated

Sponsor:

#2 Drizzt DoUrden   Members   -  Reputation: 100

Like
Likes
Like

Posted 29 August 2001 - 03:16 AM

What you are saying is you want to go into windows programming, or you want to load a .bmp from DOS?

#3 raislam   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 04:56 AM

windows (i have the dx8 sdk now, i just updated... that was a big file...)

#4 DeVore   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 05:04 AM

If I remember rightly, there is some example code of how to do this in the sdk. The file with the bmp loader is called something like ddutil.cpp at least that was the name in the dx7 sdk.
Anyway, I suggest that you look in the examples as the sdk''s tend to have a lot of quite easily understandable code.
Regards,
Devore

#5 henryx   Members   -  Reputation: 128

Like
Likes
Like

Posted 29 August 2001 - 05:17 AM

If you are needing help of this kind you need to get started from the ground up. I suggest that you get a good book on the subject such as "The Zen of Direct3D Programming" which also covers lots of 2D stuff similar to what you want to do.

#6 Midnight Coder   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 05:23 AM

I''d suggest you learn the Win32 API first. Try Programming Windows by Charles Petzold or Windows 98 Programming from the Ground Up by Herbert Schildt. After that, if you want to learn DirectX, I would suggest Tricks of the Windows Game Programming Gurus by André LaMothe.

#7 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 29 August 2001 - 05:33 AM

is there any way to do it with 1 function, or just smaller? could i have some code that inserts a bmp file called "grass.bmp" with 32x15 dimensions... it is for an isometric game.. and if possible, some tiling code

#8 raislam   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 05:35 AM

is there any way to do it with 1 function, or just smaller? could i have some code that inserts a bmp file called "grass.bmp" with 32x15 dimensions... it is for an isometric game.. and if possible, some tiling code

#9 Midnight Coder   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 05:41 AM

There is no one little magical function to create a game for you. You have to do it yourself or use an API like DirectX or OpenGL.

#10 raislam   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 05:47 AM

i know that... i just want a DirectDraw function that displays a *.bmp file... i know that there is one, but i get a little lost when i go through the huge header files in the sdk...

#11 Midnight Coder   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 05:54 AM

Based on what you said that you were writing text-based applications, I assume you don''t know DirectX. You can''t use a DirectDraw function without actually going through all the initialization and such. There is Blt(), but you can''t just throw it in the middle of your code and expect it to work. You have to initialize DirectDraw and stuff. You''ll also need to write your own bitmap loader, or you could use LoadBitmap() from the Win32 API.

#12 Drizzt DoUrden   Members   -  Reputation: 100

Like
Likes
Like

Posted 29 August 2001 - 05:56 AM

www.winprog.org

they have some easy to comprehend tutorials.

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

#13 raislam   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 06:01 AM

so, that must be why the code is always so long... i have seen a couple examples that are long (most were long to free the memory after the program is closed), and a lot of stuff about "HBITMAP" and "BITMAP" classes... a also heard about "LOADFROMFILE" that could be put into the declaration of the LoadImage() function from the ddraw.h file, but i''m never told where the filename should go...

#14 Midnight Coder   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 06:07 AM

LoadImage is from the Win32 API, not from DirectDraw. It is defined as:

HANDLE LoadImage(
HINSTANCE hinst,
LPCTSTR lpszName,
UINT uType,
int cxDesired,
int cyDesired,
UINT fuLoad
);


hinst is the instance handle to your application. It is passed to WinMain when the program starts. lpszName is where you either specify the name of the resource, or in your case, the filename. uType is the type of image to load. Use IMAGE_BITMAP here. cxDesired and cyDesired is the dimensions you want the bitmap to be loaded in, use 0 if you want the bitmap to retain its normal size. fuLoad should be LR_LOADFROMFILE if you want to load from a file, but it can be a combination of other flags as well. The function returns an HBITMAP which you can blit to a surface.

#15 raislam   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 August 2001 - 01:28 PM

thank you ... wut files would i need to include (i''m guessing windows.h)

#16 Beer Hunter   Members   -  Reputation: 712

Like
Likes
Like

Posted 29 August 2001 - 06:41 PM

DDUtil provides the useful function DDLoadBitmap().




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