• Welcome to Dark Bit Factory & Gravity.
 

My 1kb textmode console spinning sphere.

Started by Blacksheep8Bit, February 03, 2013

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Blacksheep8Bit

The concept:

  • Create a popup window with the size (in characters per width and per height, ex: 80x24 which is the normal console width*heighr in characters) of your console, since it's going to be invisible, we have no need to implement a WindowProc function nor a MSG loop, since the user will never interact with this window, so in the WNDCLASSEX we put DefWindowProc as our WNDPROC function or we create and get the hDC from a edit control.
  • Create a OpenGL context for this window.
  • Create a char buffer which will represent the console screen, make it the same size of the window and console (in this case 80x24)
  • Create a intencity/shades table which will contain special characters such as a "block" or a "chess block" to represent the different shades of gray
  • Clear the Window and draw what ever you want (in this case a sphere)
  • Using glGetPixels copy the image on the window to a temp_buffer where you will convert the colors to indexes in your intencity table to a final buffer which is made of chars.
  • Print the char buffer to console
  • Clear the console screen (cls) and SwapBuffers in the window Set the cursor to position 0,0 (which is faster) and SwapBuffers
  • goto 5

The code is made with C and it's compiled using Visual C++ 2010 and Linked under Crinkler to a final size of 1kb.
The sphere is made using Glu's gluSphere, haters gonna hate.
You are permited to copy, use and reuse this code, as long you put my name in the greetings section ;)
This code is licensed under the human rights.

Not really a demo, just a test anyway haha, source code included :).
Challenge Trophies Won:

combatking0

Which version of Windows is this for? I've tried it will XP and it doesn't run.

I can try with Win7 in the morning.
You are our 9001st visitor.
Challenge Trophies Won:

Blacksheep8Bit

#2
Quote from: combatking0 on February 03, 2013
Which version of Windows is this for? I've tried it will XP and it doesn't run.

I can try with Win7 in the morning.
It ran well on Windows 7, I will host some virtual machines tomorrow and test from 2003 to windows 8 to see where I am failing at haha, thanks.
Challenge Trophies Won:

combatking0

The Extended Textmode version is very impressive - I'm going to have to learn how to do this.
You are our 9001st visitor.
Challenge Trophies Won:

Raizor

raizor

Challenge Trophies Won:

Shockwave

It's really smooth and nice.  Well done Blacksheep :)
Shockwave ^ Codigos
Challenge Trophies Won:

Blacksheep8Bit

Thanks guys for the feedback as usual, maybe next week I will be trying to learn how to use 4klang, and maybe my next release will be a 4k haha.
Challenge Trophies Won:

Hotshot

Remind of me Amiga Bong but in fast mode of Spectrum Graphics!  ;D

Kirl

Cool stuff Blacksheep, the extended mode was a bit jumpy but the sphere looked much better with more shades. Instead of using filled blocks, you may be able to use alphanumerical chars for shades too?

Reminds me of "deep throat", an old porn movie which was encoded using ascii chars (youtube clip). I like to think it's from before we could display images on the web, early computer scientists working on the the webs most promising feature of all, internet porn! ;D
www.kirl.nl
Challenge Trophies Won:

Blacksheep8Bit

@Kirl: Actually I was planning to make a more complex shading system, this was just experimental. So bad this year I won't have much free time because of my studies, but somewhere around July I will try to release something good, maybe I can try make an demo for this UDG compo, and I already knew that porn movie LOL.
Challenge Trophies Won:

Chalisque

Having grown up in the days of MSDOS and the 8bitters, I still love what can be done with text mode or a simple display architecture.  I many ways, I find demos that show creativity within tight restrictions more impressive than hollywood graphics when given the full power of modern hardware.

I am playing with operating system designs for fun (reading through Tanenbaum's book and some on LISP and FORTH and other stuff) and when it comes to text mode, I am thinking of doing a composite mode thing (like modern window systems do with graphics).  Eventually, the hope is that it will make a nice toy for people to play once again with the possibilities of old fashioned and retro text modes.

Canopy


works ok here.. win7 x64 / radeon hd 6450

:)