PDA

View Full Version : Display "Hello World" Example doesn't work with ClanLib 3.0.0



Paul Jurczak
10-26-2013, 11:26 PM
Hi,

I decided to try ClanLib and started with official tutorial only to find out that Display "Hello World" Example http://clanlib.org/example-display.html doesn't compile. It seems that changes in Canvas class, prevent this line from compiling:


Canvas canvas(window.get_gc());

I tried a few examples from source code download and they work just fine.

Paul

rombust
10-27-2013, 09:51 AM
The line should be:


Canvas canvas(window);

Paul Jurczak
10-27-2013, 03:17 PM
The next line with compile error is:


Draw::line(canvas, 0, 110, 640, 110, Colorf::yellow);

rombust
10-27-2013, 03:42 PM
That tutorial is very out of date!

Maybe someone will send a patch, since all documentation is now included in the SDK ( https://github.com/sphair/ClanLib )

Anyway, all "Draw" functions have been moved onto the canvas.

Therefore, change
Draw::line(canvas, 0, 110, 640, 110, Colorf::yellow);
to
canvas.draw_line(0, 110, 640, 110, Colorf::yellow);

See http://clanlib.org/documentation/3.0/classclan_1_1Canvas.html

Paul Jurczak
10-27-2013, 04:31 PM
Thanks. This creates a window with "Hello World!". There is one more problem: the window can't be closed. I have to kill the process in order to close it.

EDIT

Never mind, it closes with "Esc" key. A little bit confusing for a first program.

rombust
10-27-2013, 04:41 PM
Pressing escape should work though ;)

The example isn't hooking up sig_window_close

Look at https://github.com/sphair/ClanLib/blob/master/Examples/Display/Basic2D/Sources/basic2d.cpp

That "Hello World" example is really out of date. nb. The line "canvas.flush();" isn't required any more

Pap
10-27-2013, 11:12 PM
The only problem with Clanlib (which, in my opinion, is by far the best multimedia SDK out there - and I tested lots of them) is the lack of documentation. I realize, of course, that writing decent documentation (and keeping it up-to-date) is a very time-consuming task. Perhaps a book would be the best solution (as it is the case in other SDKs), plus it will bring some money to the author. I would buy such a book about ClanLib 3 without any doubt. Until then, the only way is to rely on doxygen documentation (which is very limited) and the examples. You can also ask in this forum. Every time I asked I got a helpful solution in a matter of hours. However, I can't bother developers with questions all the time.