flat assembler
Message board for the users of flat assembler.

Index > Windows > Windows game programming for dummies new Examples

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Hello everyone again, This is the next conversion of the Windows Game programming for dummies, chapter-10 (See next post for the other files needed). You should also download the required last 3 bmp files in the next post because of file size limits. In these newest examples we will learn how to do pageflipping, load in bmp files, and some general use of the Directx Blitter. I'm going to begin work adding functionality to the fasm dll library and making sure all current functions work correctly. This next update may take a while because the examples are getting more complex , and adding functionality to the fasmlib.dll. If you have a bug report post it and I or someone else will try and fix what is wrong.


Last edited by madmatt on 10 Jun 2004, 19:02; edited 1 time in total
Post 10 Jun 2004, 08:45
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Here are the last 3 bmp files for the window's game programming for dummies Chapter 10 examples. Simply drop them into your Chapter 10 folder. (Also forgot to mention to copy the macros.inc file from the fasmlibdll folder into your include folder!)
Post 10 Jun 2004, 08:55
View user's profile Send private message Reply with quote
i-don



Joined: 18 Jul 2003
Posts: 66
i-don
Thanks madmatt, still buggy on 16bit picture view. 8bits and the other working great! Smile Part of the picture turned green in both of 16bits demo. Have no idea why, may be my display card got limitation. Having no problem before on DirectX with 16bits such as game or other apps.

I'll try to get a screenshot of it.

i-don.
Post 12 Jun 2004, 12:55
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
I don't know why you have problems in 16 because my laptop (W2K SP4 / ATI mobility 8MB / DX9b) runs 16 & 32 at the same speed (is 16 compatibility mode?) but 8 is a bit faster. Strange is that while returning from 8bit-mode, desktop remains colourless for a while and automatically REFRESHes everything around (also arranging my icons in folders). 16bit is my desktop mode and no mode switching is neccessary when running 16bit. Strangely enough it doesn't happen on 32bit also^o)
Post 12 Jun 2004, 18:07
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
i-don



Joined: 18 Jul 2003
Posts: 66
i-don
No problem on 8bit or 32bit on my pc (win95b|dx7|4mb d3d|32bit desktop|800x600 res). All same speed as yours. Only a color bleeding in 16bits. here is screenshot (reduce to 1/2 size):

Image Image

I even reduce the color of the image into 16bits (34k colors) and re-open using both demos and again, same bleeding. I use as a texture in a dx game and running 16bit mode, it show no bleeding at all.

something like dx scene color and 2d sprite color does not match, I guess.

i-don
Post 12 Jun 2004, 19:29
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Hello Idon,
Glad to see MOST of the examples work for you! I'm learning a lot converting the c/c++ source to assembly, but sometimes the conversion doesn't come easy! The problem could be your card either doesn't support the 16-bit mode, or is substituting 15-bit mode in place of the 16-bit mode, I assume the latter. The bmp file format only supports 8 and 24bits of color. Therefore the bmp file has to be converted from 24bit to 16bit, which has 5 bits of blue and red, and 6 bits of green. Your card most likely is using 15-bit mode, 5 bits of red,green,blue. Here is something you can try, in DdrawLoadBitmap-16bit.asm, the GameMain procedure, change this code:
Code:
copypixels:
        mov     bx,0
        mov     al,[esi+2]
        shr     al,3
        mov     bl,al
        shl     bx,6
        mov     al,[esi+1]
        shr     al,2
        or      bl,al
        shl     bx,5
        mov     al,[esi]
        shr     al,3
        or      bl,al
        mov     [edi],bx
        add     edi,2 ;size of 16bit pixel (2 bytes)
        add     esi,3 ;size of 24bit pixel (3 bytes)
        dec     ecx
        jne     copypixels
    


to this:
Code:
copypixels:
        mov     bx,0
        mov     al,[esi+2]
        shr     al,3
        mov     bl,al
        shl     bx,5
        mov     al,[esi+1]
        shr     al,3
        or      bl,al
        shl     bx,5
        mov     al,[esi]
        shr     al,3
        or      bl,al
        mov     [edi],bx
        add     edi,2 ;size of 16bit pixel (2 bytes)
        add     esi,3 ;size of 24bit pixel (3 bytes)
        dec     ecx
        jne     copypixels
    


Well, hopefully this will solve the problem. I've made the changes to convert the 24bit image to 15bits. You could also make the same changes in the blitbmpimage-16bit.asm , GameInit section.
Post 13 Jun 2004, 02:18
View user's profile Send private message Reply with quote
i-don



Joined: 18 Jul 2003
Posts: 66
i-don
kudos madmatt, you're right about using 15bit reading substitute in my display card. Now, it turned alive for 16bits. Just post the results, in-case anything not quite right somewhere in there.

Image Image

Useful informations for DirectX newbie like me Wink

Thanks again,

i-don.
Post 13 Jun 2004, 03:32
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
Hmm, there are a lot of newbies around here:D

I found an interesting link. It's well commented and thorough:
http://www.gameprog.it/pub/lang/assembly/direct3d.htm
but there's one catch - it is in Italian and I don't know much Italian:P
and it's MASM. The latter one isn't hard to convert, but the language can be a problem, because it didn't remind me of English as I've heard:(
...does anyone know Italian?...Very Happy (Babelfish didn't want to preserve formating so it was impossible to 'read')

P.S. You might find direct3d2 and 3d3 which introduce us to matrices, lightning and using FP in ASM!
Post 18 Jun 2004, 13:53
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
Very interesting link! I don't know nothing about DirectX so I need to read it before helping you. It is a huge file so it is impossible for me to translate it all, but if you want little slices, I will be glad to do the translation.
Post 18 Jun 2004, 16:23
View user's profile Send private message Yahoo Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
Well, no need to translate ALL of it but rather just give us some overview and is it worth to try these examples. I just skimmed through the code and noticed much commented sections, but unfortunately didn't understand much (except international words) so just a short preview/review would be welcome.:$
Thanks,
Madis
Post 19 Jun 2004, 23:59
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Hello Madis731,
I took a look at this site also and looks very interesting. If you go to his home page you'll see a LOT more too. I sent the guy an email asking if he has an english version. BTW, the next update to the windows game programming examples will be ready in another few days to a week. May have to also find another place to upload the examples, because there are starting to get too large for this site. I'm thinking of Programmers Heaven, so stay tuned!
MadMatt
Post 20 Jun 2004, 01:12
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
It's nice to have progress on topics that I like Rolling Eyes

Hehe,
and I know, they are actually:
http://www.gameprog.it/?resource=533 ;the usual stuff Init+Destroy Very Happy
http://www.gameprog.it/?resource=538 ;Lightning & textures
http://www.gameprog.it/?resource=829 ;Multitexturing & stuff
And I printed the '533' out for a deeper look when I'm on a holiday.
On 24th of June we usually light bonfires and sing cum ba ya... or how did it go Razz
"Jaanipäev" we call it. This could be translated to John's Day or sth.
OK, be back in a week or so...bye 4 now!
Post 20 Jun 2004, 20:12
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.