show text

Nov 14, 2009 at 2:18 PM

I would like to know how to program for showing Text  on the rendering screen. After a long—time work of learning the Source Code, I‘m failed in finding a better way.
1, Can I input the Text into the “BitmapImage” for compounding,then render it to screen ?
2, We know that the  part of tasks of display can be done by the “Disply” while the "Disply" itsself bound on the "RootVisual". You have been  noticed that the "RootVisual" is just a Instance of the MainPage , So can I construct moveablely a transparent Page,and then put the Controls  on it?And how to do this?

thanks

Coordinator
Nov 14, 2009 at 4:11 PM

Hi,

the current release has a bug in it that makes the Balder display on top of everything.

Next release you'll be able to use Silverlight textblocks on top of the display. For now the only workaround I can think of is to create a usercontrol and programmatically add it to the LayoutRoot during the Load event of the page and then have your text in the usercontrol. 

The technique you mention can also be an alternative, but from the top of my head I can't see how you could actually get it working with Balder - as all these things are hidden.

 

Next release is right around the corner - hopefully within a week. If you need this fix, straight away, you can go get the Development branch at GitHub. (http://github.com/einari/Balder/tree/Development)
The syntax has changed a bit in there, instead of calling the TargetDevice.Initialize<MyGame>() method in App.xaml.cs - you only need to add a control called Game to your MainPage.

The Game control is located in the Balder.Silverlight component, in the Controls namespace. So you need to add a XML namespace reference to it, like this:

xmlns:balder="clr-namespace:Balder.Silverlight.Controls;assembly=Balder.Silverlight"

And then you can do something like this:

<balder:Game Width="800" Height="600">

<balder:Game.GameClass>

<local:MyGame/>

</balder:Game.GameClass>

</balder:Game>

A working sample is in the Development branch as well - just open the Balder_Silverlight.sln found in Sources\Solutions, and you'll see the TestApp using this new syntax.

 

 

Nov 16, 2009 at 4:17 AM
Edited Nov 16, 2009 at 4:24 AM

ok , thanks a lot . I have already solved this problem .

Yes, I create a UserControl , and then add it in (Panel)Display . Like this:

 private void ShowFloatWindow()
 {
       WindowManager wm = new WindowManager((Panel)Display);
       wm.AddWindow("test", new UserControlSample());
 }

 

The soure code is here : http://cid-b4053468c49ee9ae.skydrive.live.com/self.aspx/.Public/FloatWindow.rar

Hoping for the next release!

Coordinator
Nov 16, 2009 at 6:38 PM

Great. 

That will work. We're on schedule with the next release - so stay tuned. :)