flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Fasm with SDL.DLL

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 12736
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 04 Jun 2012, 21:01
just wanna try something new

i start from here,
http://www.lazyfoo.net/SDL_tutorials/lesson01/index2.php

SDL.DLL is downloadable from http://www.libsdl.org/download-1.2.php

Code:
format PE GUI 4.0

include 'win32ax.inc'

SDL_INIT_EVERYTHING            = 0x0000FFFF
SDL_SWSURFACE                   = 0

.code
start:
      invoke  SDL_Init,SDL_INIT_EVERYTHING
        invoke  SDL_SetVideoMode,640,480,32,SDL_SWSURFACE
                   mov     [screen],eax
        invoke  SDL_RWFromFile,"hello.bmp","rb"
 invoke  SDL_LoadBMP_RW,eax,1
                        mov     [hello],eax
 invoke  SDL_UpperBlit,[hello],NULL,[screen],NULL
    invoke  SDL_Flip,[screen]
   invoke  SDL_Delay,2000
      invoke  SDL_FreeSurface,[hello]
     invoke  SDL_Quit

.data
       hello   dd 0
        screen  dd 0

section '.idata' import data readable writeable
library        kernel32,       'kernel32.dll',\
         user32,         'user32.dll',\
           msvcrt,         'msvcrt.dll',\
           sdl,            'sdl.dll'
         
            include 'API\KERNEL32.INC'
               include 'API\USER32.INC'
         include 'API\MSVCRT.INC'
         include 'API\SDL.INC'
    


Description: SDL.INC
Download
Filename: SDL.INC
Filesize: 8.88 KB
Downloaded: 1298 Time(s)

Post 04 Jun 2012, 21:01
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1389
Location: Piraeus, Greece
Picnic 11 May 2014, 17:39
^^I had the same mood today, inspired by your post.

After reading Lazy foo tutorial 20, here is an enhanced example of animating sprites and parallax scrolling with SDL. Use keyboard arrows left/right to move hero. I used SDL 1.2.11 includes written by Raedwulf.


Image


Description:
Download
Filename: SDL_Animation.zip
Filesize: 410.97 KB
Downloaded: 1224 Time(s)



Last edited by Picnic on 21 Mar 2020, 07:42; edited 1 time in total
Post 11 May 2014, 17:39
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 12 May 2014, 08:34
Picnic, it is really very good example!

I decided to develop it a little and to turn it to a portable example, using FreshLib. (SDL is portable library, so why to limit yourself to Windows only?)

Additionally I cleaned up the source a little and adapted it to FreshLib requirements.

I hope you don't mind it... Are you?

In this post is attached the edited example (contains compiled binaries for Win32 and Linux).

For compilation you will need the recent FreshLibDev (or newer).

If you want to compile it with FASM, set following environment variables:

lib = directory where FreshLibDev is unpacked (where "freshlib.inc" and "freshlib.asm" resides.
TargetOS = "Win32" or "Linux"

Ah, and one more note: The Windows example needs more .dlls: "libpng" and "zlib" in order to be self-contained. I added them to the package as well.


Description:
Download
Filename: SDLExample_portable.tar.gz
Filesize: 407.35 KB
Downloaded: 925 Time(s)


_________________
Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9
Post 12 May 2014, 08:34
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1389
Location: Piraeus, Greece
Picnic 12 May 2014, 20:16
JohnFound wrote:
Picnic, it is really very good example!
Thank you, i'm glad you like it.

Quote:
Additionally I cleaned up the source a little and adapted it to FreshLib requirements. I hope you don't mind it... Are you?
Not at all, in fact i will run it through fresh asap.

Quote:
Ah, and one more note: The Windows example needs more .dlls: "libpng" and "zlib" in order to be self-contained.
Oh that was a valuable tip. I added the dlls into the zip.
Post 12 May 2014, 20:16
View user's profile Send private message Visit poster's website Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal 14 May 2014, 18:40
Picnic: Cute example Smile Good luck with your web site!

John: Why can't you write your own code?

I'm not surprised to see John begging programmers for their code. He has been doing this since the MASM community. But John only asks for permission when he has to. He would outright steal your work if he could get by with it!

See, John wants you to write code for him. "Don't use if... because John only likes to copy and paste ''real" assembler. He doesn't want to have to convert your .if's to cmp's.
Post 14 May 2014, 18:40
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 14 May 2014, 19:18
Come on, mental! It seems to me you are simply jealous, because your code is not included in the Fresh project. Sorry, but it is because Fresh is only asm. Write some valuable asembly code and I will ask you as well to use your code. If you don't have ideas, I can think a task for you.
Post 14 May 2014, 19:18
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12736
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 15 May 2014, 03:56
awesome!!,, =) picnic!!
Post 15 May 2014, 03:56
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.