HTML 5 Canvas for FreePascal/Delphi

I’ve been working on a proof-of-concept for the last couple of hours. With HTML 5 being more and more stable and HTML5 games slowly becoming an alternative to Flash games, I was looking for a way to port existing games for the Web platform.

HTML 5 Canvas seems like a good choice for the graphics output, so began a low-level implementation. At the moment it is just a proof-of-concept, it can just draw different types of shapes in different colors and I’m not sure if I’m gonna develop it any further or even if the way I took was the right one.

Currently it works like this: Compile an example with

fpc -Mdelphi filename.dpr

or

fpc -Mobjfpc filename.dpr

which results in a compiled executable. Execute it and you get a html- and a javascript-file. Just open the html-file and you should see the result.

It comes with three examples. Download here (5 kB)
Every example from https://developer.mozilla.org/en/Canvas_tutorial/Basic_usage and https://developer.mozilla.org/en/Canvas_tutorial%3aDrawing_shapes should work if translated to Pascal.

Read More

Elysion Kronos Nightly build

I’m currently redesigning major parts of the Elysion Frameworks, but I still needed a nice base for all the games I’m going to make until the redesigning process is complete.

So I extended the source from “Colonial Age” slightly, fixed some bugs, improved Lazarus support and you can download the source including a little example project here (3.2 MB).
This base is currently being used for my game TowerManager.

Read More

Using C-ish code in FreePascal

I really like the pascal syntax and I really like C# syntax, so how can I mix those two together? I wrote a parser which can manage that task.

The following snippet looks like a mixture between C#, C++, Objective-C and JavaScript:

namespace testunit;

@interface

using
  SysUtils;

type
  MyClass : class {
  private
    fMyString: String;

    void addMyself();
  public
    function addThat(): int;
  published
    property MyString: String get fMyString;
  }

@implementation

  void MyClass::addMyself();
  {
  	if (fMyString == "") then
  	{
  	  fMyString = "This is my string.";
  	}
  	else
  	{
  	  fMyString = "This is my new string.";
  	}
  }

  function MyClass::addThat(): int;
  {

  }

@end

Read More

Elysion Frameworks: Structural changes

As for now, the different branches of the Elysion Frameworks consisted of just one single unit (e.g. ElysionLegacy.pas), but this is gonna change (or already has changed but is not commited to the SVN repository).
Why is this change necessary?
- I got to the point of nearly having ~150 kB code in one unit. It got a bit difficult to manage to say the least
- I’m in the progess of adding Irrlicht as a backend and found me in desperate need of an abstraction layer. The defines alone just won’t cut it.

elysionunits

Elysion Frameworks = This is just an example for an unit (ElysionKronos, ElysionLegacy, ElysionMobile)
ElysionTypes = Basic types like TelPoint, TelVertex and so on
ElysionInterfaces = Contains abstract interfaces
ElysionMath = Arithmethical functions for basic types, espacially for older Delphi versions (earlier than Delphi 2005), but can also be used to combine TelPoint with TelVertex or an array of TelRGBColor
ElysionClasses = Basic classes like TelObject, TelLogger and so on

The backends can also be combined for example using SDL_mixer with Irrlicht graphics engine or using SDL graphics backend with IrrKlang.

Read More

Irrlicht for (Free)Pascal: Progress

I wasn’t actually thinking I would continue my Irrlicht port since it was kinda just an experiment. But hey, I’ve updated IrrlichtWrapper to Irrlicht 1.6 and got it working on a Mac.

irrpasmacos

I’ve just registered this as a project on sourceforge: http://sourceforge.net/projects/irrlichtpas/
Feel free to check out the source code on SVN.

Btw: I’m in the progress of adding Irrlicht as a backend for the Elysion Frameworks.

Read More