Kuix source code analysis 1

Source: Internet
Author: User

Kuix is an open-source project for kalmeo's j2-based graphics;

 

As a graphics library, it has several standard configurations:

 

A basic canvas. This canvas is called kuixcanvas. It belongs to the package org. kalmeo. kuix. Core;

 

An interface. A wide range of graphic class libraries on the canvas all implement the same interface or inherit from the same adapter class;

This adapter class is called a widget; it belongs to the package: org. kalmeo. kuix. widget;

 

How does kuixcanvas pass button events or touch screen events to widgets? Kuixcanvas's response to key events is handled by processkeyevent. processkeyevent converts a key event to a key value defined by kuix based on the key value table of kuix, and then works with the key type, put in an int [], and finally added to a vector. This vector is called keyevents;

Processing of touch screen events is handled by processpointerevent and added to pointerevents;

 

Kuix defines its own key-value table to be compatible with different mobile phone platforms. It also defines some specific key-value tables through platform recognition;

Kuix supports Moto, Nokia, Samsung, Sony Ericsson, and sun;

 

In kuixcanvas, A workertask processes keyevents and pointerevents. it traverses the entire vector, obtains the focusmanager, and uses the focusmanager to process events;

 

If (! Keyevents. isempty () if not empty <br/> for (INT I = 0; I <keyevents. size (); ++ I) traverses keyevent <br/> int [] keyevent = (INT []) keyevents. elementat (I); Retrieve keyevent <br/> focusmanager = desktop. getcurrentfocusmanager (); get the current focus manager; <br/> focusmanager. processkeyevent (byte) keyevent [0], keyevent [1]) Let the focus manager handle this event; <br/> repaintnextframe (); redraw; <br/> keyevents. removeallelements (); clear; 

 

In focusmanager, the event processing method of the current focus widget is called:

Focusdwidget. processkeyevent ();

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.