Author Topic: auld's 4kb framework for purebasic 4.0  (Read 1254 times)

0 Members and 1 Guest are viewing this topic.

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4130
  • Karma: 223
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
auld's 4kb framework for purebasic 4.0
« on: February 28, 2007 »


Conversion of auld's 4kb framework ported to the current version of
purebasic. attached example file is 2.560 bytes uncompressed.

Code: [Select]
; *** 4K Framework for PureBasic [Win]
; ***
; *** original framework by auld
; *** pb-conversion by benny!weltenkonstrukteur.de
; ***

IncludeFile "OpenGL.pbi"


Procedure do4KIntro()

glClear_(#GL_DEPTH_BUFFER_BIT | #GL_COLOR_BUFFER_BIT);
  glRotatef_(0.5,1.0,1.0,1.0);
glBegin_(#GL_TRIANGLES);
glColor3f_(1.0,0.0,0.0);
glVertex3f_(0.0,-1.0,0.0);

glColor3f_(0.0,1.0,0.0);
glVertex3f_(1.0,1.0,0.0);

glColor3f_(0.0,0.0,1.0);
glVertex3f_(-1.0,1.0,0.0);
glEnd_();

EndProcedure


pfd.PIXELFORMATDESCRIPTOR
pfd\cColorBits  = 32
pfd\cDepthBits  = 32
pfd\dwFlags     = #PFD_SUPPORT_OPENGL | #PFD_DOUBLEBUFFER
hDC = GetDC_ ( CreateWindow_("edit", 0, #WS_POPUP | #WS_VISIBLE | #WS_MAXIMIZE, 0, 0 ,0 ,0, 0 ,0 ,0, 0 ) )
SetPixelFormat_ ( hDC, ChoosePixelFormat_( hDC, pfd), pfd )
wglMakeCurrent_ ( hDC, wglCreateContext_(hDC) )
ShowCursor_(#False);

Repeat
  glClear_ ( #GL_DEPTH_BUFFER_BIT | #GL_COLOR_BUFFER_BIT )
  do4KIntro()
  SwapBuffers_ ( hDC );
Until ( GetAsyncKeyState_ (#VK_ESCAPE) )
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline zawran

  • Sponsor
  • Pentium
  • *******
  • Posts: 886
  • Karma: 63
    • View Profile
    • zac-interactive
Re: auld's 4kb framework for purebasic 4.0
« Reply #1 on: February 28, 2007 »
Nice one, it makes me want to try and see how small I can make an openGL bmax framework.

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4130
  • Karma: 223
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: auld's 4kb framework for purebasic 4.0
« Reply #2 on: February 28, 2007 »
Yup. Never touched bmax. But would be interesting to see how other basic dialect
would compete concerning size.

BTW, I know cab-dropping is a contentious topic among 4kb coders, but I managed
to squeze above application into 888 bytes using this technique ( tool: dropper ).

Example file attached.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline zawran

  • Sponsor
  • Pentium
  • *******
  • Posts: 886
  • Karma: 63
    • View Profile
    • zac-interactive
Re: auld's 4kb framework for purebasic 4.0
« Reply #3 on: February 28, 2007 »
Pretty cool, it should then be possible to make some very small demo/intro stuff with purebasic then. Is there a small mod player for purebasic or would you have to use something like bass or fmod?

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4130
  • Karma: 223
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: auld's 4kb framework for purebasic 4.0
« Reply #4 on: February 28, 2007 »
Pretty cool, it should then be possible to make some very small demo/intro stuff with purebasic then. Is there a small mod player for purebasic or would you have to use something like bass or fmod?


There is no official small modplayer coming with purebasic. PureBasic itselfs uses MIDAS for
playing modules. But there exits of course ports for using other dll's like fmod, bass and so on.

AFAIK ... there exists some user libraries (which are linked statically to your exe) which can
be used for playing mod/xm files. I remember seeing/using libs like miniFMod and/or mxmsound
for purebasic. Even a port of farbrausch' lib2v sound system exists for older versions of
purebasic (I am not aware if there is a version for the actual pb version). All these could fairly
be used to create a 64kb intro in purebasic.

Nevertheless, I guess it wouldn't be small enough for 4kb intros. Like the "normal" 4kb intros
written in C/ASM you need to squeeze a music player / format even more. So the usage of
normal mod/xm sounds wouldnt really fit into it. And that means that you should code a
soundsystem for yourself here ...
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: auld's 4kb framework for purebasic 4.0
« Reply #5 on: February 28, 2007 »
Benny,
great work there and Im sure auld will be pleased to see creds still given to him in your code. Karma++.

.com files and cab dropping is a big no,no at 4k (scene fashion). Unfortunately the defacto compression tool, crinkler, substitutes as the linker in compiling so its not going to work on basic progs I guess. Hmmm. I guess upx is the best bet.

You are right at 4k there is no sound library you can use. You have to write a softsynth.


Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 16787
  • Karma: 439
  • evil/good
    • View Profile
    • My Homepage
Re: auld's 4kb framework for purebasic 4.0
« Reply #6 on: March 01, 2007 »
Nice to see Auld's legendary 4kb framework ported to another language, this is really really cool stuff! So Benny, have some Karma. :) Great work man.
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: auld's 4kb framework for purebasic 4.0
« Reply #7 on: March 01, 2007 »
@TAJ, SW:
Thanks for karma boost  ;)

@TAJ:
Of course, you are right - CAB DROPPING is an absolute NO-GO in the 4kb scene,
but I just tested it out of curiosity. It even does run under WindowsXP only any-
way.

[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 16787
  • Karma: 439
  • evil/good
    • View Profile
    • My Homepage
Re: auld's 4kb framework for purebasic 4.0
« Reply #8 on: March 01, 2007 »
Benny,
great work there and Im sure auld will be pleased to see creds still given to him in your code. Karma++.

And the secret is out as to who Taj really was. I used to chuckle at comments like that.
This framework really is a legacy that will live on until the next generation of computers, if that ever happens.
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: auld's 4kb framework for purebasic 4.0
« Reply #9 on: March 01, 2007 »
Indeed. And puhh ... glad that I didn't claim it was my code/idea  ;D
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 16787
  • Karma: 439
  • evil/good
    • View Profile
    • My Homepage
Re: auld's 4kb framework for purebasic 4.0
« Reply #10 on: March 01, 2007 »
Yep, you might have had a bit of egg on your face if you had've done!
Shockwave ^ Codigos
Challenge Trophies Won: