Canvas helps us handle lower system events.
The redraw event is the ability to use the low-level API system to have at least the ability to draw the picture.
Startapp () {mycanvas mc = new mycanvas (); Display.SetCurrent (mc);
Public Class Mycanvas Extends Canvas {Public Void Paint (GRAPHICS G) {{// Code of Paint.} ServiceRepaints () Used to force the overcoming event in the queue.
The coordinate system is the coordinate system of the Y-axis of the Dikal coordinate system.
The coordinates are coordinates constituted by the space between pixels and pixels.
Graphics - Canvas SetColor (R, G, B) --Value0 ~ 255Getredcomponent () getGreenComponent () getBuleComponent ()
SetColor (0x00rrggbb) / getDisplayColor ();
Line Drawline (Start X, Start Y, End Y)
Stroke style - graphics.solid, graphics.dottedsetstrokestyle (graphics.solid)
Rectangular DrawRect (Start X, Start Y, Width, Height)
Two parameters after the rounded rectangular DrawroundRect (Start X, Start Y, Width, Height, ArcWidth, Archeight): The rectangle of the rounded corner is wide and high.
Fill rectangular FillRect (Start X, Start Y, Width, Height)
Fill rounded rectangular FillRect (Start X, Start Y, Width, Height, ArcWidth, Archeight)
The front four parameters of curved Drawarc (Start X, Start Y, Width, Height, Arc, over) determine the rectangular range where the arc is located, the fifth decision start angle, the sixth determination of the angle covered by the curved itself.
Fill triangle FillTriangle (X1, Y1, X2, Y2, X3, Y3)
Canvas and screen events handle the CANVAS itself with two states: normal status -Normal full-screen status -ful, screensetfulscreenmode () to set its status.
When the screen is covered by the system screen, Hidenotify () is automatically called when the system screen disappears, and the original screen is restored. SHOWNOTIFY ()
Keyboard Event Process Press the button to raise the keypressed () function, incoming an integer value of the key to raise the keyreleased () function, incoming an integer value representing the key to raise the keyrepeated () function, incoming One represents the integer value of the key; not all machines are supported, haverepeatevents () to ask if the system supports the linkage event.
Keyboard responds to constants defined in the Canvas class: key_num0 ~ key_num9, key_star, key_pound represents 0 ~ 9 numeric keys and Star well keys. Also define a constant associated with GAME keyboard code: Up, Down, Left, Right, Fire, Game_a, Game_b, Game_c, Game_D
GetGameAction () This function passes into the keycode, the function will return to the Game keyboard code Switch (GetGameAction (Keycode)) {CASE CANVAS.LEFT: MOVELEFT ();
GetKeyCode () This function passes to the GAME keyboard code, and the function will return to the keycode represented. And the last function is inversely the reverse function. if (Keycode == getKeycode (canvas.left)) move (); the touch screen event is used to determine if a touch screen event is supported. The touch pen clicks to trigger PointerPressed (), incoming XY coordinates to unnum the thrift PointerReleased (), incoming XY coordinates. Drag Pointerdragged () (some machines can be judged with HaspoIntermotionevents ())