Author Topic: Claro-AIR  (Read 23182 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #15 on: October 05, 2013, 08:52:27 PM »
I inserted the following user input statement just before the message loop that causes the crash. My guess at this point is the reason the message loop is crying is that no controls got created which in turn is sending null pointers to it. It looks like the Windows portion of Claro is broken. I'm leaving this in AIR's hands as I'm not sure where to look.

Code: [Select]
var dummy = readLine(stdin)

It may not mean much to most but once this works, one Nimrod program will generate the native GUI C code required to support it on OSX, Linux and Windows.




If you want to give Nimrod a try online using a browser interface, (I can see smiles of tablet owners already) it's one of the many languages supported on compileonline</>com
« Last Edit: October 05, 2013, 11:10:47 PM by John »

kryton9

  • Guest
Re: Claro-AIR
« Reply #16 on: October 05, 2013, 11:49:09 PM »
Quote
If you're going the Virtual route (I run VMWare Fusion on my Macs and have my virtual machines on a portable drive) take a look a Linux Mint 15.  Really nice distro, I've switched all of my Linux stuff to it. Also, Distrowatch has release info for just about every Linux distro that matters.

Since I eventually want to do opengl stuff, I wanted to have hardware 3d acceleration and virtualbox is supposed to support that. So I installed it and debian amd64.

So far, so good. I installed git, cloned Nimrod and just finished building it from source. So far I am getting farther along in Debian than I did with Ubuntu. Did you guys install Babel, the Nimrod package manager?

Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #17 on: October 06, 2013, 12:24:49 AM »
Thanks! That is really a nice way to keep your Nimrod libraries up to date.

Code: [Select]
jrs@laptop:~/nimrod/babel-master$ ls -l
total 404
-rwxrwxr-x 1 jrs jrs 332373 Oct  6 00:13 babel
-rw-rw-r-- 1 jrs jrs    207 Oct  5 11:14 babel.babel
drwx--x--x 3 jrs jrs   4096 Oct  6 00:13 babel-master
-rw-rw-r-- 1 jrs jrs  12080 Oct  5 11:14 babel.nim
-rw-rw-r-- 1 jrs jrs      7 Oct  5 11:14 babel.nimrod.cfg
-rw-rw-r-- 1 jrs jrs    314 Oct  5 11:14 common.nim
-rw-rw-r-- 1 jrs jrs   4031 Oct  5 11:14 download.nim
-rw-rw-r-- 1 jrs jrs   1624 Oct  5 11:14 license.txt
-rw-rw-r-- 1 jrs jrs   8680 Oct  5 11:14 packageinfo.nim
-rw-rw-r-- 1 jrs jrs   8949 Oct  5 11:14 readme.markdown
-rw-rw-r-- 1 jrs jrs    603 Oct  5 11:14 todo.markdown
-rw-rw-r-- 1 jrs jrs   1681 Oct  5 11:14 tools.nim
-rw-rw-r-- 1 jrs jrs   6503 Oct  5 11:14 version.nim
jrs@laptop:~/nimrod/babel-master$ ./babel update
Downloading package list from https://github.com/nimrod-code/packages/raw/master/packages.json
Done.
jrs@laptop:~/nimrod/babel-master$
jrs@laptop:~/nimrod/babel-master$ ./babel install
Installing babel-0.1.0
Building babel/babel using c backend...
config/nimrod.cfg(36, 11) Hint: added path: '/home/jrs/.babel/libs/' [Path]
Hint: used config file '/home/jrs/nimrod/config/nimrod.cfg' [Conf]
Hint: used config file '/home/jrs/nimrod/babel-master/babel.nimrod.cfg' [Conf]
Hint: system [Processing]
Hint: babel [Processing]
Hint: httpclient [Processing]
Hint: sockets [Processing]
Hint: os [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: times [Processing]
Hint: posix [Processing]
Hint: openssl [Processing]
Hint: parseurl [Processing]
Hint: strtabs [Processing]
Hint: hashes [Processing]
Hint: parseopt [Processing]
Hint: osproc [Processing]
Hint: streams [Processing]
Hint: pegs [Processing]
Hint: unicode [Processing]
Hint: tables [Processing]
Hint: math [Processing]
Hint: packageinfo [Processing]
Hint: parsecfg [Processing]
Hint: lexbase [Processing]
Hint: json [Processing]
Hint: version [Processing]
Hint: common [Processing]
Hint: tools [Processing]
Hint: download [Processing]
gcc -c -w -O3 -fno-strict-aliasing -I/home/jrs/nimrod/lib -o babel-master/nimcache/babel.o babel-master/nimcache/babel.c
gcc   -o /home/jrs/nimrod/babel-master/babel  babel-master/nimcache/download.o babel-master/nimcache/tools.o babel-master/nimcache/common.o babel-master/nimcache/version.o babel-master/nimcache/json.o babel-master/nimcache/lexbase.o babel-master/nimcache/parsecfg.o babel-master/nimcache/packageinfo.o babel-master/nimcache/math.o babel-master/nimcache/tables.o babel-master/nimcache/unicode.o babel-master/nimcache/pegs.o babel-master/nimcache/streams.o babel-master/nimcache/osproc.o babel-master/nimcache/parseopt.o babel-master/nimcache/hashes.o babel-master/nimcache/strtabs.o babel-master/nimcache/parseurl.o babel-master/nimcache/openssl.o babel-master/nimcache/posix.o babel-master/nimcache/times.o babel-master/nimcache/parseutils.o babel-master/nimcache/strutils.o babel-master/nimcache/os.o babel-master/nimcache/sockets.o babel-master/nimcache/httpclient.o babel-master/nimcache/system.o babel-master/nimcache/babel.o  -ldl -lm
Hint: operation successful (24985 lines compiled; 1.180 sec total; 42.435MB) [SuccessX]
/home/jrs/nimrod/babel-master/tools.nim -> /home/jrs/.babel/pkgs/babel-0.1.0/tools.nim
/home/jrs/nimrod/babel-master/readme.markdown -> /home/jrs/.babel/pkgs/babel-0.1.0/readme.markdown
/home/jrs/nimrod/babel-master/babel.nim -> /home/jrs/.babel/pkgs/babel-0.1.0/babel.nim
/home/jrs/nimrod/babel-master/license.txt -> /home/jrs/.babel/pkgs/babel-0.1.0/license.txt
/home/jrs/nimrod/babel-master/babel.babel -> /home/jrs/.babel/pkgs/babel-0.1.0/babel.babel
/home/jrs/nimrod/babel-master/babel.nimrod.cfg -> /home/jrs/.babel/pkgs/babel-0.1.0/babel.nimrod.cfg
/home/jrs/nimrod/babel-master/babel.babel -> /home/jrs/.babel/pkgs/babel-0.1.0/babel.babel
/home/jrs/nimrod/babel-master/packageinfo.nim -> /home/jrs/.babel/pkgs/babel-0.1.0/packageinfo.nim
/home/jrs/nimrod/babel-master/common.nim -> /home/jrs/.babel/pkgs/babel-0.1.0/common.nim
/home/jrs/nimrod/babel-master/todo.markdown -> /home/jrs/.babel/pkgs/babel-0.1.0/todo.markdown
/home/jrs/nimrod/babel-master/download.nim -> /home/jrs/.babel/pkgs/babel-0.1.0/download.nim
/home/jrs/nimrod/babel-master/version.nim -> /home/jrs/.babel/pkgs/babel-0.1.0/version.nim
/home/jrs/nimrod/babel-master/babel -> /home/jrs/.babel/pkgs/babel-0.1.0/babel
/home/jrs/nimrod/babel-master/babel.babel -> /home/jrs/.babel/pkgs/babel-0.1.0/babel.babel
Creating symlink: /home/jrs/.babel/pkgs/babel-0.1.0/babel -> /home/jrs/.babel/bin/babel
babel installed successfully.
jrs@laptop:~/nimrod/babel-master$
jrs@laptop:~/nimrod/babel-master$ ./babel --help
Usage: babel COMMAND [opts]

Commands:
  install      [pkgname, ...] Installs a list of packages.
  build                       Builds a package.
  update       [url]          Updates package list. A package list URL can be optionally specified.
  search       pkg/tag        Searches for a specified package. Search is performed by tag and by name.
  list                        Lists all packages.

Options:
  -h                          Print this help message.
  -v                          Print version information.

jrs@laptop:~/nimrod/babel-master$ ./babel list
argument_parser:
  url:         git://github.com/gradha/argument_parser/ (git)
  tags:        library, commandline, arguments, switches, parsing
  description: Provides a complex commandline parser
  license:     MIT
 
genieos:
  url:         git://github.com/gradha/genieos/ (git)
  tags:        library, commandline, sound, recycle, os
  description: Too awesome procs to be included in nimrod.os module
  license:     MIT
 
jester:
  url:         git://github.com/dom96/jester/ (git)
  tags:        web, http, framework, dsl
  description: A sinatra-like web framework for Nimrod.
  license:     MIT
 
libtcod-nim:
  url:         git://github.com/Vladar4/libtcod-nim/ (git)
  tags:        roguelike, game, library, engine, sdl, opengl, glsl
  description: Wrapper of the libtcod library for the Nimrod language.
  license:     MIT
 
nimepak:
  url:         git://github.com/gradha/epak/ (git)
  tags:        library, serialization, file, compression
  description: File compression routines in C for iOS and Nimrod
  license:     Allegro 4 Giftware
 
nimgame:
  url:         git://github.com/Vladar4/nimgame/ (git)
  tags:        game, engine, sdl
  description: Simple 2D game engine for Nimrod language.
  license:     MIT
 
sfml:
  url:         git://github.com/fowlmouth/nimrod-sfml/ (git)
  tags:        game, library, opengl
  description: High level OpenGL-based Game Library
  license:     MIT
 
enet:
  url:         git://github.com/fowlmouth/nimrod-enet/ (git)
  tags:        game, networking, udp
  description: Wrapper for ENet UDP networking library
  license:     MIT
 
nim-locale:
  url:         git://github.com/Amrykid/nim-locale/ (git)
  tags:        library, locale, i18n, localization, localisation, globalization
  description: A simple library for localizing Nimrod applications.
  license:     MIT
 
fowltek:
  url:         git://github.com/fowlmouth/nimlibs/ (git)
  tags:        game, opengl, wrappers, library, assorted
  description: A collection of reusable modules and wrappers.
  license:     MIT
 
nake:
  url:         git://github.com/fowlmouth/nake/ (git)
  tags:        build, automation, sortof
  description: make-like for Nimrod. Describe your builds as tasks!
  license:     DATWPL
 
nimrod-glfw:
  url:         git://github.com/rafaelvasco/nimrod-glfw/ (git)
  tags:        library, glfw, opengl, windowing, game
  description: Nimrod bindings for GLFW library.
  license:     MIT
 
chipmunk:
  url:         git://github.com/fowlmouth/nimrod-chipmunk/ (git)
  tags:        library, physics, game
  description: Binding for Chipmunk 6.1
  license:     MIT
 
nim-glfw3:
  url:         git://github.com/EXetoC/nim-glfw3/ (git)
  tags:        library, glfw, opengl, windowing, game
  description: A High-level GLFW 3 wrapper for the Nimrod programming language
  license:     MIT
 
nim-ao:
  url:         git://github.com/EXetoC/nim-ao/ (git)
  tags:        library, audio
  description: A libao wrapper for the Nimrod programming language
  license:     MIT
 
termbox:
  url:         git://github.com/fowlmouth/nim-termbox (git)
  tags:        library, terminal, io
  description: Termbox wrapper.
  license:     MIT
 
linagl:
  url:         https://bitbucket.org/TheLonelyByte/linagl (hg)
  tags:        library, opengl, math, game
  description: OpenGL math library
  license:     CC0
 
kwin:
  url:         git://github.com/reactormonk/nim-kwin (git)
  tags:        library, javascript, kde
  description: KWin JavaScript API wrapper
  license:     MIT
 
opencv:
  url:         git://github.com/dom96/nim-opencv (git)
  tags:        library, wrapper, opencv, image, processing
  description: OpenCV wrapper
  license:     MIT
 
babel:
  url:         git://github.com/nimrod-code/babel (git)
  tags:        app, binary, package, manager
  description: Babel package manager
  license:     BSD
 
aporia:
  url:         git://github.com/nimrod-code/Aporia (git)
  tags:        app, binary, ide, gtk, nimrod
  description: A Nimrod IDE.
  license:     GPLv2
 
ipsumgenera:
  url:         git://github.com/dom96/ipsumgenera (git)
  tags:        app, binary, blog, static, generator
  description: Static blog generator ala Jekyll.
  license:     MIT
 
jrs@laptop:~/nimrod/babel-master$

To rebuild babel:

jrs@laptop:~/nimrod/babel-master$ ./babel build
Building babel/babel using c backend...
config/nimrod.cfg(36, 11) Hint: added path: '/home/jrs/.babel/libs/' [Path]
Hint: used config file '/home/jrs/nimrod/config/nimrod.cfg' [Conf]
Hint: used config file '/home/jrs/nimrod/babel-master/babel.nimrod.cfg' [Conf]
Hint: system [Processing]
Hint: babel [Processing]
Hint: httpclient [Processing]
Hint: sockets [Processing]
Hint: os [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: times [Processing]
Hint: posix [Processing]
Hint: openssl [Processing]
Hint: parseurl [Processing]
Hint: strtabs [Processing]
Hint: hashes [Processing]
Hint: parseopt [Processing]
Hint: osproc [Processing]
Hint: streams [Processing]
Hint: pegs [Processing]
Hint: unicode [Processing]
Hint: tables [Processing]
Hint: math [Processing]
Hint: packageinfo [Processing]
Hint: parsecfg [Processing]
Hint: lexbase [Processing]
Hint: json [Processing]
Hint: version [Processing]
Hint: common [Processing]
Hint: tools [Processing]
Hint: download [Processing]
gcc -c -w -O3 -fno-strict-aliasing -I/home/jrs/nimrod/lib -o babel-master/nimcache/babel.o babel-master/nimcache/babel.c
gcc   -o /home/jrs/nimrod/babel-master/babel  babel-master/nimcache/download.o babel-master/nimcache/tools.o babel-master/nimcache/common.o babel-master/nimcache/version.o babel-master/nimcache/json.o babel-master/nimcache/lexbase.o babel-master/nimcache/parsecfg.o babel-master/nimcache/packageinfo.o babel-master/nimcache/math.o babel-master/nimcache/tables.o babel-master/nimcache/unicode.o babel-master/nimcache/pegs.o babel-master/nimcache/streams.o babel-master/nimcache/osproc.o babel-master/nimcache/parseopt.o babel-master/nimcache/hashes.o babel-master/nimcache/strtabs.o babel-master/nimcache/parseurl.o babel-master/nimcache/openssl.o babel-master/nimcache/posix.o babel-master/nimcache/times.o babel-master/nimcache/parseutils.o babel-master/nimcache/strutils.o babel-master/nimcache/os.o babel-master/nimcache/sockets.o babel-master/nimcache/httpclient.o babel-master/nimcache/system.o babel-master/nimcache/babel.o  -ldl -lm
Hint: operation successful (24985 lines compiled; 1.168 sec total; 42.435MB) [SuccessX]
jrs@laptop:~/nimrod/babel-master$
« Last Edit: October 06, 2013, 12:37:04 AM by John »

kryton9

  • Guest
Re: Claro-AIR
« Reply #18 on: October 06, 2013, 01:03:41 AM »
John, my babel from git is missing files. Where did you get your babel sources from?

Quote
k9@deb:~/Nimrod/babel$ ls -l
total 72
-rw-r--r-- 1 root root   207 Oct  6 03:28 babel.babel
-rw-r--r-- 1 root root 12080 Oct  6 03:28 babel.nim
-rw-r--r-- 1 root root     7 Oct  6 03:28 babel.nimrod.cfg
-rw-r--r-- 1 root root   314 Oct  6 03:28 common.nim
-rw-r--r-- 1 root root  4031 Oct  6 03:28 download.nim
-rw-r--r-- 1 root root  1624 Oct  6 03:28 license.txt
-rw-r--r-- 1 root root  8680 Oct  6 03:28 packageinfo.nim
-rw-r--r-- 1 root root  8949 Oct  6 03:28 readme.markdown
-rw-r--r-- 1 root root   603 Oct  6 03:28 todo.markdown
-rw-r--r-- 1 root root  1681 Oct  6 03:28 tools.nim
-rw-r--r-- 1 root root  6503 Oct  6 03:28 version.nim

The compile-online screenshot of Nimrod is neat! Something else to try after I get this going.

Update: The Git Clone is missing stuff. I downloaded the zip file for Babel. Got it working now.
« Last Edit: October 06, 2013, 01:27:51 AM by kryton9 »

Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #19 on: October 06, 2013, 08:57:52 AM »
I used the zip from github to build babel. Glad to hear you got your copy running.


Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Claro-AIR
« Reply #20 on: October 06, 2013, 11:04:37 AM »
FYI, I pushed my changes to the Claro library up to my GitHub space.  You can grab the current version via: https://github.com/Airr/Claro.git

Also, I sort of finished off the TT demo so that now it properly updates as you click the different buttons:

Code: [Select]
import claro, strutils
 
type
  TButtonArray = array[0..9, ptr TButton]

var bTop:cint = 16
var buttons:TButtonArray
var text: ptr TTextArea

proc window_closed (obj: ptr TClaroObj, event: ptr TEvent) {.cdecl.} =
  claro_shutdown()

proc button_pressed (obj: ptr TClaroObj, event: ptr TEvent) {.cdecl.} =
  var buf =""
  var seed:cint = 10
  var button = cast[ptr TButton](obj)
  var multiplyer = cast[int](button.naddress[0])
  for i in 1..10:
    buf &= IntToStr(multiplyer) & " x " & IntToStr(i) & " = " & IntToStr( multiplyer*i ) & "\n"

  textarea_set_text(text,buf)


var Form1 = newWindow( nil, new_bounds( 100, 100, 420, 330 ), 2 )
window_set_title( Form1, "Tiny Times Table" )
object_addhandler( Form1, "destroy", window_closed )

text = newTextArea(Form1, new_bounds(bTop,bTop, 300,300), 0)

for i in low(buttons)..high(buttons):
  var val = intToStr(i+1)
  buttons[i] = newButton( Form1, new_bounds( 334, bTop, 70, -1 ), 0, intToStr(i+1) )
  object_addHandler( buttons[i], "pushed", button_pressed)
  buttons[i].naddress[0] = cast[ptr int](i+1)
  bTop+=30


window_show(Form1)
window_focus(Form1)

claro_loop()

Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #21 on: October 06, 2013, 11:27:33 AM »
Thank You!

We are so fortunate to have a IT professional of your caliber participating in the Nimrod project. You are a model others should follow if open source interests them.


Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Claro-AIR
« Reply #22 on: October 06, 2013, 12:07:17 PM »
I don't know about all that, I just have some free time this weekend and I'm bored....

AIR.

Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #23 on: October 06, 2013, 12:10:09 PM »
Your free time is priceless here.


Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #24 on: October 06, 2013, 12:58:44 PM »


The Claro-AIR built fine on Ubuntu 64 bit. Your fix to TTT is a nice addition.

I think I'll go abuse myself and try this on XP.  :(
« Last Edit: October 06, 2013, 01:04:10 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Claro-AIR
« Reply #25 on: October 06, 2013, 02:53:34 PM »
The MAC portion of Claro throws a lot of warnings, which I'm slowly working through.  Quite a bit of the functions called were deprecated back in OSX 10.3 (Current is 10.9!)

It was also missing the TextArea widget, and setting widget Fonts, which I've added. There are also other items missing, which I'm hoping to address.

Haven't commited the changes yet, still have a lot to clean up.  I'll work through this over the next few weeks, time permitting.

This library has the potential to provide the missing path that may allow various BASICS (and other languages) to provide a Native GUI on the Mac platform.

AIR.


Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #26 on: October 06, 2013, 03:20:49 PM »
That's a good point you made that Claro isn't just a Nimrod thing.


Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #27 on: October 06, 2013, 03:51:20 PM »
@AIR - No change on the Windows XP front with the new build of Claro.  :(

<a href="http://files.allbasic.info/Claro/test.swf" target="_blank" rel="noopener noreferrer" class="bbc_link bbc_flash_disabled new_win">http://files.allbasic.info/Claro/test.swf</a>

Quote
About Claro Graphics

Claro Graphics ("claro.graphics") is a Graphical User Interface (GUI) platform abstraction
library for C and other languages. Claro Graphics is different to most other graphics
toolkits in that it doesn't try to re-invent the wheel, but rather is a layer above the existing
toolkits available (Win32 API, GTK, Cocoa, ...). The result is that applications look and function
like the user expects on their respective system.

Claro Graphics is a module of the "Claro":http://www.libclaro.org/ framework. Claro aims to
provide a large array of useful tools for software developers that, where needed, use the native OSs
functions to provide faster/cleaner results.

However, it doesn't just end there. We do believe in inventing new systems that make life
easier, so we provide great time-saving options like our advanced layout engine called
"Layout Expression Language (LEL)":intro.html

The simple API of Claro Graphics makes it ideal to use in scripting languages.  We feel
so strongly about this that we're going to strive to support Ruby, Python, and Lua.
This is possible simple because the library consists of very simple C function calls and
simple components.


Where did it start?

Claro was originally started for the open-source rewrite of the "Bersirc":http://bersirc.free2code.net/
IRC client. It seemed like a better idea to write a generic library rather than just writing the client
on 3 different platforms. The existing libraries like Qt and GTK both had flaws on Windows & Mac OS X.
So Claro was born to create a layer over the existing libraries (both graphics and sockets).

Over the years, Claro has had 3 main branches. The first branch was more of a proof of concept, then
came the main stretch as "Claro" (just a GUI toolkit, dispite the original intentions). That branch
ended up hitting a brick wall because of some design flaws, but was kept moving slowly.

In 2005, the "Free2Code":http://www.free2code.net/ IRC network (where Bersirc lives) merged in to
the "AthemeNet":http://www.atheme.net/ Network: the network that houses the development of the
"Atheme IRC Services":http://www.atheme.org/ . It turned out they were also thinking of developing
a library with the original ideas of Claro, so the redesign began: "Claro" became "Claro Graphics"
and their base library became "Claro Base".


The End Of Layout Hell

Claro Graphics uses a very different layout mechanism from other GUI toolkits.
In Claro Graphics you can code your entire GUI layout with a single string called
a 'lelex' (think "regex for LEL").  A lelex tells Claro how to layout your components
such that it doesn't matter how you build the interface, what you place in it, or even
how it's sized.

As an example, here's the entire layout from the canvas-test demo:

Code: [Select]
  bounds_t b = { 50, 50, 220, 220 };
  layout *lt = layout_create( "[][_<a|clock|<a][{40}Red|Green|Blue]", b, 10, 10 );

This small set of code replaces reams and gobs of layout, boxing, packing, and containing
code found in other frameworks.  It also make resizing and altering a layout fast and
trivial to deal with.  The @"[][_<a|clock|<a][{40}Red|Green|Blue]"@ contains the
entire lelex for the interface and is quick to learn (unlike regular expressions).


Native Widgets

Claro Graphics uses the native widget set of the platform rather than our feeble attempts
at gray boxes.  Even though it uses the native widgets Claro Graphics tries to be small and
useful without a lot of bloat and every component under the sun.  Instead, Claro Graphics gives
you enough to get 90% of what you want done, and simple tools to add your own components as
needed.

In addition to native components there's also some included libraries to implement
common things not found on many platforms.  Currently "Cairo":http://www.cairographics.org/
is used as the canvas API.


Cut The Crap

Claro Graphics will *never* make you use crap like GTK's gint, weird string libraries, demanding
excessive external libraries, or included crap that has nothing to do with the task of
making a nice user interface.  It'll always use the most normal C possible in order to make
scripting language hooks simpler to implement.

Claro Graphics will also try to play nicely with other libraries (as long as they play nicely in return).


Simplicity First, Security Second

Before you can run you have to walk.  With Claro Graphics we're trying to implement
the simplest GUI library that still provides you with the power you need to
get your job done.  While doing this we hope to include solid coding practices
and simple checks to keep the library safe and secure.  It's not possible
to get rid of all bugs, but we're damn sure going to try.

Some of our strategies are:

  • Heavily use asserts and debugging libraries to prevent bugs and bad usage.
  • Lots of well written documentation.  Can't screw it up if you know how to use it.
  • Unit testing galore.  Yes, you *can* do unit tests in C.
  • Consistent builds and automation for all platforms thanks to SCons.

We Love Scripting Languages

As mentioned before we plan to hook Claro Graphics into several scripting languages.
Scripting languages are notorious for having horrible GUI options.

We think that since Claro Graphics will be very small, very fast, use native components, and
be written in straight clear C, that it would be an excellent library for scripting langauges
to use for a basic GUI platform.


Extra Goodies (If You Like)

Claro Graphics is part of the "Claro":http://www.libclaro.org/ framework, which
provides some useful functions for people who need them in their applications.

We'll always make sure that you aren't forced to use anything you don't want.  The only
Claro component requirement for Claro Graphics is the claro.base library. Otherwise,
you'll never have to compile/distribute sockets/whatever to use graphics.
« Last Edit: October 06, 2013, 07:46:42 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Claro-AIR
« Reply #28 on: October 06, 2013, 09:34:38 PM »
@AIR - No change on the Windows XP front with the new build of Claro.  :(

Try a simple window:

Code: [Select]
import claro

proc window_closed (obj: ptr TClaroObj, event: ptr TEvent) {.cdecl.} =
  claro_shutdown()

var Form1 = newWindow( nil, new_bounds( 100, 100, 420, 330 ), 2 )
window_set_title( Form1, "Simple Window" )
object_addhandler( Form1, "destroy", window_closed )

window_show(Form1)
window_focus(Form1)

claro_loop()


If it still flashes, but doesn't crash, then I think the problem is in the claro_loop function, specifically the call to mssleep().

Code: Text
  1. * Run the Claro main loop */
  2. void claro_loop( )
  3. {
  4. claro_in_loop = 1;
  5.  
  6. while ( claro_in_loop )
  7. {
  8. claro_run( );
  9. #ifndef _NIX
  10. mssleep( 1 );
  11. #endif
  12. }
  13.  
  14. claro_destroy( );
  15. }

Code: Text
  1. void mssleep( int ms )
  2. {
  3. #ifdef _WIN32
  4. Sleep( ms );
  5. #else
  6. usleep( ms * 1000 );
  7. #endif
  8. }

Offline John

  • Forum Support / SB Dev
  • Posts: 3512
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #29 on: October 06, 2013, 09:48:18 PM »
I would have thought that the controls would have shown with my readLine(stdin) debugging statement in place. Is the code being generate for controls that don't exist (yet), maybe that's why the claro_loop() is crashing?

I tired your Simple Window example and it worked fine. (see attached)

« Last Edit: October 06, 2013, 09:57:20 PM by John »