CCLabelTTF font texture issue

Topics: Windows Phone 8
Aug 20, 2013 at 8:37 AM
I'm have some issues when using CCLabelTTF like:
- I have a XAML page and when I click on button that will navigate to GamePage, sometimes some CCLabelTTF instances will not appear on screen.
- When I back to previous page and then navigate to GamePage again, all CCLabelTTF instances will disappear on screen.
Anyone have any solution for this issue?

P/S: Sorry for my bad English :)
Coordinator
Aug 21, 2013 at 9:21 PM
That would seem like the textures are not reloading properly on the device. The label textures are dynamic and should recreate themselves when they are disposed. Are you using the github source or the NuGet extension?
Aug 22, 2013 at 3:37 AM
Dear totallyevil,
 I'm using Github source and build for WP8. I tested CCLabelTTF on Nokia Lumia 520, after resume GamePage, all CCLabelTTF will disappear. Yesterday i tried to use CCLabelBMFont and my game crashed when navigate back to GamePage ( error: graphicsDevice is null when loadTexture for CCLabelBMFont instance ).
Aug 30, 2013 at 8:25 AM
DaiHuynh,

Could you show me the way to "Navigate from XAML page to GamePage.xaml by Clicked button, Back to previous page and navigate GamePage.xaml again" I tried to do this, but
lock (GraphicsDevice._d3dContext)
                _cbuffer = new SharpDX.Direct3D11.Buffer(GraphicsDevice._d3dDevice, desc);
has NullReferenceException was unhandled by user code. And
A first chance exception of type 'System.NotImplementedException' occurred in MonoGame.Framework.DLL
A first chance exception of type 'System.NullReferenceException' occurred in SharpDX.Direct3D11.DLL
How can I navigate between Other.xaml to Gamepage.xaml vice versa many time. When navigate to GamePage.xaml, it was initialized, and navigate to Other.Xaml, GamePage.xaml deleted clearly.

Thanks!
Aug 30, 2013 at 10:48 AM
Dear tomblack,

This is my code:
        public GamePage()
        {
            InitializeComponent();

                _game = XamlGame<MyGame>.Create("", this);
        }

        private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {
            _game.SuppressDraw();
            if (NavigationService.CanGoBack)
            {
                NavigationService.GoBack();
            }
        }

        private void PhoneApplicationPage_Unloaded(object sender, RoutedEventArgs e)
        {
            Dispatcher.BeginInvoke(() =>
            {
                _game.Dispose();
                _game = null;
            });
        }
Updated about this bugs:
I found this bugs not related to Navigation between XAML pages, it's maybe a "BIG" issues related to GraphicsDevice ( Directx11 ). If your Scene have instances of CCLabel*, CCScale9Sprite (just found 2 classes), when you press "HOME" and then press "BACK" to resume your last Scene -> Only CCSprite instances displayed on screen, others disapear.
Solution found for CCLabel* instance is reCreate last Scene but nothing for CCScale9Sprite.
Aug 30, 2013 at 12:52 PM
Edited Aug 30, 2013 at 12:55 PM
Dear DaiHuynh, thanks for quick response.

I am trying to follow your instruction, but my test app run not as expected.
Please give some line of code in details, or could you create a mini test project run like a demo ?, and reply me a link download.

Many thanks for considering my request.
Coordinator
Sep 1, 2013 at 4:01 AM
Hello users, so on Friday I had the same issue with labels disappearing when moving the window between screens on my desktop. I uncommented the android support code that fixed this long ago and guess what? labels appeared again.

Please try the latest github version again.
Sep 3, 2013 at 8:18 AM
Dear totallyevil,
 Thank for your news! The issue is solved, i can continue working on my project.
Thank you!
Sep 3, 2013 at 8:22 AM
Dear tomblack,
 Did you update new codes from MonoGame? You can step-into your code to figure out what method that HAVE NOT BEEN IMPLEMENTED for Windows Phone 8. I copied all codes in my GamePage.xaml and there're nothing left to show :(
Sep 3, 2013 at 8:38 AM
Edited Sep 3, 2013 at 8:38 AM
DaiHuynh,

The lastest MonoGame was updated 2 month ago. You must update all files in SharpDX lib for your project, your project will run correctly.
Please send your samle about Navigate issues that I describle as above! :|