On 3/25/2011 13:39, Torsten Bergmann wrote:
David followed an approach in Smallscript/S# where you were able (beside the usual Smalltalk syntax) to also use a C-Style syntax with braces directly within Smalltalk.
User32::MessageBox(NULL,'Hello','World',0)
was similar to
User32::MessageBox: NULL with: 'Hello' with: 'World' with: 0
Both worked and was accepted by the parser, although the first one looked heretic to most Smalltalkers since you can mix C/Smalltalk syntax the way you like.
We did the same for the OpenGL bindings. The main idea was that transcribing OpenGL code from C to Croquet looked amazingly similar when cascading, i.e.,
"draw a rectangle" ogl glVertex2f(0, 0); glVertex2f(1, 0); glVertex2f(1, 1); glVertex2f(0, 1).
Cheers, - Andreas
So you just attached a DLL to a class
Class name: OpenGLControl extends: UIControl dll: opengl32 fields: context
and you could write:
onCustomDraw: facet |hdc| := thread activeCanvas hDC. ... glClear(GL_COLOR_BUFFER_BIT). glBegin(GL_TRIANGLES). glColor3ub(255, 0, 0). glVertex2i(0, 1). ...
This was open/more familiar to people coming from C/C++ background or when converting C examples to Smalltalk.
Bye T.