1
Windows phone 7 XNA에 메뉴 버튼이 있습니까? Cocos2D에서 CCMEnu와 같은 게임을위한 메뉴 버튼을 만들고 싶습니다. 내 GamePage.xaml.cs입니다.XNA의 메뉴 버튼
public GamePage()
{
InitializeComponent();
newButton = new Button();
newButton.Height = 75;
newButton.Width = 250;
///newButton.Foreground = new System.Windows.Media.SolidColorBrush(Colors.Green);
newButton.Content = "Dynamically added";
// Get the content manager from the application
contentManager = (Application.Current as App).Content;
contentManager.RootDirectory = "Content";
// Create a timer for this page
timer = new GameTimer();
timer.UpdateInterval = TimeSpan.FromTicks(333333);
timer.Update += OnUpdate;
timer.Draw += OnDraw;
newButton.Click += new RoutedEventHandler(newButton_Click);
}
void setUpBackgroundAndTitle()
{
// Draw a background picture with scaling since the picture is large //
spriteBatch.Draw(background, new Vector2(0, 0), null, Color.White, 0f, Vector2.Zero, new Vector2(0.9f, 0.9f), SpriteEffects.None, 0f);
spriteBatch.Draw(rhymeImage, new Vector2(400, 0), null, Color.White, 0f, Vector2.Zero, new Vector2(1f, 1f), SpriteEffects.None, 1f);
spriteBatch.Draw(gameImage, new Vector2(180, 0), null, Color.White, 0f, Vector2.Zero, new Vector2(1f, 1f), SpriteEffects.None, 1f);
spriteBatch.Draw(titleImage, new Vector2(150, -70), null, Color.White, 0f, Vector2.Zero, new Vector2(1f, 1f), SpriteEffects.None, 1f);
ContentPanel.Children.Add(newButton);
}
xaml 파일.
<Button Content="Button" Height="71" Name="button1" Width="160" Click="button1_Click" />
내가 버튼을 배경으로 사용할 때 확인 했어. 그것을 앞으로 가져 오는 방법. 또는 어떻게 동적으로 버튼을 만들 수 있습니까? – user1323210
그냥 짐작 하겠지만 OnDraw 메서드의 메서드 순서와 관련이있을 것입니다. Silverlight 요소 렌더링이 메서드의 마지막 요소 여야합니다. (위에 머물러 있으려면) –
이 단추를 배치 할 위치는 다음과 같습니다. the XML. 그런 다음 그것을 맨 위로 가져 오는 방법. – user1323210