VOGONS


First post, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

I found some very old code on my hdd. It was a dos program written in pascal that generates a Mandelbrot fractal. I decided to rewrite it in C and port it in windows and this is what came out.
I used SDL for graphics, but I'd be very interested in writing it with only the default libs that come out with devcpp - mingw. If anyone has some ideas about it and want to share, please post it here.
You can zoom the image selecting a rectangle with the mouse.
Feel free to edit the sources if you want.

Reply 1 of 7, by ChrisR3tro

User metadata
Rank Member
Rank
Member

Hello kekko,

nice programming! If you are interested in using only Windows functions for drawing (GDI) you might want to have a look at my tiny pong clone, which is also written in C using DevCpp. I wrote it to learn how to use graphics and sound routines from the Win32 interface.

If you used GDI functions, your program would only consist of the EXE file, no extra DLLs needed.

That would of course mean, that you'd have to do some Windows programming, e.g. create a window on your own (without SDL) and write a Windows message loop and a callback procedure for your main Window. Maybe you can use the code in my game as a reference.

Best regards,
locutus

for more Retro-related tidbits follow me on X under @ChrisR3tro.

Reply 2 of 7, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

Hi locutus,
Thanks for your help, it's exactly what I was looking for.
I'll try to have a look at it this week-end if I can.
My next attempt will be to port my old 3d engine in windows. I like software renderers and developed some nice and quite fast textured triangle rendering routines (many years ago...).
I was also wondering if an executable can directly integrate sdl routines since sdl is open source; i have to try...

Reply 3 of 7, by ChrisR3tro

User metadata
Rank Member
Rank
Member

Yes, you'd probably have to build SDL from source and statically link it into your program. I believe there's a command-line switch for GCC to do that... "-mstatic" perhaps?

PS: Let me know if something good came out of the merge of your source code with mine ;-)

for more Retro-related tidbits follow me on X under @ChrisR3tro.

Reply 4 of 7, by kekko

User metadata
Rank Oldbie
Rank
Oldbie
Locutus wrote:

PS: Let me know if something good came out of the merge of your source code with mine 😉

thanks man! i had a quick look at your code, it's well written and every aspect is taken into account. One thing, I have some troubles in understanding the flow needed to handle graphics, could you specify how to set up a simple drawing loop with your routines? Is all the needed for graphics contained in render.*?

Reply 5 of 7, by ChrisR3tro

User metadata
Rank Member
Rank
Member

At first it is necessary to create a window. There's a good tutorial about it on winprog.org.

This GDI article on the MSDN should get you there :-)

I suggest you start reading about "Device Contexts", "Bitmaps", "Brushes" and "Rectangles" for an introduction.

http://msdn.microsoft.com/library/default.asp … istart_9ezp.asp

Regards,
locutus

for more Retro-related tidbits follow me on X under @ChrisR3tro.

Reply 6 of 7, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

Since I just bought my first dual-core cpu, I thought of trying to modify this code in order to support multi-threading. It's very messy code and supports just two threads, but I actually see it faster than the single core implementation 😁

Reply 7 of 7, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

the code before splits te screen horizontally and calculates the two parts in two threads; the following one uses SLI instead 😁