..
An essential feature of development-oriented platforms to mobile devices is to provide extensible model for the production of animated graphics principalmene usually aimed at the creation of video games.
In Java ME, this is implemented through a specification that also includes the management of the life cycle of a game. We will ignore for the moment this issue for the 'overall architecture for the development of the game itself, and Let's go hand in what concerns the animated graphics that are in my opinion the most creative and interesting.
Display, Displayable and Canvas
The heart of the graphics library in Java ME classes Display and Displayable .
The first handles the elements displayed on the screen of the device and the second represents the highest abstraction of these elements, components that are displayed and positioned to 'internal screen.
In this context, the Java ME provides two types of Displayable objects each of which has a different role according to the components that we intend to build or use.
The subclasses of Displayable are fundamental:
The Canvas class instead they implement the Displayable class, but in turn needs a further concretization of the abstract method paint ( Graphics g) where to 'interior is necessary to define the directions of a design to be projected on the screen.
This means low-level graphical programming necessary for realizazzione animations.
Of particular importance is the 'Graphics object to be used in the paint method.
This object provides methods for drawing basic low-level, with which you can draw lines, circles, figures, points etc. ..
We see the main methods:
Once materialized, which is a Displayable object of type Canvas or a screen should display on the screen. To this proprosito comes in the 'object Diaplay which deals to manage the display of elements on the screen. The 'Display object as a singleton , it is not instantiated directly, but you can get a 'request in this way:
public class Demo extends MIDlet {
private Display display;
...
display = Display.getDisplay (this);
...
}
Once you have here is an instance of the main methods we can use:
| |
AutoCAD (eBook)
Creation of architectural structures. At only 29 €. |
| |
VB.NET (Course)
Make Desktop Applications with Visual Basic.. From 49 €. |
| |
Webmaster Advanced (Course)
Become a professional Webmaster. From 39 €. |