how to build xaml ui in Cocos2d for windows 8 metro application? - xaml

we have been use cocos2d for windows 8 build metro game . so we want use xaml control UI in cocos2d ?
is there have soluction or suggestion?

just try one night i have been fix this problem. you can click fllow link:
DirectX and XAML interop (Windows Store apps using C++ and DirectX) (Windows) http://msdn.microsoft.com/en-us/library/windows/apps/hh825871.aspx
With the release of Windows 8, you can use XAML and Direct X together in your Windows Store app. The combination of XAML and DirectX lets you build flexible user interface frameworks that interop with your DirectX-rendered content, and is particularly useful for graphics-intensive apps. We explain the structure of a XAML app that uses DirectX, and identify the important types to use when building your XAML app to work with DirectX.

soluction as fllow link:
http://www.cnblogs.com/chenkai/archive/2012/11/29/2794983.html
by chenkai

Here's a template project in my github:
https://github.com/chanyuenpang/cocos2dxaml

Related

Xamarin Forms code sharing

I'm working on a xamarin forms (PCL) project (A basic customer care chat app which is meant to run on Android and iOS only) that has just two xaml pages, custom renderers and few dependencies. This project is meant to be implemented into another existing project (which I don't have access to its source code) such that an action would be binded to a button on the existing app to show a page on my own project.
There is need for me to share my chat project with my client's developer but without exposing my source codes, perhaps compiling to dll or nuget package that would be added to the existing project to access my project's functions and pages. I have searched through the xamarin forum and here on stackoverflow but can't seem to lay my hands on a solution.
Is this possible at all? If yes, what am I missing? If no, is there any better option to use?
Please do note that the chat app completely done, so I'm hoping perhaps there's a way I could directly convert the project to a Nuget package.
Thanks in anticipation!
If the host application is a Xamarin Forms one:
-Move your cross platform shared code into a PCL or .Net Standard (ContentPages, ContentViews, Classes).
-Move your Renderers and platform specific code to Android and iOs Class Libraries.
Your client will have to reference your first assembly (dll) in their XF assembly in order to instantiate/manipulate your views/classes and platform specifics one on their Back-end side (taking into account your renderers, effects, etc ...)
A lot of Xamarin Controls Libraries Open Source hosted on Github are working like that. For example this one: https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout
If the host application is a native application, take a look into Xamarin forms embedding
Finally, I seem to solve the problem by enabling visual studio to build Nuget packages for the chat app project (summing up to 3 nuget packages) on project build.
Thanks #Rudy Spano and #Micah Switzer for your contributions

LayoutTransform not in Windows Phone Toolkit

The examples I have found for using a LayoutTransformer with windows phone are all from before they split off the Windows Phone Toolkit from the Silverlight Toolkit.
The Windows Phone Toolkit does not have the LayoutTransformer.dll that was referenced.
So the question is, what do you use to do a LayoutTransform now?
Literally, just use the code from the Silverlight toolkit with minor changes.
Here's how to do it for Windows 8 (note: this is from my blog). You can reuse this completely, just change a few namespaces and at one place from 'protected' to 'public' and it builds and works.
Edit: I published a WP8 version on GitHub. Enjoy :)

Choosing Windows Runtime Components versus Portable Code Library

When sharing code between Windows Phone 8 and Windows 8, the two core options for developers are 1) Windows Runtime Components and 2) Portal Class Libraries.
Windows Runtime Components use WinRT and can be projected into all the supported languages. They require linked files in separate projects (binaries) when used on different platforms. They, however, share 90% of the available WinRT APIs.
Portable Class Libraries are a subset (sometimes a significant subset) of the BCL that has binary compatibility across platforms. They can be used on WinRT applications but also on other project types like Silverlight, Xbox, etc.
When a developer is choosing a "sharing strategy" which project type is the go-to technique to do the best job sharing code between Windows Phone 8 and Windows 8? Thanks.
It depends what form of sharing you need:
1) If you have a common C++ business logic layer you can use Windows Runtime (WinRT) components to expose this to both Windows Phone and Windows Store app (that's the only use-case for Windows Phone as you can't write a WP8 app using JavaScript or use .NET to author a WinRT component).
You'd have to build two separate WinRT components however, one for Phone and one for Windows Store. It should be possible to share the C++/CX code of your WinRT interop layer using preprocessor directives (#if) to mark the platform specific code.
2) You have business logic in C#/VB that only has dependencies on the .NET APIs which are available in a Portable Class Library. Then you can use Portable Class Library (PCL) to contain that logic. Basically if you can build your library into a PCL DLL then this should work. You can then reference this PCL in binary form in both Windows Phone and Windows Store app.
However as Martin has said you need to take care when using 3rd party libraries as these will also need to be built for PCL. Some 3rd party libraries are already available in PCL form (JSON.NET for example).
3) You want to share code for that has platform API dependencies (or 3rd party library dependencies) which are not supported by PCL. Then you'd need to create separate DLL libraries, one per platform. You can avoid code duplication using linked C#/VB source files and use a build flag (#if again) to allow small code changes between your target platforms.
If you want to share code between Windows Phone 8 and Windows 8, then you cannot use Windows Runtime Components, because there are different components used for Windows 8 and different for Windows Phone 8 and they are not interchangeable.
I would go for either Portable Class Libraries for some simple generic libraries, or for code sharing via links and #if WP8 compilation directives - this just works and is more powerful than Portable libs.
Keep also in mind that most external libraries like MVVM Light cannot be referenced in Portable Libs, so if you want to use them, you have to use the code sharing via file references.
For some guidance on how to effectively use Portable Class Libraries to share code between platforms, see this blog post: How to Make Portable Class Libraries Work for You
This question is no longer relevant with the introduction of Windows
Phone 8.1 Universal Apps in Visual Studio 2013 Update 2 which supports
Shared Projects.
Wait a moment, as for me even in Visual Studio 2013 Update 4 this question is still relevant because there are two types of projects there:
Class Library (Portable for Universal Apps) - PCL
and
Windows Runtime Component (Portable for Universal Apps) - WinMD
I can see only one big difference between them:
WinMD uses only WinRT and PCL could be used also with .Net and Silverlight. But I also want to know more about which one and when better to choose.

WinRT MVVM Light Sample Project

If anyone starts developing Windows 8 metro applications using MVVM Light please help me to create a Windows 8 (WinRT) project template. I get bored by using Microsoft ‘s Layoutaware page(Base class). I just need to structure the class with the help of MVVM Light. If any one did this please help me or provide some links to start developing Windows 8 Metro application using MVVM Light.
The major areas where i am facing issues are:
Navigation (Forward and Backward)
State Handling (Tombstoning in windows 8)
Navigation after the app launches form termination state etc.
Handling WebService [ Post using http client ]
There is an (older) example of using MVVM Light with windows 8 found here. There are also templates and Samples as part of the MVVM Light source found here.
Edit:
Here is an msdn example using MVVM Light.
What about this
But I did not try it. I'm using Portable class library (with targets Windows 8.1 and .NET x.xx) and this library is referenced to WinRT project. MvvmLight for PCL you can find on this link
Problem is, that you can't access Local files and Local settings but you can inject it from Presentation project to Portable class library at the start.
This solution has a lot of advantages and one of the is : easiest unit testing.
For more info look this stack overflow thread

Are Metro style apps managed or native and if native how can they run on both arm and x86?

I originally assumed that Metro style apps were managed (.NET) assemblies whether they are written in C# or C++ and I thought C++ for Metro style apps would be similar in concept to C++/CLI.
However, I now heard on a DotNet Rocks podcast that Metro style apps written in C++ are native. Nevertheless I understand that Metro style apps run on all three CPU architectures Metro is available for. How is this accomplished? Do Metro style apps come with different binaries and only one is chosen/downloaded? Or is it like on Mac OS X where one binary can contain code for different CPUs?
Code that uses only system or OS services from WinRT can be used
within an app and distributed through the Windows Store for both WOA
and x86/64.
from this MSDN blog page
If you go watch this BUILD video things should start to clear up -- http://channel9.msdn.com/events/BUILD/BUILD2011/TOOL-930C (A .NET developer's view of Windows 8 app development)
Basically there is a CLR (.NET 4.5) running. I didn't say a full CLR. WinRT from a .NET perspective is just a .NET Profile (sort of a way that they can layout the API differently exposing or hiding things). The new WinRT APIs use a new version of [gulp] COM, but it is optimized for use with .NET. I'm not 100% sure on the C++ angle. I suspect with C++, you have a few options. Compile for each platform (arm and x86) or compile to IL. Not sure if this helps you at all (I hope so).