The MASM Forum

Projects => Game Development => Topic started by: caballero on May 15, 2018, 10:21:14 PM

Title: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on May 15, 2018, 10:21:14 PM
Starting making one of the previous lesson quiz for a few compilers 32 and 64 bits
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on June 03, 2018, 06:40:29 PM
I have added some basic shapes using the standard GDI functions. Only in TinyC folder, the others is the same.

This is quite powerful in the sense that you can draw bitmaps on the fly than you can use in your own windows objects.

Really anyone interested? If so I don't like to speak to myself. Any feedback and code will be welcome.

PS. When maximize the smile face window it get quite slow. Fortunatelly it can be improved with our drawing routines.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: Siekmanski on June 03, 2018, 06:53:15 PM
Quote
Really anyone interested?

 :t I am.

Always want to learn and see how routines are done by other people.

I think it is a cool idea to discuss the different methods to create one effect.
Demo effects are a great resource for building games too. ( many of the game techniques stem from Demos )
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: felipe on June 04, 2018, 02:35:29 AM
Hey caballero this is a great contribution, thank you  :icon14:. I can't promise to be a good student, but surely i will have a look to the code when i get the time. You should keep with your courses when there are interest, i agree with that (that's also a good idea to make students better), but please don't delete what you upload, is good for the forum and when some people get the time to learn about this issue they will come here too.  :idea:
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on June 05, 2018, 04:05:40 AM
I almos forgot. Though I don't like much PeekMessage, here is a way to use it and stabilizing the fps, painting the fps on the screen. Ie, a way to write text to the screen using standard GDI functions.

I know that there's a way to optimize it, maybe using the function Sleep, that decreases the resources used. But, no time to chase it. If anyone knows how to do it, would be nice to tell us :t
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: felipe on June 05, 2018, 04:37:56 AM
 :icon14: This is great, thank you very much.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on June 24, 2018, 06:18:37 PM
First shape made by hand. Bresenham lines
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on June 24, 2018, 07:28:38 PM
More on basic shapes: circles. Fractal of Apolonio.

And more with Aldus haza (https://youtu.be/dbc1ollRt_E). HIEEERBA.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: Siekmanski on June 24, 2018, 08:02:31 PM
Very interesting routine, thanks.  8)
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: daydreamer on June 24, 2018, 10:20:07 PM
cool,thanks 8)
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: HSE on June 25, 2018, 01:21:06 AM
Very nice  :t
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on August 09, 2019, 11:17:33 PM
Hello, I'm moving my graphic tutos here (http://abreojosensamblador.epizy.com/?Tarea=5&SubTarea=0&Lang=1&nivel=0&padre=0&accion=0). A work in progress.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on August 15, 2019, 08:18:47 PM
Plasma made with poasm, 32 and 64 bits
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on August 17, 2019, 02:26:47 AM
Hello

I have started the third chapter (http://abreojosensamblador.epizy.com/?Tarea=5&SubTarea=3&Lang=1&nivel=0&padre=0&accion=0) (palette) with two examples at the moment, if anyone interested. All the compilers have worked well for 32 and 64 bits, except GoAsm for the 64 bits plasma and the palette builder for 32 bits. NasmX also fails for both examples for 64 bits. If anyone find the problem, please, tell me, in other case, I will check it when I have time.

Regards
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on August 17, 2019, 06:05:42 PM
Keep working with Palette examples, here a classical bars demo in 32 and 64 bits, made in fasm.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on August 18, 2019, 02:30:16 AM
The last example for palette: copper bars, widly used years ago in MS-DOS. Already uploaded to my site in the third chapter (http://abreojosensamblador.epizy.com/?Tarea=5&SubTarea=3&Lang=1&nivel=0&padre=0&accion=0).

This time poasm version for 32 and 64 bits.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: daydreamer on August 18, 2019, 03:06:00 AM
Keep working with Palette examples, here a classical bars demo in 32 and 64 bits, made in fasm.
nice :thumbsup:
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on August 18, 2019, 03:33:20 AM
Ops, I almost forgot my old good friend worm demo. I finish copper bars for nasmx and goasm and incorporate this one too... when I have time. This one made with tinyc.

Thank you, daydreamer. :thumbsup:
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: daydreamer on August 19, 2019, 07:18:20 PM
nice
I read about you wannat go 3d
I am open for suggestions of different palettes,that is used for landscapes,LUT of colors use by heightmap
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on August 20, 2019, 12:38:35 AM
>that is used for landscapes

Yeah, you can move with cursor keys. :thumbsup:

> you wanna go 3d
Yes, I did

I have a lot of things that I will gradually uploading
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: HSE on August 20, 2019, 01:07:34 AM
 :thumbsup:
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on August 24, 2019, 11:29:55 PM
Burning logo
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on September 02, 2019, 05:11:49 AM
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.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on September 16, 2019, 02:31:01 AM
Hello, I'm uploading the 4th chapter, for graphics files. At the moment only in the Spanish version (http://abreojosensamblador.epizy.com/?Tarea=5&SubTarea=4), though I will upload it soon the English (http://abreojosensamblador.epizy.com/?Tarea=5&SubTarea=4&Lang=1&nivel=0&padre=0&accion=0) 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.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: HSE on September 24, 2019, 08:27:14 PM
Hi caballero!

In calWM01 and 02 in MASM:
Code: [Select]
.DATA?
  CommandLine   DD          ?
  wc            WNDCLASSEX  <>
  MainhWnd      HWND        <>
  MainHdc       HDC         <>

must be:
Code: [Select]
.DATA?
  CommandLine   DD          ?
  wc            WNDCLASSEX  <>
  MainhWnd      HWND        ?
  MainHdc       HDC         ?

Regards,
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: TimoVJL on September 24, 2019, 09:20:35 PM
Fix for TinyC example BMP8bitsWC01.c
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
...
// Variables globales
DWORD              *pMainDIB    = NULL;  // line 48
...
      *(pMainDIB+index) = *(DWORD*)(miBMP->data + k);   // Lo pasamos a pantalla line 116
after that msvc, clang and Pelles C compiles it.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on September 25, 2019, 12:07:11 AM
Hello

@HSE
Ok, thank you. I had to look where these files were :)

@TimoVJL
Yes, thank you. In fact, it should be this way, but I like more the other one:

Code: [Select]
*(pMainDIB+index) = (miBMP->data[k].Rojo<<16) |
                    (miBMP->data[k].Verde<<8) |
                     miBMP->data[k].Azul;
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on September 25, 2019, 04:17:39 AM
uploaded the fixed codes and bmp and tga versions for masm32 at the moment, and a 8 bitmap from resources also.
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on September 28, 2019, 11:10:26 PM
hello, I have uploaded nearly all the masm32 versions: readers for bmp, pcx, tga, ppm for files and in resources, 8 and 24 bits. Only lefts writing gif and the tiny raytracer. And the versions for the other compilers.

Martik C (https://www.youtube.com/watch?v=wobrgx4e1Lw&list=RD6bgW6i-AqPM&index=6) :eusa_boohoo:
Title: Re: SWGPTG - 02 - Drawing Basic Shapes
Post by: caballero on October 17, 2019, 07:18:44 AM
To compensate the scam's thread, here it is a tiny game with source, one of the first in history. I believe that Mr Bill Gates did it some decades ago. TinyC source code, 8 kb :thumbsup:

And a great song (https://www.youtube.com/watch?v=QJqxC3RAKtc&feature=youtu.be&t=2635)