I am writing a game using xna for wp7 for the first time and finding difficult to implement main menu and managing game state. please provide any tutorials/links.
I searched on SO, found below link but the this link is broken.
http://create.msdn.com/en-US/education/catalog/sample/game_state_management
Try the Nokia developer site:
http://www.developer.nokia.com/Develop/Windows_Phone/Code_examples/
They have some good examples on XNA.
Do you know that you can mix XNA and Silverlight? i.e. Menus can be in Silverlight while your actual game screens can use XNA.
Related
I'm new to Xamarin development and feel a little bit strange about how to design the UI interface in Xamarin.Forms (portable/shared).
If I just design the Xamarin Android or the Xamarin iOS, I can get the GUI with drag and drop to finish my UI (like in Windows Forms application) and the code for the UI is automatically generated. But in Xamarin.Forms, this one is not supported (we must use code or xaml). I understand that if we use Xamarin.Forms, the same code apply for both Android or iOS.
However it's a long approach to create the UI. Is it possible in Xamarin to create the UI in Xamarin Android / iOS project and then only do the functionality code in Xamarin.Forms (portable or shared)?
I know this is a common question but it can help many new developers either to choose using Xamarin or not...
There is the Xamarin.Forms XAML Preview for when you are coding in XAML:
But in the end, yes, you are coding events, and data converters, etc... and even with tools like the Interface Builder for iOS, you still have to do all the coding to tie the UI together.
On a personal note: Almost ALL the groups that I have worked with do not use the GUI design tools for any apps that are larger then a screen or two. On iOS we avoid .xib & .storyboard like they are the cause of the black plague.
I understood perfectly your situation. A good start is a Xamarin book that you can download for free for this page https://developer.xamarin.com/guides/xamarin-forms/creating-mobile-apps-xamarin-forms/
If you have been developed with WPF, in Xamarin you have the same concept. A good start is trying example in working apps to understand the structure and the app lifecycle. You can find a collection of examples and code at this link. You can create a form or with XAML or in the code. There are two ways. I advice you to start with XAML and C#.
I advice you to use Portable project and in this way you can share that not just across Xamarin project but with other kind of projects (such as a ASP.NET project).
You can think design Xamarin Forms UI like design Website.
Design website
You knowledge HTML
You need web browser to review
Design Xamarin Forms.
You knowledge XAML
You need Xamarin Previewer to review (Gorilla player, xamarin live player, LiveXaml)
Xamarin.Forms is great, for better understanding of XAML I encourage you to take the time and watch this video (https://evolve.xamarin.com/session/56e201d2bad314273ca4d813) where Charles Petzold goes into detail of how XAML works.
Before Xamarin Studio o Visual Studio had a XAML previewer for Xamarin.Forms I used GorillaPlayer (http://gorillaplayer.com/) is free and works well.
Also take a look in the Xamarin University and Examples.
James Montemagno is a name you must research when talking about Xamarin, he did some really cool and helpfull Xamarin Nuget Packages.
Hope I had pointed you in the right direction.
I understand that you are new to Xamarin.Forms. What I did when I was new to the framework was following a few courses on https://www.xamarin.com/university it is free for 30 days if I'm right (that must be enough to understand the basics). About the previewers I don't have good expierence with them. They are often slow or not working. For me it was often faster to just debug on the phone. Hopefully this will help you a bit.
Even if a nice designor was available, I would still argue that coding by hand is much more efficient : no bad code generated (exemple with constraint : no padding /margin set at the wrong place. No hardcoded size when it's not required etc).
You will have a better understanding and the learning curve is fast.
Back in the days, I started XAML with Silverlight with the amazing Microsoft UI designor : Blend. After few months, I ended up with an architecture that broke the designor (because of dependencies injected in constructor or because the designor struggled to discover controls in external assemblies). It was really painful and I lost a lot of productivity. Few months later, I was fluent with XAML and was even more productive than with a designor.
Nowadays, Visual Studio is snippet friendly for XAML control. I've created a few of them (like a grid with several column row auto, a snippet to generate the ContentPage.Resource with a style, etc).
It's a pain that is worth it.
Moreover you will learn a lot a things and will be more confident in your skills.
Give it a try for few months : you won't regret it !
Last but not least, as other suggest, when building a big app, even in iOS, most developpers I know don't use designor but code everything by hand because of snippet, helpers, extension methods etc.
I'm trying to integrate the "inneractive SDK" in an XNA game for WP7.
It should be simple:
InneractiveAd.DisplayAd("MY_APP_ID", InneractiveAd.IaAdType.IaAdType_Banner, ??? , 120);
but i don't know what to put in the "rootGrid" field of type: System.Windows.Control.Grid
someone can help me?
System.Windows.Control.Grid is a Silverlight control, and the ad service you are trying to use is meant for Silverlight Windows Phone apps, not XNA. You can either
Create a Silverlight/XNA project, move your current XNA game into a frame of that project, and place the Ad in another frame; or
Use a more universal Ad control such as this one.
My name is Nirit and I'm a support manager at inneractive.
Our WP7 SDK currently supports Silverlight, the XNA version is not ready yet, but it's indeed on our roadmap.
On Mango, XNA can be combined with Silverlight so in this case, you can use our SDK.
For further information regarding combining XNA and Silverlight projects please check out this link.
In case Silverlight is not an option for you, please try our Server API (M2M protocol).
Our Server API can be found here.
If you have any further questions, suggestions or comments, please feel free to contact me via the "Contact Support" link on your Dashboard.
I try to search available option about wp7 gesture. I found only Silverlight toolkit (http://silverlight.codeplex.com/) which has gesturelistener to get gesture events. It looks like some external library to add in the application. I’m wording are there any API comes with WP7 sdk right from Microsoft. But didn’t found anything so far.
I used MouseEventHandler and MouseButtonEventHandler to get any touch event in the emulator. It is not convient for a complicated multi touch, etc.
Please give me so link to study and discover gesture API. Thanks!
The Silverlight toolkit is an external library (to the SDK) but it is produced by people working at Microsoft. Most of the developers of the toolkit also work on the SDK. It is a way for them to release more controls but on a more frequent schedule than the main SDK.
The XNA framework contains some gesture detection but this is typically more complicated to include in a Silverlight application than the toolkit.
You could also write the gesture detection yourself using the manipulation or mouse events but I'd advise against this if possible.
I'd also advise against reinventing the wheel when there are already tools available.
There are gestures built into XNA; but either way, be it Silverlight toolkit or XNA library, you would have to add a reference in your solution.
This would be a nice starting place to learn about gestures in XNA: http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-5-Input-touch-gestures.aspx
Hope this helps!
Does windows phone 7 have a similar component likes UITableview in iPhone?
I am trying to find an api mapping published by Microsoft, but to no avail.
I welcome any comments.
Your best bet would be to bind the data to a ListBox.
Here is an example.
You may be interrested in http://windowsphone.interoperabilitybridges.com/
It includes details on getting up to speed on Windows Phone 7 development for people familliar with developing for other platforms. (Including iOS.)
Tim is correct that you will most likely end up using a ListBox, but here is a bit of a longer answer:
I believe you are referring to the iOS to Windows Phone API mapping tool, which helps map common iOS APIs to their Windows Phone equivalents. Unfortunately in this case it will not provide a direct answer to your question, as iOS and Windows Phone take different approaches to the UI layer:
Apple enforces a strict MVC pattern on each of its views. In fact, they provide a set of base view controller classes which already support much of the behaviors you see in typical iPhone applications. The most common of these include UITableViewController, UINavigationViewController, UITabBarController and the standard UIViewController.
Windows phone 7 does not require you to use an MVC pattern, and therefore does not include the standard views that are available in iOS. Instead it is left up to you to choose and implement whatever UI pattern that you choose. Many choose the MVVM Pattern, but even then there are multiple toolkits you can use (This one seems pretty popular).
To start, with most users will just use the graphical designer built into Visual Studio to drag and drop controls onto each page of their application. If you want to learn more I recommend watching the Windows Phone 7 Development for Absolute Beginners series or 31 days of Windows Phone 7 series. Most Silverlight XAML layout and APIs techniques are available in Windows Phone, so 31 days of Silverlight may also help.
I've made a simple game for WP7 but apparently simply using the XNA template isn't enough to get your game to show up in the games hub. What code do I need to make that happen?
Also, can I get games made in silverlight to show up in the Games Hub as well? If so, how do I do that?
Thanks!
You need to edit the WMAppManifest.xml file (in Properties [C#] or My Project [VB.NET]) to set Genre="apps.normal" (in the <App> element) to Genre="apps.games". This will work for both XNA and Silverlight apps. See Application Manifest File for Windows Phone for more details.
Give it a try and side-load it to your phone for testing - it's pretty cool to see it show up in the Games Hub.