Graphics Programs Reference
In-Depth Information
handle the matrix update code. Such innovations help make efficient use of space on
a mobile screen.
Figure 2-5 . Translation using UI: Screen
Note Every visual element (that inherits from View ) in an Android
application can be assigned a touch listener using the
setOnTouchListener method. This method registers a listener
for the callback method onTouch , which is invoked when a touch
event is sent to this visual element. The onTouch method takes two
arguments (of type View and MotionEvent ). The View argu-
ment is for the view (visual element) that the touch event has been
dispatched to, whereas the MotionEvent argument contains full
information about the event (for example, the x and y coordinates of
touch, which are accessed using the getX() and getY() methods
of the MotionEvent class).
After translation, rotation is the most commonly used geometric transformation in
games. Graphic rendering APIs allow us to associate rotation matrices with objects,
just like the translation matrices. Like translation, rotation is implemented in a vari-
ety of ways. We can logically divide the screen for clockwise-anticlockwise spins,
 
Search WWH ::




Custom Search