• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

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

PsYcHoPrOg

Bitmap Load

11 posts in this topic

What, do you consider, the best way to load a bitmap. I am really nwe to directdraw and have not been able to load a bitmap comfortably even using the source from the books. The coding doesn''t seem to feel right. So if anyone has any ideas please send me some code for functions to load bitmaps to the backbuffer. Thanks.
0

Share this post


Link to post
Share on other sites
Use the direct3dx utility library. It has a function called D3DXCreateTextureFromFile that can load a bitmap to a surface.
0

Share this post


Link to post
Share on other sites
well u can use microsoft''s DDLoadBitmap function within ddutil.cpp and ddutil.h

copy the two files to your project''s directory and add them to the proj. and compile them.

to load a bitmap just do something like:

DirectDrawSurface = DDLoadBitmap(directdrawobject,pathofbitmap, sx, sy);

sx and sy are for if u want to stretch the bitmap if u don''t put put 0 else put a value less then the size of the screen.

to load the image to the back buffer do a blt or bltfast operation, something like:

g_pDDSBack->BltFast(x,y,DirectDrawSurface,&rcRect,FLAGS);

g_pDDSBack is your back buffer
x & y are where u want the image on the screen
DirectDrawSurface is the surface with the bitmap
&rcRect is a rectangle defining how much of the bitmap to show, do something like:

RECT rcRect={0,0,width_of_bitmap,height_of_bitmap);

FLAGS are flags for transparency and stuff check the docs and you''ll find them all.

That''s it and remember to release the surface:

DirectDrawSurface->Release();
DirectDrawSurface=NULL;

when your exiting your app.
0

Share this post


Link to post
Share on other sites
Thanks a lot. You really helped me out. But, in DDLoadBitmap, what is the "pathofbitmap" parameter? If it is the directory of the bitmap, then I don''t think that It''s worth it. But if it''s just the name, the function seems useful.
0

Share this post


Link to post
Share on other sites
I think your confused . The path is any sort of refrence to a file, from the current directory or root(c:\ for you windows people). So, if your running your game from the c:\mygame directory, and you want to load c:\mygame\thisimg.bmp then set pathname to thisimg.bmp

Hope this helped - Cloxs

My finger can point you to the moon,
but you do not need my finger to know it is there.
0

Share this post


Link to post
Share on other sites
DDLoadBitmap works fairly good, but what if you want to load it from a resource file (not a windows resource file, but one of those..well..ah..go read that article on here )? Or is there some parameter of it I didn''t figure out yet? Perhaps. However I still prefer doing ut myself (in asm, yeah ) - don''t like using other people code

-- Staffan
0

Share this post


Link to post
Share on other sites
I personally like to use the Windows GDI functions to load in bitmaps. It automatically does color conversion and all that great stuff. Besides that, you can also load stuff from resource files.

Hmm, thinking about it, I think thats how DDLoadBitmap does it.

--TheGoop
0

Share this post


Link to post
Share on other sites
by "pathofbitmap" i actually meant the the sub-directory the bitmap is in (if there is one) followed by the filename of the bitmap
ok that's a little confusing i know

basically, the folder your exe is in is usually your woking directory. if the bitmap is in this directory just put
"name_of_bitmap.bmp"

however, if there is a sub-directory to the main directory, like if u have a sub-directory named "gfx" to put all the graphics for your game, you would put
"name_of_sub-directory\\name_of_bitmap.bmp"

i hope this helps

Edited by - +AA_970+ on 2/12/00 10:00:20 AM
0

Share this post


Link to post
Share on other sites
I thank you for all replying to my post and I appreciate the information that you have all given. But what if I''m using my own code? What do you consider the best way to load a bitmap then?
0

Share this post


Link to post
Share on other sites