![]() |
Version 1.0 Beta 2 The surface on which you can draw. |
The component looks like this on the component palette
Description
TIvorySurface represents a surface on which you can draw. There are three kinds of surfaces in Ivory Draw. The primary surface represents the screen. Do not draw directly on the primary surface, use the backbuffer surface instead. The backbuffer surface is the surface on which you draw instead of the screen. Later, you can copy the backbuffer surface to the screen. This technique is called double buffering.
The third kind of surfaces is the off-screen surface. Use off-screen surfaces to prepare frequently used objects. An off-surface then can be copied to the backbuffer surface, or to another off-screen surface. The copy operation between surfaces is extremely fast.
You can have as many off-screen surfaces as you want. On the contrary, you can only have one primary and one backbuffer surface in your application at the same time.
A surface can automatically clear the background, or draw a bitmap in the background. A surface can also draw a map. In Ivory Draw, map is a 2-dimensional array of small images. Use a map to draw the scene of a game. Here is an example of a map:
To use a map, you must assign a TIvoryMapper component to the Mapper property. The mapper component holds the small images from which the map is drawn. In the upper example, the mapper component holds the image of the green background, the wall, the box, the box storage, and the player. You can refer to these images by their index. Use the Map property to define the map. You can define a map by setting up an array of image indexes. Each element of the array refers to an image by its index. If you want to leave an empty tile in the map, use a negative number in the Map array. You can also use the OnGetMap event instead of the Map array, but that's slower.
Hierarchy
TObjectTPersistent
TComponent
TIvorySurface
Properties
Methods
~TIvorySurface | ||
CopySurface | ||
CreateOffScreen | ||
Paint | ||
RecreateOffScreen | ||
TIvorySurface |
Events
![]() | AfterDrawMap | |
![]() | AfterPaint | |
![]() | BeforePaint | |
![]() | OnChange | |
![]() | OnCreate | |
![]() | OnDestroy | |
![]() | OnGetMap | |
![]() | OnPaint |