There are other variants of the spriteBatch. DrawString function which allow turning and scaling the text. It is necessary to remember that such movements cause text misrepresentation. This happens as XNA doesn't work with original vector font, but with its raster presentation, which is created at the moment of project compilation and is added to content. To define where user has taped the screen, we should get data from the Microsoft.
TouchPanel class:. Thereby, we get all the screen dots which user has touched. However we will need data on one-time action of screen touching when you tap and take finger from the screen. This is necessary for tracking touches of the screen buttons, for example, the Pause button. To get this data we should use gesture support. To get data on the phone tilt we will use the Microsoft. Accelerometer class. Unfortunately, we can't get data directly from accelerometer the way we did it with TouchPanel as it supports event model only.
That is why we should use subsidiary class which creates object and subscribes on its event:. Acceleration vector contains information about all three axes X, Y and Z , but we need first two only for portrait orientation of the phone.
That is why attribute which returns acceleration in our system of coordinates will look this way:. Object of this class can be loaded from content:. A lot of things are ready: the white ball is moving by accelerometer, the rest balls chase it and are turned into splashes when touched, score is calculated, sounds are playing.
It seems like everything is ready? No, it's not that simple. Now we need to create windows: start windows main menu , pause dialogue and windows of game end with display of gained score and records.
It isn't as difficult as it may seem at first sight. It is enough to create a basic control with main features: Parent, Children, Bounds, Visible, Enabled and with functions "Update" and "Draw". Then we should create several child classes: Window, Button, Label, etc. The game on the phone can be put on hold at any moment either by clicking on the "Home" button or by any other external event.
That is why we need to take attention to saving game state at any moment of time and further resume of this state when game launched. Let's use the System. ApplicationSettings class for saving states and settings. This class implements the IDictionary interface, that's why it's quick easy to work with it. Let's summarize the current state of all the game world objects hopefully there are no many of them to this dictionary and call the IsolatedStorageSettings.
Save function. Game will be saved at the moment when you exit it. To do so, let's override the OnExiting function in the game class:. Game resume is done analogically. When the app is launched we receive the data from IsolatedStorageSettings.
ApplicationSettings and resume all the game world objects. Our application won't always be in an active state. Sometimes it may be deactivated i.
To track these events let's override the OnActivated and OnDeactivated functions in the game class. During application deactivation we will put the game in pause mode so the dialogue message about resuming the game will appear when user returns to it. Besides, not to waste calculating resources of the phone in deactivated state, let's add the following code to the beginning of the Update function in the game class:. Our game to be precise, game content is loaded within several seconds and displays only black screen during this time period.
We should show users that the application is working. To do so we should draw a nice splash-screen to show it at the game launch:. It will be shown automatically if you just to add the SplashScreenImage. We'll have to re-make content load. At first we do texture for splash-screen and draw it during the first call of the Draw function.
Then we load the rest content and launch the game. Till the rest content is loading, splash-screen is displayed. Plus let's put game name and description in the same file in the Title and Description attributes.
Let's remove the unnecessary requirements section. In this section we will leave only for accelerometer support.
We don't need the rest parts in this version of the game. The first picture is needed for game display in the Games section and the second one is needed for start screen of the phone. As our game will be for money, we need to add trial mode support. Trial check is already built to the platform and is done with the help of the Microsoft. LicenseInformation class:. As the function is rather slow, we won't call it each game cycle iteration.
Instead of this we will call it only when the application is activated in the OnActivated function of the game class and the result will be saved in variable. If the application is launched in the trial mode, then after several minutes, the window offering game purchase or starting a new game appears. Everything is almost ready and we send the application to Windows Phone Marketplace. Before publication it is carefully tested by Microsoft and after several days it gives the verdict: declined.
What is the reason? Hardware button "Back" should work must work in a certain manner, that is return users to the previous screen. You can exit the application using the button if user is on the start screen of the application main game menu only.
If you are in the pause mode then the button must return you back to the game. In our case, the button always called application exit. Let's remove this code and apply the correct work of the button and send it to Microsoft review again. Repeated review will take less time. Yes, the application is accepted! Now the game is in Windows Phone Marketplace. All in all we spent about two weeks on the game development and two weeks on publishing to the marketplace. Putting all the codes together, code behind for the application start page would be as below, using System; using Microsoft.
Controls; using System. Primitives; using System. ComponentModel; using System. Threading; using PhoneApp1. GetDataAsync 9 ; Thread. Rate this:. Leave a Reply Enter your comment here Fill in your details below or click an icon to log in:. Email required Address never made public. Name required. Follow Following. Dhananjay Kumar Join 7, other followers. Sign me up. Already have a WordPress. Log in now. Post was not sent - check your email addresses!
Follow same steps and take help of Expression Design 4, So something similar like this :. So, Your Splash Screen is Ready!.. I am seriously looking ahead for some exciting splash screens from you people since I am not expert Designer. So buzz me back with your designs. I will surely post it here with giving you full credits and it will be great collection as well. Though my splash screen is Jazzy! I Hope you understand the real life application of it and the business value it carries, Remember!
Splash Screen is your first impression of application. So be careful about it and do it very seriously. On more serious note. While making splash screen jazzy like this, Make sure it does not becomes a Heavy Image and trouble for your end users and customers. Note that I am using Microsoft Expression Design 4 because I find it simple, However you can do this using other editors and put some transparent layer of PNG image on this and do layer as well.
You need to figure out smart and better way,I just shown the way to do it! In coming post we will now focus into other areas related to UI and then we will go to controls and navigation then followed by Data and Line of Business applications.
So expect lot of stuff here and keep visiting for more!
0コメント