Skip to main content
edited title
Link
user1430
user1430

Using Why isn't this UIButton visible in Monogame with Xamarin.iOS?

Tweeted twitter.com/#!/StackGameDev/status/403360343046365184
deleted 329 characters in body
Source Link
House
  • 73.5k
  • 17
  • 188
  • 276

Currently I'm developing a game for iOS using the Monogame framework for the first time. It's an isometric 2D game, and I'm working with SpriteBatch calls to handle drawing the game art.

Now I'm wondering, what is the best waytrying to go about implementingimplement buttons for this type ofinto my game?. I noticed iOS has the UIButtonUIButton class, which I tried, but upon drawing it nothing is shown. The asset image is properly loaded, I've checked this. The SpriteBatchSpriteBatch isn't drawing on top of the buttons either. DrawDraw is properly being called on every frame. The button's enabled property is set to TrueTrue.

The code, simplified:

private List buttons; public void AddButtons() { UIButton b = new UIButton(UIButtonType.Custom); b.SetBackgroundImage(UIImage.FromBundle("icon.png"), UIControlState.Normal); b.Frame = new System.Drawing.RectangleF(0, 0, 256, 256); buttons.Add(b); } public void Draw() { foreach (UIButton b in buttons) { b.Draw(b.Frame); } } Why isn't it visible? Is it even a good idea to use UIButton here, or are there other standard iOS libraries for this?

Currently I'm developing a game for iOS using the Monogame framework for the first time. It's an isometric 2D game, and I'm working with SpriteBatch calls to handle drawing the game art.

Now I'm wondering, what is the best way to go about implementing buttons for this type of game? I noticed iOS has the UIButton class, which I tried, but upon drawing it nothing is shown. The asset image is properly loaded, I've checked this. The SpriteBatch isn't drawing on top of the buttons either. Draw is properly being called on every frame. The button's enabled property is set to True.

The code, simplified:

private List buttons; public void AddButtons() { UIButton b = new UIButton(UIButtonType.Custom); b.SetBackgroundImage(UIImage.FromBundle("icon.png"), UIControlState.Normal); b.Frame = new System.Drawing.RectangleF(0, 0, 256, 256); buttons.Add(b); } public void Draw() { foreach (UIButton b in buttons) { b.Draw(b.Frame); } } Why isn't it visible? Is it even a good idea to use UIButton here, or are there other standard iOS libraries for this?

I'm trying to implement buttons into my game. I noticed iOS has the UIButton class, which I tried, but upon drawing it nothing is shown. The asset image is properly loaded, I've checked this. The SpriteBatch isn't drawing on top of the buttons either. Draw is properly being called on every frame. The button's enabled property is set to True.

The code, simplified:

private List buttons; public void AddButtons() { UIButton b = new UIButton(UIButtonType.Custom); b.SetBackgroundImage(UIImage.FromBundle("icon.png"), UIControlState.Normal); b.Frame = new System.Drawing.RectangleF(0, 0, 256, 256); buttons.Add(b); } public void Draw() { foreach (UIButton b in buttons) { b.Draw(b.Frame); } } Why isn't it visible?
Source Link
Appeltaart
  • 430
  • 1
  • 4
  • 14

Using UIButton in Monogame with Xamarin.iOS

Currently I'm developing a game for iOS using the Monogame framework for the first time. It's an isometric 2D game, and I'm working with SpriteBatch calls to handle drawing the game art.

Now I'm wondering, what is the best way to go about implementing buttons for this type of game? I noticed iOS has the UIButton class, which I tried, but upon drawing it nothing is shown. The asset image is properly loaded, I've checked this. The SpriteBatch isn't drawing on top of the buttons either. Draw is properly being called on every frame. The button's enabled property is set to True.

The code, simplified:

private List buttons; public void AddButtons() { UIButton b = new UIButton(UIButtonType.Custom); b.SetBackgroundImage(UIImage.FromBundle("icon.png"), UIControlState.Normal); b.Frame = new System.Drawing.RectangleF(0, 0, 256, 256); buttons.Add(b); } public void Draw() { foreach (UIButton b in buttons) { b.Draw(b.Frame); } } Why isn't it visible? Is it even a good idea to use UIButton here, or are there other standard iOS libraries for this?