flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > SWGPTG - 02 - Drawing Basic Shapes

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 24 Jun 2018, 17:19
With GDI functions and with our owns. Mostly of them are still only in the TinyC folder


Description:
Download
Filename: Shapes.7z
Filesize: 31.55 KB
Downloaded: 1998 Time(s)


_________________
Siempre aprendiendo
Post 24 Jun 2018, 17:19
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 01 Jul 2018, 19:05
This is a beta version, there are still some mistakes, but it admits your flag design and saves it as a waving flag in an animated gif. Made with the "all-made-by-hand" GDI.

Main known bugs:
- Always saves the gif
- Always with the name of "spain.gif"
- The background is always black

How does it work?
- It appears the waving flag of Spain
- If you press the "1" key it appears a window for let your own design
- If you press "Accept" the waving flag is now your design
- It saves the waving flag in an animated gif in the same folder of the exe with the name "spain.gif"

Please, let me know if you have done some nice designs.

Fisher in trance <-- Sorry, this is just a tune to accompany the presentation Very Happy

Edited: I've just cleaned some annoying black points on the flag and fixed the "main" known bugs.
Image


Description:
Download
Filename: BanderaWgC21.zip
Filesize: 11.52 KB
Downloaded: 3162 Time(s)


_________________
Siempre aprendiendo
Post 01 Jul 2018, 19:05
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 24 Jul 2018, 20:44
Using Windows fonts to create a 3d lattice logo (not finished yet)

Edited: enhanced versión. Three types of visualización with keys 1, 2, 3


Description:
Download
Filename: 3DTextMModWC02.7z
Filesize: 13.24 KB
Downloaded: 1545 Time(s)


_________________
Siempre aprendiendo
Post 24 Jul 2018, 20:44
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 04 Aug 2018, 10:16
This time a tiny 3d world with some shapes. You can move around and rotate with the mouse and some keys: E, D, A, Z, Q, W, X, C, R, F, T, Y and cursor keys.

You have to unzip the three files of the 7z in the same folder to execute it. Try to be soft with the mouse movement.

Turn on your speakers.

Any comments? Any body out there?


Description:
Download
Filename: 3DWorld_02.7z
Filesize: 257.19 KB
Downloaded: 2559 Time(s)


_________________
Siempre aprendiendo
Post 04 Aug 2018, 10:16
View user's profile Send private message Visit poster's website Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 353
Location: Poland
macgub 09 Aug 2018, 07:21
Quote:
Any comments?

Perhaps people are busy with own projects. First I read this thread on my poor nokia with no posibility to post reply. At last I get acces to computer, but i still must find enough time to look at your attachments. All the best!
Post 09 Aug 2018, 07:21
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1405
Location: Piraeus, Greece
Picnic 11 Aug 2018, 20:57
Hi avcaballero,

I just tried it. Runs quite smooth on my pc. Yeah, it's kind of hard to control it with the mouse, especially once you lose it. I like it's ambient mood. Falling into Gargantua. Smile
Post 11 Aug 2018, 20:57
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 12 Aug 2018, 11:01
Thank you for watching it guys Very Happy

_________________
Siempre aprendiendo
Post 12 Aug 2018, 11:01
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 27 Aug 2018, 18:40
Here is my version of Aizawa's attractor, just a starting point, I have to improved it. No zbuffer, etc. When finished, if anyone interested, I may release the source code. Nacho división


Description:
Download
Filename: AizawaWC01.zip
Filesize: 6.11 KB
Downloaded: 1413 Time(s)


_________________
Siempre aprendiendo
Post 27 Aug 2018, 18:40
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 28 Aug 2018, 15:52
Source code in my new website. Zbuffering added. If you wait a few minutes you will see all the points displacing on the shape.
Post 28 Aug 2018, 15:52
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 17 Aug 2019, 16:53
If anyone's interested, I have started the AOWG with the two chapters in SWGPTG and a new one, the third, at the moment, for palette programming.

As an example, a copper bars demo in 32 and 64 bits made with fasm.

By the way, there are no executables in my site due to usual false + of av, just code to be compiled.

Regards


Description:
Download
Filename: CopperBars.zip
Filesize: 7.69 KB
Downloaded: 1079 Time(s)


_________________
Siempre aprendiendo
Post 17 Aug 2019, 16:53
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 17 Aug 2019, 17:51
Here a worm demo made with tinyc


Description:
Download
Filename: GusanoWC01.7z
Filesize: 5.13 KB
Downloaded: 1195 Time(s)


_________________
Siempre aprendiendo
Post 17 Aug 2019, 17:51
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 24 Aug 2019, 13:33
The logo


Description:
Download
Filename: BurningLogoMModWC02.7z
Filesize: 85.54 KB
Downloaded: 1302 Time(s)


_________________
Siempre aprendiendo
Post 24 Aug 2019, 13:33
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 26 Aug 2019, 07:45
funny, the worm demo miss the timer when resizing the window. Smile
Post 26 Aug 2019, 07:45
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 26 Aug 2019, 18:21
Well, just disallowing resizing the window and it would be fixed Wink . Don't know why is this behaviour though I guess it has to do with StretchBlt.

_________________
Siempre aprendiendo
Post 26 Aug 2019, 18:21
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 27 Aug 2019, 08:00
i think it's more like a timer bypassed by WM_RESIZE code...

something like
Code:
WMrepaint:
call timer
call paint
jmp .end

WMresize:
call resize
call paint
jmp .end

.end:
    
Post 27 Aug 2019, 08:00
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 27 Aug 2019, 14:40
All of its windowproc is nearly the same as any other of my demos
Code:
LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     static   HDC               bufDIBDC;
     static   HBITMAP           hMainDIB;
              HDC               hdc ;
              PAINTSTRUCT       ps ;
     static   HGDIOBJ           hOldDIB=0, hGDITmp;
              int               bResult;

     switch (message)
     {
     case WM_CHAR :
          if (wParam == VK_ESCAPE) {
            goto     wmDestruimos;
          }  
          return 0 ;

     case WM_CREATE:
          hdc = GetDC(hWnd);
          
          // Crea un búfer dib para PintaObjeto. pMainDIB es un puntero a él
          bufDIBDC = CreateCompatibleDC (hdc);
          hMainDIB = CreateDIBSection(hdc, (BITMAPINFO *) &bi, DIB_RGB_COLORS, (void **) &pMainDIB, NULL, 0);
          hOldDIB  = SelectObject (bufDIBDC, hMainDIB);
        
          ReleaseDC (hWnd, hdc);   // Libera device context
          
          Inicio ();
          SetTimer (hWnd, cdIdTimer, 40, NULL) ;
          return 0 ;

     case WM_TIMER :
          InvalidateRect (hWnd, NULL, FALSE) ;
          return 0 ;

     case WM_SIZE :
          vdxClient = lParam & 0xFFFF;
          vdyClient = lParam >> 0x10;
          return 0 ;

     case WM_PAINT :
          hdc = BeginPaint(hWnd, &ps);
          PintaObjeto ();
          // bResult = BitBlt(hdc, 0, 0, cdXSize, cdYSize, bufDIBDC, 0, 0, SRCCOPY);
          bResult = StretchBlt (hdc, 0, 0, vdxClient, vdyClient, bufDIBDC, 0, 0, cdXSize, cdYSize, SRCCOPY);
          EndPaint(hWnd, &ps);
          return 0 ;

     case WM_DESTROY :
          wmDestruimos:
          KillTimer (hWnd, cdIdTimer) ;
          hGDITmp = SelectObject (bufDIBDC, hOldDIB);
          bResult = DeleteDC (bufDIBDC);
          bResult = DeleteObject (hMainDIB);
          bResult = DestroyWindow (hWnd);
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hWnd, message, wParam, lParam) ;
}
    

_________________
Siempre aprendiendo
Post 27 Aug 2019, 14:40
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 28 Aug 2019, 08:58
ok, i get it.

WM_RESIZE will induce a InvalidateRect, and then call the WM_PAINT without waiting for the timer.

to avoid this, maybe you can jump over the WM_PAINT procedure if WM_TIMER is not met.

something like
Code:
case WM_TIMER:
timeout = true;
...


case WM_PAINT:
if (timeout) {
paint();
}
timeout = false;
...

    


of course, it will induce a delay when resizing.

when dealing with time dependent actions, i use time dependent formlas using a milli second timer to get a tick, and animate with a function of this tick.
Post 28 Aug 2019, 08:58
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 28 Aug 2019, 14:41
Hello, edfed, in fact it is easier than that. The problem is including the calling to "PintaObjeto" within WM_PAINT instead in WM_TIMER that is where it should be, because each time you resize the window, a WM_PAINT is met.

I never gave much importance to this, but it looks better this way, undoubtedly. Thank you.

Here the new version.


Description:
Download
Filename: GusanoWC01.7z
Filesize: 5.13 KB
Downloaded: 1003 Time(s)


_________________
Siempre aprendiendo
Post 28 Aug 2019, 14:41
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 01 Sep 2019, 19:12
Hello. Image files, this time bitmap 24 bits in resources. Reading it and dump its data image in an array. Also for pcx, tga and even for saving gif. The example is a bmp rotozoomer. It accepts any bmp file that you can drag and drop over the program window, don't use a big one, better a 200x200 for example. Don't pretend to be an image reader, just manage bmp, pcx, tga for our purposes.


Description:
Download
Filename: RotozoomWC01.zip
Filesize: 88.75 KB
Downloaded: 1231 Time(s)


_________________
Siempre aprendiendo
Post 01 Sep 2019, 19:12
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 212
Location: Madrid - Spain
avcaballero 15 Sep 2019, 16:32
Hello, I'm uploading the 4th chapter, for graphics files. At the moment only in the Spanish version, though I will upload soon the English one too.

Graphics files:
- BMP. 8 and 24 bits. Reading from files and resources
- TGA. 8 and 24 bits. Reading from files.
- PCX. 8 bits. Reading from file.
- PPM. 24 bits. Writing and reading from file. Using a little raytracing program for that.
- GIF. 8 bits. Writing to file. Using a little program to gerating it.

At the moment only for tinyc. I will make the rest when time permits.
Post 15 Sep 2019, 16:32
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.