
Now that you have a general vision of Croquet, we will begin some lessons about application programming.
We will use the old IDE (Intregated Development Environment) of Squeak (Morphic) because the new IDE: Tweak, more modern and adequate to Croquet, is also in beta-time.
We will make, at this part of the course, many mini-applications, only for understandment of the principles of the language. I hope that you will do each one with us. I hope also that you have created our "standard desktop" having that three 2D windows: Private, Solo and Multi. We will create all the exercices inside the Private space.
The first important thing to say is: sorry 3D lovers, but sometimes 2D is better than 3D. The happy notice is : 3D includes 2D! 3D is 2D having many layers...
If you have many applications inside a space, we can organize their 3D windows in a paralelogram format, like we have in the desktop of Windows, Mac etc. We will have the better of the 2 worlds because, in that classic old interfaces, we can't have an hierarchy under an icon and, using Croquet, one of the "icons" - we call then:"doors" - can be a Local Portal to a space having more "icons" of relatated applications (the "layers" thing). Look how we will organize our exercices inside the Private world (and a comparison with the usual Windows interface to call applications - the Windows desktop):
But how we create and use this odd thing ?
We have learned, at a previous the lesson, how to create 3D windows for 2D projects. We now will learn how to add, for each 3D window, a "door", an image that appears before we click the "plus signal" to open the application/project.
We need to accept some conventions here. Like I am doing my projects using a notebook , I like to use the resolution 1400x1050. But I will create always a centralized and square "form" for any application, having 1050x1050. So, my 3D window will have the extent:1050@1050. We can use the Windows PaintBrush to design the "door" for each project having, this figure also the "attributes": 1050x1050.
If the "door" for the project: Ex1.001.pr is in the file: ex1.jpg, we will have, at the "make function" for the creation of the 3D window of the project, this script:
makeEx1: sp | win3D teaWorld tm pic | tm := TMorphic new initializeOpaque: true extent: 1050@1050. teaWorld := TMorphMonitor new initializeWithWorld: 'Ex1' extent: 1050@1050. teaWorld eventsTo: tm. win3D := TWindow new. win3D translationX: 0 y: 5 z:0. door:= TTexture new initializeWithFileName: 'ex1.jpg'. win3D rectFront: door. win3D contents: tm. win3D closeContents. sp addChild: win3D. ^ win3D.
CODE COMMENTS
Having some doors, to open an application you click in the "plus signal" of the 3D window having its " door". It will open. After this, click in the "arrow down". The "camera" will centralize the project in front of you. For your confort, modify the size of the 2D window Private, dragging the right-inferior corner, to have a square and a better view of the "form" of the application.
How we put this windows in this positions?
Look the red values in the script. They define the position of the 3D window. For each application in the space we have a "make function" for the creation of its 3D window having different coordinates for its position. The distance between each 3D window (having our standard size) is: 5.
Like you can have,sometimes, many "doors", one above the others, for your confort Croquet has the resource of "vertical scrool of doors" - only vertcal at this beta-time.
Step by step:
Using the arrow keys (up or down), or the mouse wheel, you can scroll all the doors of this column.
When you find the application you would like to start, go back a little, and click its "plus signal".
Only to remember, the initializeDefaultSpace has a new line for each new exercice.
initializeDefaultSpace | space | "Create a new space" space := TSpace new. "Make a light" self makeLight: space. "Make a floor" self makeFloor: space fileName:'lawn.BMP'. "Add the 3D windows " self makeEx1: space. self makeEx2: space. self makeEx3: space. self makeEx4: space. "Etc. Etc...." ^space.At the next lesson we will beging to learn application programming.
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
