Archive for October, 2007

Linux: Problems with panels fixed, Debugger working

Wednesday, October 31st, 2007

This little Linux update resolves the panels issue. You would have had the problem if your desktop environment such as GNOME had a panel in the top or left edge of the screen.

The debugger is now working under Linux. You can now run the application through F5 / Debug, Start, place breakpoints, step through and watch eC expressions. Please keep in mind the debugger (like everything else in this early alpha SDK) is work in progress.

Download

New Linux SDK Release

Monday, October 29th, 2007

An updated version of the Linux SDK is now available:

Ecere SDK 0.41 – Build 17 (Experimental)

It resolves among other things a threading bug which caused the Chess and Fractals samples to segfault on some system.

It also includes those additional samples.

Unicode text display support will work with this release in OpenGL mode, X support is on the way.

I am currently working on a solution to the mouse positioning problem with some window managers setups.

Join us in #ecere on irc.freenode.net

Thursday, October 25th, 2007

I would like to welcome everyone to join us in #ecere on irc.freenode.net.

I hope a dedicated IRC channel will help to slowly build a strong community of contributors, developers and end-users of Ecere technologies.

On eC Properties and Automatic Conversions

Thursday, October 25th, 2007

Today I want to talk to you about eC properties, as well as conversions properties which reveal their true power… As you may know, eC places a lot of emphasis on properties. Properties are sort of half-way between methods and data members. They provide methods to “set” or “get” the property of an object, which is often stored internally in a data member. eC has one of the cleanest syntax for defining properties:

class Pen
{
   Color color;
   public property Color color
   {
      get { return color; }
      set { color = value; }
   }
}

In eC, class constructors never take in any parameters. Instead, eC relies on the initializers passed through instantiation. These can either be data members or properties. Here is how one could set the color property for a Pen object:

Pen pen { red };
Pen pen { color = red };

Although functionally equivalent to Set and Get methods, properties behave exactly like data members (with some limitations, such as not being able to obtain their address). For example,

pen.color = ~pen.color;
pen.color += 10;
pen.color.r = 255;
pen.color = 0xFF0000;
pen.color = { 255, 0, 0 };

These all go through the Set/Get methods to do their work. Notice here that the Color class is an eC Bit Class, which allows to be accessed both as a “unit type”, such as setting it to 0xFF0000, and as a “structure type”, when accessing the r member or using the curly brackets initializers.

The advantages of properties are multiple. First, they allow for instant visual feedback, for example in the case of the Ecere IDE’s Object Designer. The IDE has a property sheet in which you can visualize and change the values of properties, and get instant feedback in the visual designer window. The IDE’s Object Designer is extremely powerful and versatile. Currently, it is only used for the Form Designer, which is itself bundled inside the Window class of the runtime library. However, third parties could easily integrate into it to enable to visually represent and edit their own classes. The property editor as well as the code generation & parsing system will automatically be usable to those ends. This system all relies on the properties and was the original reason for designing eC and the Ecere Component Object Model.

Second, properties present this layer of protection over the data members. A property can be made public whereas the data member actually used to store the property can remain private. Properties can also only contain a Set or a Get method, therefore making it write-only or read-only. A property can also return or set a value which is not stored exactly as such in the class. This brings us to a special case of eC properties, the Conversion Properties.

Conversion properties are specified with only a data type, and no “name”. For example, a Radians property in the Degrees class allows to set a Radians value to a Degrees angle. eC will resolve cascading conversions to convert from one type to another. This is what enables the following magic:

pen.color = ColorHSV { 0, 100, 100 };
pen.color = ColorLab { 53, 79, 66 };
pen.color = ColorCMYK { 0, 100, 100, 0 };

Beautiful isn’t it? But what is really wonderful is that all this is done at compile time. Therefore this is not any slower than providing the color in RGB format, as the eC compiler will do all conversions and store the proper hexadecimal value here for the color. Like most class constructs, properties (including conversions) can be used in any kind of eC data types (structs, classes, units, enums…). However, they play a major role in the Units, to establish the relation between different compatible units, often allowing to perform the same functionality as overloaded operators would in other languages such as C++. It is therefore a very powerful tool which can save considerable amounts of code, since you don’t need to provide the implementation for any operator.

Dynamic Arrays (Similar to C++ std::vector)

Monday, October 22nd, 2007

Here is an early implementation of a dynamic array for Ecere…

It is most likely a interim solution until truer “templates” make an apparition in eC.

Download Array.ec

(Please don’t mind the obscurity of the internals. Like all things, it’s impermanent.)

You would use it as such:

import “Array”

public class ArrayPoint : Array
{
type = class(Point);
public Point * points;
};
void Test()
{
ArrayPoint points { size = 10 };
points.points[0] = { 10, 10 };
points.size = 20;
points.points[19] = { 5, 5 };
delete points;
}

Ecere Chess Source Code

Monday, October 22nd, 2007

3D Chess Here I just decided to share the source code for Ecere Chess with the world…

The 3D chess set is looking quite good, modeled by my friend Gaetan Loyer.
Ecere Chess has a very simple AI, seeing 2 moves of each players ahead…

It doesn’t know anything about openings or endings.

But it will probably still kick your a**.

Here’s the source code.

Linux Executable

Windows Executable

Ecere Communicator

Sunday, October 21st, 2007

Communicator

Here’s a very early version of Ecere Communicator for you to try it out.

(Download Windows Executable – zip’ed / Linux Executable – tar’ed)

Communicator can now let you do instant messaging across the Jabber (including Google Talk), AIM/ICQ and MSN protocols.

For some strange reasons a few people were unable to connect to the MSN network, and an error 923 was returned.

Error 923 is said to be an unauthorized .NET kid passport… If anyone has any insight on what that is? :)

Acovel Update

Sunday, October 21st, 2007

Here’s a screenshot of the Acovel Music Player showcasing Unicode support:

Unicode in Acovel

(Download Acovel 0.01 for Windows / Download Acovel 0.01 for Linux )

Unicode Support

Sunday, October 21st, 2007

Sample Unicode Text Output I am currently implementing Unicode support throughout the SDK. I decided to adopt UTF-8 as the standard encoding for all Ecere API calls as well as the encoding for string literals inside eC files. UTF-8 is wonderfully transparent as it is fully compatible with ASCII. This avoids the nightmare of having two copies of every API such as in the Windows API which decided to adopt UTF-16. String literals in eC can be written without any prefix such as T”string” or L”string”, a fact I really appreciate.

Unicode on Windows is now fully functional, including:

  • Text output
  • International text entry
  • Complex scripts such as Devanagari
  • Right to left such as Arabic and Hebrew
  • Support in 3D video modes (OpenGL / Direct3D)

Now moving on to making Unicode work on Linux, as well as improving general support for the OS.

Some 3D Desktop Toys

Sunday, October 21st, 2007

Searching for what could make a nice little demo of Unicode in 3D, here’s what I came up with:

Hiragana Cube Cube toys to learn hiragana :)

(Source code Windows executable – rar’ed / Linux executable – tar’ed)
(Note: This looks for the Arial Unicode MS font, if it can’t find it you won’t see the hiragana)

I made it float on the Windows desktop using alpha-blending…

Then I got carried away and wanted to see how easy it would be to make something similar to Corey Tabaka‘s color spheres:

Color Spheres (Source code / Windows executable – rar’ed / Linux executable – tar’ed)