First-time development

Source: Internet
Author: User
first-time development
I just finished the C language and started to do BlackBerry development. BlackBerry Tablet is a very new product, there is no information on the Internet, its API completely to read English documents. The English-language document, which looked very laborious, read for one months and basically understood the basic structure of the BlackBerry program and the way the event was acquired and processed on the BlackBerry. If you want to create a BlackBerry program, you need to create a context where the function is: #include <screen/screen.h> int Screen_create_context (SCREEN_CONTEXT_T*PCTX, int flags);

Parameters:

Pctx:context pointer;

Flags: Create types, including Screen_application_context, Screen_window_manager_context, Screen_input_provider_context, SCREEN_ Power_manager_context;

Return value: 0 (Window creation succeeded), 1 (window creation failed);

If you need to call the BlackBerry tablet's API, you also need to call a function to initialize its interface:

#include <sys/platform.h>

#include "Bps/event.h"

int bps_initialize (void);

In fact, the BlackBerry does not have its own graphics library, the implementation of the graphical interface is using the OpenGL graphics library, the function of initializing the EGL function is:

#include < bbutil.h>

Bbutil_init_egl ();

Return value: The return value exists and Exit_seccuss indicates failure.

Each BlackBerry program needs to complete the process as above. Writing these parts of the technical class is not about documenting my skills, but about my first object-oriented program. The C language I used was a process-oriented language, and BlackBerry development was my first contact with object-oriented, and it gave me an object-oriented concept. I was also the first to do a graphical interface, and to understand the way an operating system messages are captured and processed.

This is the process of my first BlackBerry program, after I finished the first BlackBerry program, began to do other graphical interface program.

My first BlackBerry program is a maze game, this game I wrote quite a long time, the first time to do development. The procedure is conceived as follows:

The user slides on the screen with his finger, allowing the ball to slide along the finger, but the ball can only slide within a fixed range.

In the first maze, there are a number of small holes, the ball can not be transferred into the small hole, or the game start again.

In the second chapter of the maze, the ball can not be out of bounds, if out of bounds, replay this level. And the line is the screen boundary.

Disclaimer: 1. In addition to the coordinates defined in the system function and the special declaration, the Custom coordinate origin is located in the lower left corner

First, the maze picture size is 1024*600, divides it into the 102*60 square lattice, each square lattice size is 10*10, each square lattice may have two kinds of States, namely the small ball may pass (OPEN) and the small ball not to pass) (CLOSE); Special declaration the left origin of square lattice is in the upper left corner

Second, the ball diameter is set to 30, the ball each time the displacement of the gravity sensor feedback data determined

Third, the initial step: the first step, loading the Start screen picture, as well as running the Start Module Render_begin (), which is also included in the interface of the event processing module, with Game_begin record the game state, that is, whether to open the game

The second step, when the game is on, that is, the Game_begin value is 1 o'clock, run the game module render and the module's Event Processing module handle_events ()

The third step, in the game running interface, click "Exit", return to the start interface, that is Game_begin = 0;

Four, import the second picture, but with "small square lattice" method encountered a problem that can not be solved, so used another method to record the channel, using the function to record the edge trajectory method (later into the function method).

V. Procedure help:

Click on the "Start Game" button to start the game. In the game, with your finger to move the small ball, if the ball out of the screen, then the game failed, again. In the game, you can click "Exit" to return to the start screen. Click "Next Close" or "previous" to go to the previous or next close.

This is my first self-conceived, self-written program. BlackBerry development, brought me into the development of the world, I now do not do BlackBerry development and do Linux development, but the BlackBerry is my first to do the formal development platform, will never forget, perhaps also back to get BlackBerry.

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.