spritebatch

When I change vertical size of XNA game window to minimum, it throws ObjectDisposedException for spritebatch, why?

主宰稳场 提交于 2020-02-04 01:15:30
问题 When I resize the game window and the viewport's height becomes 0, GC disposes of spritebatch, I think. Is this what happens? How do I prevent this? 回答1: Form gameForm = (Form)Form.FromHandle(Window.Handle); gameForm.MinimumSize = new System.Drawing.Size(800, 600); Short and sweet! 回答2: I had this same problem and some quick debugging shows that XNA calls UnloadContent and then LoadContent again to reinitialise resources; my guess it it loses the GraphicsDevice or something, hence the reload.

libgdx spritebatch not rendering textures

情到浓时终转凉″ 提交于 2020-01-25 11:06:44
问题 I'm working on a top down RPG game using LibGDX, and am creating an Ortho.. camera for my game. However in doing so, only my tile textures render now. This is how the render code looks: Camera initialized as new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); (note that the camera. calls are actually in the world.update method, I just figured I would minimize the amount of code needed on here) Updating/Rendering: camera.position.set(getPlayer().getPosition().x,

Why doesn't SpriteBatch draw anything (LibGdx)?

白昼怎懂夜的黑 提交于 2020-01-25 04:21:25
问题 This is from day 6 of the flappy bird recreation tutorial -http://www.kilobolt.com/day-6-adding-graphics---welcome-to-the-necropolis.html Here is the image file i am using for texture in my game. It is a 256px x 64px .png file. Here is the class that I used for loading the texture and the specific TextureRegion(part of the texure) that I want the SpriteBatch to draw. public class AssetLoader { public static Texture texture; public static TextureRegion bg; public static void load() { texture =

libgdx SpriteBatch UnsatisfiedLinkError desktop

眉间皱痕 提交于 2020-01-24 02:46:09
问题 I am getting UnsatisfiedLinkError in a LibGdx project, when trying to run a desktop standalone version of it. Note, this problem doesn't occur if I simply run a desktop version directly without building a standalone jar for it, only if I build a desktop jar first, and then try to run that. It is interesting to note that, it was overall a lot easier to run the desktop version directly, and I wasn't even to come close to running a standalone desktop jar until I hunted down a whole bunch of jar

XNA BlendState with SpriteBatch

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-15 09:18:29
问题 We are needing a BlendState to act as the following: Transparent PNGs are drawn as expected, with anything behind them preserved We use Color.White to draw a PNG as-is We will change the alpha channel of the color to change the "opacity" of the texture To get this effect, BlendState.AlphaBlend is close, but draws white as the transparent part if we set alpha to 100 or any number other than 255. So we attempted this: _blendState = new BlendState(); _blendState.AlphaSourceBlend = Blend

Cocos2d and SpriteBatchNode: cannot identify which sprite frame is causing an Assertion to fail

久未见 提交于 2019-12-31 03:56:04
问题 I have already asked something similar but I can't figure out properly how to debug this. That's the question. I added some Exceptions handler (catches all Objective-C) exceptions and that's the result of what I see: The problem is with the setTexture method and it fails at the assertion verifying whether the texture name that needs to be displayed is the same as the one in the current sprite batch node. This happens when trying to replace one scene with another but doesn't happen all the

Jerky sprite (2d) movement with OpenGL ES 2.0 on Android

两盒软妹~` 提交于 2019-12-11 18:09:48
问题 Edit 2. Added screenshot of logcat. If I reduce the number of sprites to 1, I still get this intermittent 'stop/starting' - so I don't think it's my code, as with 1 sprite my frame rate hovers around 85-90 fps. I'm guessing it's something on the phone, there are lots of things being logged by logcat so I'm assuming lots of things running in the background. Is there any way to give me app some kind of priority over other services while it's running? Edit 1. Please see edit details at the end

XNA - How to change orientation of Drawing a List of Strings

浪尽此生 提交于 2019-12-11 02:41:53
问题 How do you Draw a list of strings with a spritebatch so that it looks like this; Item1 Item2 Item3 Item4 Instead of Item 1 Item 2 Item 3 Item 4 or instead of: Item1 Item2 Item3 Item4 回答1: Something like this would make it a little easier to change later on: int y = startPointY; int x = startPointX; int switchAt = items.Count/2; //<--- or where ever you might want to break up the strings int max = 0; for(int i = 0; i < items.Count; i++) { spriteBatch.DrawString(font, items[i], new Vector2(x, y

XNA draw : using one spritebatch at whole game

允我心安 提交于 2019-12-10 18:33:20
问题 I am developing an XNA game. This is time I am careful about the architecture. Til today, I have always implemented my own draw method in this way: public void Draw(SpriteBatch sb, GameTime gameTime) { sb.Begin(); // ... to draw ... sb.End(); } I was digging the DrawableGameComponent and saw the Draw method comes in this way: public void Draw(GameTime gameTime) { // ... } First of all, I know that SpriteBatch can collect many Texture2D between Begin and End, so that it can be useful to sort

Libgdx save SpriteBatch in a texture

蹲街弑〆低调 提交于 2019-12-10 11:42:58
问题 I would like to know if it possible to save a spriteBatch in a texture . SpriteBatch batch = new SpriteBatch(); After drawing a few thing inside the batch , I would like to save all thing that contains the SpriteBatch in One texture (something like a screenshot ). I have no idea to how to do it, I searched on the web and on the libgdx doc but didn't found. Thanks you 回答1: You can render to a FrameBufferObject (FBO). See https://github.com/mattdesl/lwjgl-basics/wiki/FrameBufferObjects An FBO