Abstract: With the popularity of Android mobile phone systems, various Android applications have sprung up. "Screen mist" is a mobile game software developed based on the Android platform. The software is developed in Java language. The development environment is Eclipse. Its main function is to generate a layer of mist image on the screen, which can be scribbled with fingers in an intuitive way. Show it to users. The "screen mist" mobile game is simple and novel, in line with the characteristics of young people's hobbies.
0 Preface
With the popularity of the Android mobile phone system, more and more people are beginning to contact and use the Android system, and various Android applications related to it have sprung up. However, in order to stand out among thousands of applications, it is necessary to be precise in terms of target positioning. The design concept should be novel and peculiar to make users shine. The operation method should be simple and easy to understand, so that the user can master the use method of the program in a short time. The project "Screen Water Mist" is a simple, novel and in line with the characteristics of young people's hobbies. "Screen mist" is a mobile game software based on Android platform. The software is developed in Java language. The development environment is Eclipse-java system. Its main function is to generate a layer of mist image on the screen, which can be scribbled with fingers. Intuitively presented to the user.
1 Android platform and mobile game related technologies
1.1 Android platform
In recent years, Android has sprung up in the domestic mobile phone market, and it is very popular. With the current mainstream Apple iOS platform and Nokia's Symbian operating system, it has formed a three-country stand in the mobile phone platform. No one thought that the Android platform would develop so quickly. According to the latest statistics released by the US market research agency NPDGroup on November 1, 2010, as of the end of the third quarter, the Android operating system's sales share in the US smartphone market has reached 44%, exceeding Apple's market share for the first time. In China, the number of smart terminals installed with the Android operating system is also growing rapidly. Although there is no detailed statistics, the increase in the number of users has led software application vendors based on the Android system to frequently test water in China.
1.2 Mobile game development
More and more entertainment functions embedded in mobile phone systems, especially various exciting game phones have become part of many people's lives, and people are gradually getting used to using mobile phones as new entertainment tools. More and more people are reveling in the fresh experience brought by mobile games. Due to the portability of mobile phones, mobile games have become popular all over the world with the popularization of mobile phones. By 2003, taking mainland China as an example, mobile phones have played a decisive role in people's lives-the average number of mobile phones per 5 people exceeds that of fixed phones for the first time, and it has become natural for many people to carry mobile phones with them. habit. As of the fourth quarter of 2003, Chinese mobile phone users exceeded the 250 million mark, and mobile phones became the most frequently used communication tool, which in turn detonated the huge market of mobile entertainment.
Nowadays, there are many applications in the mobile phone application market, and the field of game applications is dazzling in many applications. A successful game development can not only be widely circulated among many users, bringing users a high-quality game experience, but also a product that pays off. These mobile game applications can fill the user's time.
2 Design and implementation of screen fog mobile phone games
2. 1 game function analysis
Screen water mist is an art-based creative leisure software. Its biggest feature is creativity. It uses a program to simulate a real phenomenon of fog on the surface of the screen. Use your finger to smear the screen to eliminate water mist to achieve the effect of painting and writing. The completed pattern screenshot is saved as an image for desktop use or sharing with friends. According to the survey and analysis of the current mainstream mobile phone users, on the premise of the realization of the main functions, the software should be beautified and modified as much as possible to create more possible patterns and effects, catering to young mobile phone users who like new, strange and beautiful hobbies and the pursuit of convenience , Simple and fast habits.
2.2 Main system categories
The AcTIvity base class is separate and used to handle user operations. Almost all AcTIvity have to deal with users. The AcTIvity class creates a window. Developers can put the UI on the window created by AcTIvity through the setCONtentView (View) interface. The Activity class is an important part of the Android application life cycle.
The Bitmap class is very important. This class is responsible for using the BitBitmap of the Png format image calling the Background as the background, calculating the screen resolution according to GetScreen and GetWIDTh and Gethigh, and then according to the obtained screen resolution. Corresponding pixel decomposition. The View class is a basic class in Android. Basically, all advanced UI components are implemented by integrating the View class. TextView, Button, LiST, EditText, RaidoButton, Checkbox, etc. are all View classes. View is the base class of all form parts and serves form parts. The form parts here are UI controls. Since the Canvas canvas class is used as a canvas in Android, you can draw anything you want on the canvas. In addition to drawing on the canvas, you also need to set some properties about the canvas, such as the color and size of the canvas. If you want to draw, you must first adjust the brush. After the brush is adjusted, the image is drawn on the canvas so that it can be displayed on the phone screen. The brush in Android is the Paint class, and Paint contains many methods to set its properties. In Android, the main function of the MotionEvent class in this program is to call the method of some sensors that implement the function of balancing water droplets, such as the On-TouchEvent method.
2.3 Design of key functions
2.3.1 Press the essay line drawn on the touch screen
The characteristics of essay line drawing: â‘ need to know the coordinate information to determine where to draw to the screen; â‘¡ because its shape and path are not fixed, you need to provide a draw method to draw itself. Therefore, abstract these graphics and create a Drawing class. Figure 1 is the abstract class diagram. The graphics used for scribing are extended from the Drawing class. If the drawing of the extended class itself is more complicated, rewrite the fingerDown (), fingerUp () and other methods. You can also add some member variables to create the data you need in your own constructor. The "drawing board" is actually a View class, and the onDraw () of this View class is an Android system callback function. With the abstract drawing class Drawing, you can only program for Drawing in the "drawing board".
Figure 1 Class diagram of the program
2.3.2 Get the current screenshot
There is a device called FrameBuffer on the Android mobile phone, and the image information is written to the mobile phone screen through the FrameBuffer. Therefore, the image currently being displayed can be obtained by reading the data in this device.
The device file corresponding to FrameBuffer is / dev / graphics / fb0. Therefore, the screen image data can be read, and the incoming parameter fd is a file descriptor. In this way, you can pass the screen image information read from fb to your own application, thereby obtaining mobile phone screen information.
2.3.3 Using OntouchEvent touch monitoring method to achieve touch scribble
The onTouchEvent method is defined in the View class, and all View subclasses have overridden this method, and applications can use this method to handle touch events on the phone screen. The method prototype is: public boolean onTouchEvent (MotionEventevent). The parameter event is an object of the mobile screen touch event encapsulation class, which encapsulates all information of the event. This object is created when the user touches the phone screen. The return value mechanism of this method is the same as that of the keyboard response event. It also returns true when the event has been completely processed and does not want other callback methods to be processed again, otherwise it returns false. Generally, the following three events are all handled by the onTouchEvent method The processing is only different in the action value in the three cases. When the screen is pressed, the value of MotionEvent.getAction () is MotionEvent.ACTION_DOWN; when the screen is lifted, the value of MotionEvent.getAction () is MotionEvent.ACTION_UP; when the stylus slides on the screen, MotionEvent.getAction () The value is MotionEvent.ACTION_MOVE.
2.3.4 Balance effect of water drops
To achieve the balance effect of water droplets, it is necessary to use the built-in gravity sensor of Android. Current Android phones are basically vertical screens, so in its three-axis definition, the x axis represents the short side of the screen, and the y axis represents the long side, and For games that require a horizontal screen, the long side of the screen is horizontal, and the program calls the long side of the system (y-axis) as the direction control. Since the function application of the acceleration sensor only used in this program is defined in the two-dimensional plane, the upper left of the screen is used as the origin, and the direction of the arrow is positive. From -10 to 10, in units of floating-point numbers. When the phone screen is placed horizontally upward, the value of (x, y, z) is (0, 0, 10); when the phone screen is placed horizontally downward, the value of (x, y, z) is ( 0, 0, -10); when the mobile phone screen is placed to the left, the value of (x, y, z) is (10, 0, 0); when the mobile phone is vertically upward, (x, y, z) The values ​​are (0, 10, 0); by analogy, the law is: the sky is a positive number, and the ground is a negative number. Using the three values ​​of x, y, and z can accurately detect the motion state of the mobile phone.
The Piezoelectric Ceramic sound-generating element, especially a lead-free piezoelectric ceramic sound-generating element, is mainly composed of metal flakes and piezoelectric ceramic flakes. The sound pressure generated by this new structure piezoelectric sounder is proportional to the number of piezoelectric ceramic sheets. By increasing the number of piezoelectric ceramic sheets, the required large sound pressure is easily achieved.
Custom Piezoelectric Components
Custom Piezoelectric Components,PZT Elements Soldered Wires,Element of Piezoelectric,Piezoelectric Elements Crystal
Zibo Yuhai Electronic Ceramic Co., Ltd. , https://www.yhpiezo.com