Author Topic: My 1kb textmode console spinning sphere.  (Read 6637 times)

0 Members and 1 Guest are viewing this topic.

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
My 1kb textmode console spinning sphere.
« on: February 03, 2013 »
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 :).
« Last Edit: February 04, 2013 by Blacksheep8Bit »
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: My 1kb textmode console spinning sphere.
« Reply #1 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.
You are our 9001st visitor.
Challenge Trophies Won:

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
Re: My 1kb textmode console spinning sphere.
« Reply #2 on: February 04, 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.
« Last Edit: February 04, 2013 by Blacksheep8Bit »
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: My 1kb textmode console spinning sphere.
« Reply #3 on: February 04, 2013 »
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:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: My 1kb textmode console spinning sphere.
« Reply #4 on: February 04, 2013 »
Very cool BlackSheep :)

K++
raizor

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17406
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: My 1kb textmode console spinning sphere.
« Reply #5 on: February 04, 2013 »
It's really smooth and nice.  Well done Blacksheep :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
Re: My 1kb textmode console spinning sphere.
« Reply #6 on: February 04, 2013 »
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:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: My 1kb textmode console spinning sphere.
« Reply #7 on: February 05, 2013 »
Remind of me Amiga Bong but in fast mode of Spectrum Graphics!  ;D

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: My 1kb textmode console spinning sphere.
« Reply #8 on: February 05, 2013 »
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:

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
Re: My 1kb textmode console spinning sphere.
« Reply #9 on: February 05, 2013 »
@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:

Offline Chalisque

  • ZX 81
  • *
  • Posts: 14
  • Karma: 0
    • View Profile
Re: My 1kb textmode console spinning sphere.
« Reply #10 on: May 15, 2013 »
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.

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: My 1kb textmode console spinning sphere.
« Reply #11 on: May 15, 2013 »

works ok here.. win7 x64 / radeon hd 6450

:)