Author Topic: 256 CubeTro  (Read 989 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1334
  • Karma: 106
    • View Profile
    • http://www.secretly.de
256 CubeTro
« on: March 16, 2007 »


Some time ago, there was an PB compo, creating an program in max 256 lines and using only one : each line... here is the result a very good friend and me created :)

www.secretly.de/public/256_CubeTro.zip  (source including exe)

The goal was not to have an readable source... our goal was to beat the limit and showing great stuff in just so few and crypted lines :D

Code: [Select]
Prototype glOrtho(a.d,b.d,c.d,d.d,e.d,f.d)
Prototype gluPerspective(a.d,b.d,c.d,d.d)
Global glOrtho_.glOrtho = 0*OpenLibrary(0, "OpenGL32.dll") + GetFunction(0, "glOrtho"), gluPerspective_.gluPerspective = 0*OpenLibrary(1, "glu32.dll") + GetFunction(1, "gluPerspective"), StartTime.d = GetTickCount_(), pfd.PIXELFORMATDESCRIPTOR\dwFlags = #PFD_DOUBLEBUFFER | #PFD_SUPPORT_OPENGL, hdc = GetDC_ (CreateWindow_("edit", 0, #WS_POPUP|#WS_VISIBLE|#WS_MAXIMIZE,0, 0, 0 , 0, 0, 0, 0, 0) ) 
t=SetPixelFormat_ (hdc, ChoosePixelFormat_ ( hdc, pfd) , pfd ) + wglMakeCurrent_ (hdc, wglCreateContext_(hdc) ) + ShowCursor_(#False) + InitSound() + InitModule() + LoadModule(0,"data\tune.mod") + PlayModule(0)  + glClearColor_(0.4,0.0,0.6,0.0) + glViewport_(0.0,0.0,GetSystemMetrics_(0),GetSystemMetrics_(1)) + glMatrixMode_($1701) + glLoadIdentity_() + gluPerspective_(45.0,800.0/600.0,1.0,500.0) + glMatrixMode_($1700) + glEnable_($0B44) + glEnable_($0B71) + glDepthMask_(1) + glDisable_($0B44)
Procedure OGLRect(x1.f, y1.f, x2.f, y2.f, r.f, g.f, b.f)
  t = glMatrixMode_($1701) + glLoadIdentity_() + glOrtho_(0,1024, 0,768,-2048, 2048) + glMatrixMode_($1700) + glLoadIdentity_() + glColor3f_(r, g, b) + glRectf_(x1, y1, x2, y2) + glMatrixMode_($1701) + glLoadIdentity_() + gluPerspective_(45.0,800.0/600.0,1.0,500.0) + glMatrixMode_($1700)
EndProcedure
Procedure CreateCube( x.d, y.d, z.d)
  Protected dRotate.d = (GetTickCount_() - StartTime) / 10, t = glLoadIdentity_() + glTranslatef_(x.d,y.d,z.d) + glRotatef_(dRotate, dRotate,dRotate, 0), *datad.Double = ?dat_cube
  For loop = 0 To 1 + (0 * ((loop < 2) And glBegin_(Int(PeekD(*datad)))))
    For i = 0 To (Int(PeekD(*datad+8))-1) + 0 * (((Not (Abs(PeekD(*datad+16+32*i)-1) < 0.01)) + (Not (glColor3dv_(*datad+24+32*i)))) And glVertex3dv_(*datad+24+32*i)) 
    Next
    *datad + (16 + Int(PeekD(*datad+8)) * 32) + 0 * (glEnd_())
  Next
EndProcedure
Procedure DrawCube(n.l, *p.Double)
  ProcedureReturn (CreateCube(PeekD(*p)+6, PeekD(*p+8)+2.5, -45 + Sin((GetTickCount_()-StartTime)/666)*10 )) + (n > 1 And DrawCube(n-1, *p + 16))
EndProcedure
Repeat
Until (0 * ((0* (glClear_($00004000 | $00000100) + DrawCube(42, ?dat_cube + $3A0) + OGLRect(0, 0, 1024, 100, 0, 0, 0) + OGLRect(0, 668, 1024, 768, 0, 0, 0) + Sleep_(10) + SwapBuffers_ ( hdc ) )))) Or ((GetAsyncKeyState_(#VK_ESCAPE) And ShowCursor_(#True)) And TerminateProcess_(GetCurrentProcess_(), 0))
dat_cube: ! dq   7.0, 10.0, 1.0, 1.0, 0.0, 0.0, 2.0, -1.0, 1.0, 1.0, 2.0, 1.0, 1.0, 1.0, 2.0, 1.0, 1.0, -1.0, 2.0, -1.0, 1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 2.0, -1.0, -1.0, 1.0, 2.0, -1.0, -1.0, -1.0, 2.0, 1.0, -1.0, -1.0, 2.0, 1.0, -1.0, 1.0, 5.0, 18.0, 1.0, 1.0, 1.0, 1.0, 2.0, -1.0, 1.0, 1.0, 2.0, -1.0, -1.0, 1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 2.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 2.0, 1.0, 1.0, -1.0, 1.0, 0.0, 1.0, 1.0, 2.0, 1.0, -1.0, -1.0, 1.0, 0.6, 0.6, 0.6, 2.0, -1.0, 1.0, -1.0, 1.0, 0.1, 0.1, 0.1, 2.0, -1.0, -1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 2.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 2.0, -1.0, -1.0, 1.0, -22.5, 0.0, -20.5, 2.0,-18.5, 2.0, -16.5, 2.0, -14.5, 0.0, -18.5, -2.0, -16.5, -2.0, -20.5, -4.0, -22.5, -6.0, -20.5, -6.0, -18.5, -6.0, -16.5, -6.0, -14.5, -6.0, -10.5, 2.0, -8.5, 2.0, -6.5, 2.0, -4.5, 2.0, -2.5, 2.0, -10.5 ,0.0, -10.5, -2.0,-8.5, -2.0, -6.5, -2.0, -4.5, -2.0, -2.5, -4.0, -10.5, -6.0, -8.5, -6.0, -6.5, -6.0, -4.5, -6.0, 4.5, 2.0, 6.5, 2.0, 8.5, 2.0, 10.5, 2.0, 2.5, 0.0, 2.5, -2.0, 4.5, -2.0, 6.5, -2.0, 8.5, -2.0, 2.5, -4.0, 10.5, -4.0,  4.5, -6.0,  6.5, -6.0, 8.5, -6.0

This was my first experience with OGL but sadly i didnt continue with OGL and forgot all the stuff :(
Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows7 x64
http://www.secretly.de
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4130
  • Karma: 223
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: 256 CubeTro
« Reply #1 on: March 16, 2007 »
Like it! Thanks for sharing the source, va!n !
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7145
  • Karma: 69
    • View Profile
Re: 256 CubeTro
« Reply #2 on: March 16, 2007 »
Nice one Vain :)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1334
  • Karma: 106
    • View Profile
    • http://www.secretly.de
Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows7 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 16787
  • Karma: 439
  • evil/good
    • View Profile
    • My Homepage
Re: 256 CubeTro
« Reply #4 on: March 16, 2007 »
That runs really nice and smooth Va!n ! Great to see demo stuff in Purebasic and the music was cool too!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4130
  • Karma: 223
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: 256 CubeTro
« Reply #5 on: March 16, 2007 »
@va!n:

Ahh .. ok .. the purebasic-lounge helt that contest. N1! Should visit
the lounge more often ... but time is limited you know ;)
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline rdc

  • Pentium
  • *****
  • Posts: 1480
  • Karma: 138
    • View Profile
    • Clark Productions
Re: 256 CubeTro
« Reply #6 on: March 16, 2007 »
Nice little intro.

Offline va!n

  • Pentium
  • *****
  • Posts: 1334
  • Karma: 106
    • View Profile
    • http://www.secretly.de
Re: 256 CubeTro
« Reply #7 on: March 17, 2007 »
Thanks to see you guys liked it. thx :)
Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows7 x64
http://www.secretly.de
Challenge Trophies Won: