ARCHIVE > Cobra
Cobra 'mini'
GrahamK:
A new little teaser for you, just to show I'm taking demo coders seriously :||
I've started on a 'bare bones' engine, based around the ptc stuff I've seen in other parts of the forum.. It's pretty basic at the moment, but it runs shocky's raster code reasonably well so far, while still retaining a lot of cobra functionality (as in core functionality, rather than gfx engine functionality).
At present it provides the ability to create frambuffers and read/write to them on a pixel by pixel basis, that's about it at the moment (full keyboard support is in there though).
Here is an example of the raster code:
--- Code: ---// RASTER EFFECT BY SHOCKWAVE.
// ---------------------------
// FEBRUARY 2007.
// LAME I KNOW, BUT FROM LITTLE ACORNS ETC....!!!!
// updated to test the use of 'cobramini', a new low level lib for cobra.
//----------------------------------------------------------------------------------------------------------------------------------
PROGRAM USES cobramini, KEYSET
//----------------------------------------------------------------------------------------------------------------------------------
CONST XRES = 640
CONST YRES = 480
VAR
GADD : REAL =0
GADD2: REAL =0
GADD3: REAL =0
v,r,j:integer
//----------------------------------------------------------------------------------------------------------------------------------
PROCEDURE INITIALISE()
BEGIN
OPENSCREEN( XRES , YRES)
END
//----------------------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------------------
// MAIN PROGRAM
//----------------------------------------------------------------------------------------------------------------------------------
VAR
Y : INTEGER
RD,GR,BL : REAL
t1,t2,d:real
frames,fps:integer
ImagePointer:integer
BEGIN
INITIALISE()
frames = 0
t1 = millisecs
WHILE NOT KEYDOWN (VK_ESCAPE)
GADD=GADD+1
GADD2=GADD2+2
GADD3=GADD3+3
if Millisecs-t1< 1000 then
inc(frames)
else
fps = frames
frames = 0
t1 = millisecs
endif
ImagePointer = currentmembuffer
FOR Y=0 TO YRES-1
RD = 125+((SIN(Y+GADD3)*50)+(COS(Y+GADD2)*50)-(SIN(Y+GADD)*24))
GR = 125+((SIN(Y+GADD2)*50)+(COS(Y+GADD)*50)+(SIN(Y+GADD3)*24))
BL = 125+((SIN(Y+GADD)*50)-(COS(Y+GADD3)*50)-(SIN(Y+GADD2)*24))
r = ToRGB(rd,gr,bl)
v = ImagePointer + (y*xres*4)
j=xres
asm
@mov eax,[!r]
@mov ecx,[!j]
@mov edi,[!v]
@rep stosd
endasm
NEXT
FLIP
WEND
MessageBox('FPS:'+fps)
END
--- End code ---
Nice thing is, it also compiles down much smaller, ok not the 40k you can get with freebasic, 271k which is still a quarter of the usual exe size for cobra.
So, the question is... If I develop this further, what features would you, as demo coders, want in there ? (remembering that I would want to try and keep this as a low level library).
Things on the list so far (note excessive use of the word "simple")
1. Simple sound engine (probably just mod's, maybe wave files)
2. Simple drawing commands (including writing text to a buffer, as that can be a pain)
3. Simple image loader (probably restricted to bmp, or at a push include png)
I've attached the above code as an exe for you to have a look at.
Shockwave:
That runs at around 540fps here, that's more than acceptable :D
As for what features, I don't just want to spout off a load of things here, I need to think about this, and post back later or tomorrow, but two things that spring to mind immediately are the ability to draw windows fonts and music playability with some way of monitoring the sound levels in the sound channels...
I could see it getting some fans :)
Btw, is this packed already? Upx says it is :)
GrahamK:
Cobra includes it's own packer as part of it's build.
Working on getting hold of a 'mod' module, not sure on monitoring the sound levels (but I know what you are getting at ;) ) Fonts drawing "shouldn't" be an issue.
But have a good think, I'm not rushing at this, its been more of a diversion at the moment. But I'm willing to put some effort in if it's something people like.
Clyde:
Thats way cool, grand job Graham dude.
btw, 413 Fps.
GrahamK:
Ok, I've included support for XM playback, thanks to the most excellent uFMOD :D
Also added limited text output (no control as yet, just basic text output to screen).
Updated download demo up on the first post....
Navigation
[0] Message Index
[#] Next page
Go to full version