The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Dark Schneider on February 17, 2005, 07:28:25 AM

Title: Information Needed
Post by: Dark Schneider on February 17, 2005, 07:28:25 AM
Hello again,

I want to know completely about bitmap and sound.
Where can I find this information?
Does any detailed tutorial exist somewhere?

Please help me, thanks.
Title: Re: Information Needed
Post by: petezl on February 17, 2005, 10:17:02 AM
You are asking too much to expect an answer! Comprehensive information doesn't exist for win32 asm. You have to learn it by searching asm forums, experimenting, studying snippets of code and asking questions. If you are in a hurry then learn a higher level language like C. It still won't teach you everything but will teach you a syntax that's capable of doing most of what you ask.

Peter.
Title: Re: Information Needed
Post by: fallenhobbit on February 17, 2005, 10:20:59 AM
Comprehensive info for c/C++ does exist because most games are written in c/c++ using one of various graphics libraries. Now for the fun trick. Find some C source, get yourself an install of MinGW, and then at the command line run g++ -c-S somefile.cpp
an assembly listing file will be generated. Enjoy.
Title: Re: Information Needed
Post by: pbrennick on February 17, 2005, 03:42:53 PM
Way to go fallenhobbit.  And after you have done that, take a look at Donkey's graphics library.  He has put a lot of work into it and works on bettering it all the time.  It is written in GoASM syntax, but that is very similar to masm and is callable from masm.  Also, it is not a bad idea to eventually know how to work with more than one assembler.  Just don't be surprised about what might happen next!

Paul
Title: Heh?
Post by: Dark Schneider on February 21, 2005, 05:53:08 AM
I means the very basic concepts of bit map and sound (e.g. how it works, basic APIs that manupulate it) not that complex graphic libraries.
Thanks for your advice anyway, I will take time to learn it I'm not in a hurry at all.
Title: Re: Information Needed
Post by: petezl on February 21, 2005, 09:27:42 AM
Ok!... , "completely" was a tall order. Basics I can help you with.

The easiest way to use Bitmaps and sound is to load them into a resource.

4000 BITMAP mybitmap.bmp
5000 WAVE mysound.wav

There are several ways to handle a bitmap in the program, best to start with something like .elseif uMsg==WM_INITDIALOG
invoke LoadBitmap, hInstance, 4000
mov hbitmap, eax

.elseif uMsg == WM_PAINT
invoke BeginPaint, hDlg, addr ps
mov hdc, eax
invoke CreateCompatibleDC, NULL
mov hMemDC, eax
invoke SelectObject, hMemDC, hbitmap
invoke GetClientRect, hDlg, addr rect
invoke BitBlt, hdc,0,0, rect.right, rect.bottom, hMemDC,0,0, SRCCOPY
invoke DeleteDC, hMemDC
invoke EndPaint, hDlg,addr ps


For the sound, have a look at the "PlaySound" api call
invoke PlaySoundA,5000,hInstance,40005h    ; SND_RESOURCE+SND_ASYNC

Peter.