Startup (Personal Translation, please advise) categories and configurations, translation advice

Source: Internet
Author: User
Tags ftp connection libgdx

Startup (Personal Translation, please advise) categories and configurations, translation advice

This article is translated from the official libGDX wiki. For more information, see "region ".
Platforms supported by libGDX:

Each target platform must have a starter class. This class instantiates a later specified Application implementation and an ApplicationListener, which implements the Application logic. The starter class is platform-related. Let's take a look at how to instantiate and configure them.
This article assumes that you have mastered Program Creation, running, and debugging, and have imported the core, desktop, Android, and HTML5 projects to Eclipse.
The creation, running, and debugging of the libGDX program will be introduced in the following blog posts, or you can view relevant documents on the official website.
Desktop (LWJGL) Desktop games
Lwjgl introduction:

Open the Main. java class in my-gdx-game and you can see the following content:
package com.me.mygdxgame;import com.badlogic.gdx.backends.lwjgl.LwjglApplication;import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;public class Main {   public static void main(String[] args) {      LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();      cfg.title = "my-gdx-game";      cfg.useGL30 = false;      cfg.width = 480;      cfg.height = 320;      new LwjglApplication(new MyGdxGame(), cfg);   }}
First, an LwjglApplicationConfigration is instantiated. This class specifies a variety of configuration settings, such as the initial screen resolution, whether to use OpenGL ES 1. X, 2.0, or more.
After this configuration object is set, an LwjglApplication is instantiated. The MyGdxGame () class is the ApplicationListener that implements the game logic;
In this way, a window is created and ApplicationListener is called as in the introduction to the lifecycle.
Android (Android)
Android applications do not use main (the 0 method is used as the entry point, but an Activity is required as the start point. Open MainAcitivity. java in my-gdx-game-android and you will see:
package com.me.mygdxgame;import android.os.Bundle;import com.badlogic.gdx.backends.android.AndroidApplication;import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;public class MainActivity extends AndroidApplication {    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();        cfg.useGL20 = false;        initialize(new MyGdxGame(), cfg);    }}
The main starting point of the game is the onCreate () function in Acitivity. Note that MainAcitivity inherits from AndroidApplication, while AndroidApplication inherits from Acitivity. Like in a desktop program, a configuration object will be instantiated (AndroidApplicationConfiguration ). Once the configuration is complete, the AndroidApplication. initalize () method will be called and an ApplicationListener (MyGdxGame) and Configuration Parameter object will be passed.
Android applications can have different acitifications. However, the libGDX game should have only one Acitivity. Different game scenarios are implemented in libGDX, which is different from the separate Acitivity. The reason for this is that creating a new Acitivity also means creating an OpenGL context for a county, which is time-consuming and means that all image resources will be reloaded.
Fragement-based libGDX
The Android sdk provides APIs for controlling the special part of the screen, which can be easily used on multiple screens. This api is the Fragement api. Libgdx can also be displayed and run in part of a large screen, provided that fragement is used. To create a libgdx fragement, use the subclass AndroidFragementApplication and the onCreateView () method. For example:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {        Plane plane = (Plane) getArguments().get(ARGS_PLANE);        return initializeForView(new MyGdxGame());    }
AndroidManifest. xml file
In addition to AndroidApplicationConfiguration, an Android Application is configured through the AndroidManifest. xml file, which can be found in the root directory of the Android project. The file content is roughly as follows:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.me.mygdxgame"    android:versionCode="1"    android:versionName="1.0" >    <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="15" />    <application        android:icon="@drawable/ic_launcher"        android:label="@string/app_name" >        <activity            android:name=".MainActivity"            android:label="@string/app_name"            android:screenOrientation="landscape"            android:configChanges="keyboard|keyboardHidden|orientation">            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>    </application></manifest>
Target SDK version
It is important to specify a value greater than or equal to 3 for targetSdkVersion. If this application must support running on a system higher than Android1.5. If this attribute is not set, a later Android version will be used to run the program. The resolution of the drawing area is lower than that of the actual screen, which is very bad.
Screen Direction & configuration change
In addition to targetSdkVersion, screenOrientation, and configChanges, these attributes should also be set.
The screenOrientation attribute specifies the screen method of the application. If the application can run normally both horizontally and vertically, this attribute can be left unspecified.
The configeChanges attribute is very important. It should always have a value, that is, it is set. If this attribute is omitted, the application restarts every time the physical keyboard pops up or is hidden or the screen direction changes. If the screenOrientation attribute is ignored, the libgdx program will receive a call to ApplicationListener. resize () to indicate the screen change. In this way, the displayed content is displayed again.
Permissions (permission)
If an application needs to write data to an external bucket (such as an SD card), use a network, use a vibrator, or use a recording, the following permissions must be added to the AndroidManifest. xml file:
<uses-permission android:name="android.permission.RECORD_AUDIO"/>    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>    <uses-permission android:name="android.permission.VIBRATE"/>
Users may often worry about many permissions, so please use them with caution.
To wake up from the locked state, AndroidApplicationConfiguration. useWakeLock needs to be set to true (the source code is set to false by default );
If the game does not need an accelerometer or a compass, we recommend that you set the useAccelerometer and useCompass variables in AndroidApplicationConfiguration to false. (the two variables in the source code are set to true by default)
Live Wallpapers)
LibGDX provides a simple way to create Android live wallpapers. The startup class of a live wallpaper is AndroidLiveWallpaperService. The following is an example:
package com.mypackage;// imports snipped for brevity public class LiveWallpaper extends AndroidLiveWallpaperService {    @Override    public ApplicationListener createListener () {        return new MyApplicationListener();    }    @Override    public AndroidApplicationConfiguration createConfig () {        return new AndroidApplicationConfiguration();    }    @Override    public void offsetChange (ApplicationListener listener, float xOffset, float yOffset, float xOffsetStep, float yOffsetStep,        int xPixelOffset, int yPixelOffset) {        Gdx.app.log("LiveWallpaper", "offset changed: " + xOffset + ", " + yOffset);    }}
The createListener () and createConfig () methods are called either when the live wallpaper is displayed or when the Home page is created.
The offsetChange () method is called when the user slides the screen (switches the screen) on the Home interface. It tells you the offset between the current screen and the intermediary screen. This method will be called in the rendering thread, so you don't have to consider synchronizing anything.
In addition to a startup class, you must create an xml file to describe your wallpaper. Let's name it livewallpaper. xml. Create a folder named xml under the res folder in your Android project, and create a livewallpaper. xml file in it. The content of the file is as follows:
<?xml version="1.0" encoding="UTF-8"?><wallpaper       xmlns:android="http://schemas.android.com/apk/res/android"         android:thumbnail="@drawable/ic_launcher"       android:description="@string/description"       android:settingsActivity="com.mypackage.LivewallpaperSettings"/>
This defines the thumbnail of your live wallpaper displayed on your mobile phone. If you set the current wallpaper in the Android system for your app wallpaper, the description and Acitivity above will be displayed. This Activity is a standard Activity, which can have some dynamic effects, such as the change of Beijing color. You can store these settings in SharedPreferences and then load the stored data through Gdx. app. getPreferences.
Finally, you need to add things to the AndroidManifest. xml file. The following is an example of a dynamic wallpaper containing a simple Activity:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"      package="com.mypackage"      android:versionCode="1"      android:versionName="1.0"      android:installLocation="preferExternal">    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="14"/>     <uses-feature android:name="android.software.live_wallpaper" />    <application android:icon="@drawable/icon" android:label="@string/app_name">        <activity android:name=".LivewallpaperSettings"                   android:label="Livewallpaper Settings"/>        <service android:name=".LiveWallpaper"            android:label="@string/app_name"            android:icon="@drawable/icon"            android:permission="android.permission.BIND_WALLPAPER">            <intent-filter>                <action android:name="android.service.wallpaper.WallpaperService" />            </intent-filter>            <meta-data android:name="android.service.wallpaper"                android:resource="@xml/livewallpaper" />        </service>                      </application></manifest> 
The above manifest file defines:
1. It uses dynamic wallpaper features, for this attribute, please read this blog: http://blog.csdn.net/kent_todo/article/details/37956957
2. A permission to run the bound wallpaper.
3. Set the acitivity.
4. The dynamic wallpaper service is specified in the livewallper. xml file.
Currently, live wallpapers only support Android (api level 7) and later versions.
In this way, the dynamic wallpaper has certain limitations on touch input. Generally, only click and slide events can be responded. If you want to respond to all touch events, you can check the AndroidApplicationConfiguration # getTouchEventsForLiveWallpaper attribute and set it to true to receive all kinds of touch events.
Daydreams (daydream)
Tips: Daydreams is a new feature of Android 4.2. It provides a richer user interaction experience when the mobile phone is idle, that is, it dynamically displays some content during screen lock, and can interact with users.
From Android4.2, you can set Daydreams, which is displayed when the device is idle or stopped. These daydreams are similar to screen saver and can display things like photo albums. Libgdx makes it easier for you to write such a daydream.
The startup class of Daydream is called AndroidDaydream. The following is an example:
package com.badlogic.gdx.tests.android;import android.annotation.TargetApi;import android.util.Log;import com.badlogic.gdx.ApplicationListener;import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;import com.badlogic.gdx.backends.android.AndroidDaydream;import com.badlogic.gdx.tests.MeshShaderTest;@TargetApi(17)public class Daydream extends AndroidDaydream {   @Override   public void onAttachedToWindow() {      super.onAttachedToWindow();            setInteractive(false);      AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();      cfg.useGL20 = true;      ApplicationListener app = new MeshShaderTest();      initialize(app, cfg);   }}
Simply inherit from AndroidDaydream, override onAttachedToWindow, set your configuration parameters and ApplicationListener, and instantiate your daydream.
In addition to daydream, you can provide a setting interface (Acitivity) for users to set your daydream. This can make a common Acitivity, or a libGDX AndroidApplication. Here we use an empty Acitivity as an example:
package com.badlogic.gdx.tests.android;import android.app.Activity;public class DaydreamSettings extends Activity {}
This setting interface must be set in Daydream service as the metadata attribute. Create an xml file in the res/xml directory and specify:
<dream xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="com.badlogic.gdx.tests.android/.DaydreamSettings" />
Finally, add the declaration of the Setting interface and a service description to the AndroidManifest. xml file. For example:
<service android:name=".Daydream"   android:label="@string/app_name"   android:icon="@drawable/icon"   android:exported="true">   <intent-filter>       <action android:name="android.service.dreams.DreamService" />       <category android:name="android.intent.category.DEFAULT" />   </intent-filter>   <meta-data android:name="android.service.dream"       android:resource="@xml/daydream" /></service>
Documents on IOS are not translated for now
 
 
 

System installation instructions

Graphic tutorial on BIOS settings
Www.tsyy.sina.net/bios/bios.htm

How to install a perfect system

I believe that it is not difficult to install the system for those who are at the prawns level, but they just keep clicking "Next! However, it may be difficult for cainiao-level figures.

Today, we will take Windows/XP as an example to show you some experience in installing the system. I hope it will help you.

Before installing the system:

First think about the disk to which the system is attached, and then sort the disk. The sorting mentioned here is to save the useful files in another disk to prevent accidental deletion during formatting. In addition, if the hardware drive disk of your machine cannot be found, we recommend that you use the tool software to save the driver. Master windows optimization can do this.

Note that everything in my documents is counted in drive C. Don't forget to save the files in it.

The path of favorites varies with the system. Generally, there is a folder named after your machine login name under C: \ Documents and Settings. After opening it, you will see the favorites folder and copy it to another disk.

After completing these steps, you can install the system. Restart the computer and press DEL to enter BIOS settings. Some people do not know when to press the DEL key here, so they will tell you a stupid way. As long as you restart, you will always press it. In addition, because of the different motherboard manufacturers, the shortcut keys for entering the BIOS are also different. Some are F2, some are F10, and there are prompts at the low end of the screen during boot.

Do not make any changes after entering the BIOS, because the above items are very important. If you make a mistake, the system may not be connected. We only need to change the drive letter sequence when the computer starts.

It is hard to tell how to find this, because the BIOS settings will also vary depending on the motherboard. Generally, under the BOOT tag, you can use the optical drive to start the computer. There will be related prompts on the right side of BIOS settings. cainiao can follow the prompts. After the installation, do not rush to restart. Put the installation disk into the optical drive, and then press F10 to save and restart.

At this time, you should observe that the computer will first check the optical drive when starting, and a line of characters appears below the screen (the specific English forgot, sweat), that is, let you press any key to enter the disc to start. Click it. The system installation process starts when the optical drive starts to go crazy!

Installing the system:

When I look at the prompts on the screen, I almost don't need to introduce anything because they are all Chinese. First, you need to select whether to install the new OS or repair the system, choose to install the new OS, and then press F8 to agree to those Protocols. The drive letter selection interface appears.

Move the cursor to the drive letter you want to install with the keyboard up and down key. Press the "D" key and the system will prompt you that deleting the drive will delete all the data, regardless of it, press the "L" key to confirm the deletion. After the process is complete, the screen is displayed. Then, select "Install Windows XP on the current disk" (which is not in the original text) and press Enter. The system prompts you to format the disk. Select "quick NTFS mode" for formatting. The formatting interface is displayed. When the progress bar reaches 100%, the computer starts to automatically mount the installation file in the optical drive, about 8 minutes later (depending on the speed of the optical drive), the system restarts automatically.

Note: In this case, you need to remove the installation disk from the optical drive, in order to avoid automatically reading after the reboot.

After restarting, go to the installation page again. At this time, place the installation disk and install it again. You almost don't need to make any settings. Click "Next. However, there is a serial number input process in the middle.

This process takes about 40 minutes, and some information about windowsXP functions will be displayed on the screen. Please pay attention to it. After the installation is complete, the system prompts you to remove the installation disk. After you take it out, restart it. By the way, the BIOS will change the boot sequence back to hard disk boot, and the installation process will basically be completed!
After installing the system:... the remaining full text>

Advice

Many users are not very familiar with the processes on their own machines. Sometimes, they often mistakenly think of virus processes and want to introduce some small system knowledge so that they can use computers easily.
The most basic system processes (that is, these processes are the basic conditions for the system to run. With these processes, the system can run normally ):
Smss.exe Session Manager
Csrss.exe subsystem server process
Winlogon.exe manage user logon
Services.exe contains many system services
Lsass.exe manages IP Security Policies and starts ISAKMP/Oakley (IKE) and IP Security drivers. (System Service)
Generate a session key and assign the service creden。 (ticket) for Interactive Client/Server Authentication ). (System Service)
Svchost.exe contains many system services
SPOOLSV. EXE loads the file into the memory for later printing. (System Service)
Assumer.exe Resource Manager
Pinyin icon in internat.exe Tray

Additional system processes (these processes are not necessary. You can increase or decrease them through the Service Manager as needed ):
Mstask.exe allows programs to run at a specified time. (System Service)
Regsvc.exe allows remote registry operations. (System Service)
Winmgmt.exe provides system management information (system services ).
Inetinfo.exe provides FTP connection and management through the management unit of Internet Information Service. (System Service)
Tlntsvr.exe allows a remote user to log on to the system and run the console program using the command line. (System Service)
Allows you to manage Web and FTP services through the management units of Internet Information Services. (System Service)
Tftpd.exe implements the TFTP Internet standard. The user name and password are not required for this standard. Part of the Remote Installation service. (System Service)
Termsrv.exe provides a multi-session environment that allows client devices to access virtual Windows 2000 Professional desktop sessions and
In Windows. (System Service)
Dns.exe responds to queries and updates requests for Domain Name System (DNS) names. (System Service)
The following services are rarely used. The above services are harmful to security and should be disabled if not necessary.
Tcpsvcs.exe provides the ability to remotely install Windows 2000 Professional on a PXE client computer. (System Service)
The following TCP/IP Services are supported: Character Generator, Daytime, Discard, Echo, and Quote of the Day. (System Service)
Ismserv.exe allows sending and receiving messages between Windows Advanced Server sites. (System Service)
Ups.exe manages the uninterruptible power supply (UPS) that is connected to the computer ). (System Service)
Wins.exe provides the NetBIOS Name Service for TCP/IP customers who register and resolve NetBIOS names. (System Service)
Llssrv.exe License Logging Service (system service)
Ntfrs.exe maintains file synchronization between multiple servers in the file directory. (System Service)
RsSub.exe controls the media used to remotely store data. (System Service)
Locator.exe manages the RPC Name Service database. (System Service)
Lserver.exe registers the client license. (System Service)
Dfssvc.exe manages logical volumes distributed on the LAN or WAN. (System Service)
Clipsrv.exe supports "Clipboard viewer"... the remaining full text>

Related Article

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.