Sneak peek on Elysion Frameworks
Posted by Johannes Stein on Apr 7, 2009 in Development, Libraries, Linux, Mac OS X, Windows | 2 comments
What are the Elysion Frameworks? It’s a cross-platform wrapper based on SDL (and OpenGL) I’ve been working on since Summer 2005. When I began I felt there was a need for a 2D library where pictures could be sorted via Z coordinates, nice particle effects, lightmaps and what not. I even created a nice little empty sourceforge site for it a few years ago where you can download a really old version.
What changed now? First of all, besides the name change, Elysion Frameworks is splitted in three branches:
- ElysionLegacy: Based on pure SDL with no OpenGL hardware acceleration the purpose of ElysionLegacy is to make a prototype or a small not very feature-rich application/game with the possibility of converting it later to ElysionKronos without changing a single line of code (Progress: Pascal port: ~ 80%; C++ port: ~ 33%)
- ElysionKronos: Much more sophisticated than ElysionLegacy and uses OpenGL featuring lightmaps, Z sorting, camera management, particle effects and all the good stuff. (Progress: ~ 20%)
- ElysionMobile: Specially designed version for mobile devices such as GP2X. (Progress: ~ 2%)
Click on the flash movie to play it. As you can see, the frame rate dropped from Five-hundred-something to about 270 when I recorded the screencast. I never had this much frames under a Linux system, so I the performance issues are gone now.
And here is the code for the application shown in the flash video above (Object Pascal) to demonstrate how easy using Elysion Framworks is:
program image; // The name of this program
uses
// You need ElysionLegacy, well, that's kinda obvious, right?
ElysionLegacy,
// You need SysUtils for the IntToStr function
SysUtils;
const
WIDTH = 640;
HEIGHT = 480;
BPP = 32;
FULLSCREEN = false;
var
Surface: TelSurface; // You have to declare a surface
Sprite: TelSprite; // The sprite we want to display
XPos: Integer = -1;
YPos: Integer = -1;
begin
Surface := TelSurface.Create; // This surface must be created
Sprite := TelSprite.Create; // Logically, we also need to create a sprite object
// if we want to display an image on the screen
// Initializing the windows with a width of 640 pixels,
// a height of 480 pixels and 16 bits per pixel.
// "False" is set not to turn into fullscreen mode.
Surface.Initialize(WIDTH, HEIGHT, BPP, FULLSCREEN);
// Assign our image to the surface
Sprite.Assign(Surface);
// Load the image
Sprite.LoadFromFile('../../media/mech.bmp');
// Set transparency for the image
// Using the option by selecting one pixel from the image
// Another option is to define the color manuelly
Sprite.SetTransparency(makeP2D(0, 0));
Sprite.SetPosition(makeP2D((WIDTH - Sprite.GetWidth) div 2, (HEIGHT - Sprite.GetHeight) div 2));
// Setting the game loop
while Surface.Run do
begin
Surface.BeginScene;
// Press ESC to close the application
if Surface.KeyDown[K_ESCAPE] then Surface.Quit;
if Sprite.GetPosition.X >= (WIDTH - Sprite.GetWidth) then XPos := -1;
if Sprite.GetPosition.X <= 0 then XPos := 1;
if Sprite.GetPosition.Y >= (HEIGHT - Sprite.GetHeight) then YPos := -1;
if Sprite.GetPosition.Y <= 0 then YPos := 1;
// Moving around the image
// As you can see, it's really simple
Sprite.Move(makeP2D(XPos, YPos));
// Draw the image
Sprite.Draw;
// Set the caption and display frames per second
Surface.SetCaption('Elysion Framework Application | FPS: '+IntToStr(Surface.GetFPS));
Surface.EndScene;
end;
// Free the sprite (allright, that sounds like a bad punch line)
Sprite.Free;
Surface.Finalize; // Finally, finalize the surface
end.

Awesome! Please keep working on this.
Das hast du sehr gut gemacht Johannes. Note +1 mit Sternchen.
btw: Kranke Scheiße