Dark Bit Factory & Gravity
PROGRAMMING => Purebasic => Topic started by: benny! 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.
; *** 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) )
-
Nice one, it makes me want to try and see how small I can make an openGL bmax framework.
-
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.
-
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?
-
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 ...
-
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.
-
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.
-
@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.
-
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.
-
Indeed. And puhh ... glad that I didn't claim it was my code/idea ;D
-
Yep, you might have had a bit of egg on your face if you had've done!