Development from J2ME Symbian Game (1)

xiaoxiao2021-04-04  253

I believe that this piece of mobile game development is J2ME, one is because it is easy to learn, the second is because there are more information about it.

After all, J2ME is running on the kernel of Symbian OS. The speed is also inevitable, and it is more unbearable that it puts a lot of interactions with the underlying, and does not provide interface to let you visit.

This is really unbearable for people who like to ask me to ask for a low, I am really unbearable!

In fact, I truly understand Symbian OS and the corresponding Series 60. If the game is developed on this platform, Series 60 is not much higher than J2ME. Because it provides an AppARC, it also encapsulates some underlying things, but at least we can have interfaces to access the low-level thing.

Below I will summarize the study in the last period of time:

(1) About development tools

It was originally unnecessary to write this, but I saw the articles of the tools on the online five-flowers, and the articles installed in the tool are really impossible to clarify.

In fact, there is no need to get trouble for choosing what IDE, whether it is Moblie Borland C , VC, VC.NET, CodeWarrior or NOKIA's recent push carbide.c , they all have such problems. There is no perfect development tool, and the SERIES SDK also provides different versions for each development tool. It is a bit "light ass tied belt ----- more than one". IDE can only be used to see the source code or write code, really useful or the command command under SDK, don't be afraid of trouble, these are often the most important.

The order is also common to use:

BLDMAKE BLDFILES

Abld build Wins UDEB

EPOC

Makesis

DEVICES

(2) About keyboard interaction

No matter what kind of game, you can't interact with users, and for mobile devices. Nothing to interact with users is a keyboard. The button event is a system event. Once the key on the device keyboard is pressed, the button event will be generated when pressed, press and holds or releases.

Symbian's Window server passes the button event to the application via the control stack. Then use the OFFERKEYEVENTL () method of calling the control to notify the corresponding control. This is the same as we in J2ME to notify the corresponding Canvas class through key events through KeyPressed (int keycode).

OK, we have the first class relationship now:

Symbian's OfferKeyEventl () J2ME's KeyPressed (int keycode)

Of course, this method in Symbian has some differences in special instructions.

The control stack in Symbian is a structure and is responsible for maintaining the control. When the button event occurs, this button event is passed from the top of the control stack to the bottom until a control is obtained. By default, the control is not in the stack, so you should add the control to the control stack using the corresponding function Caknappui :: addTostAckl (), allowing it to process the button event.

This is different from our J2ME. J2ME KEYPRESSED (INT Keycode) is associated with the corresponding Canvas. Try to imagine if you switch from an from Advanced UI to the low UI of Canvas, is it necessary to use the command command to control?

Then you can pass the button event to the control by calling the control's OfferKeyEvent1. The control can decide whether to handle a button event. If the event is handled, return the value ekeywasconsumed, otherwise returns EkeywasNotconsuMed. The button event will pass to each of the control stacks in the order until some control returns EkeywasconsuMed or there is no residual control. OfferKeyEventL () has two parameters: a key event (Const ekeyevent & akeyevent), button type (TEVENTCODE ATYPE). The former indicates which key and other keys are the keys, the latter is an EMNU type, which describes the type of button event.

Unlike us in J2ME, J2ME uses three methods to represent Pressed, Released, Repeated. In Symbian's parameters of an EMNU type, the type of button event is: EEVENTKEYDWON, EEVENTKEY, EEVENTKEYUP.

It is impossible to explain the problem with the following code.

TKEYREPONSE CMYCONTROL :: OfferKeyEventl (const tkeyevent & akeyevent, teventcode atype) {

IF (atype == EEventKeyup) {

Switch (akeyevent.icode) {

Case ekeyupArrow:

// product

Return ekeywasconsumed;

Case ekeydownArrow:

// product

Return ekeywasconsumed;

DEFAULT:

Return ekeywasnotconsumed;

}

}

Return ekeywasnotconsumed;

}

转载请注明原文地址:https://www.9cbs.com/read-131832.html

New Post(0)