tile

How to draw lots of bitmaps on screen in an Android game without slow performance

一笑奈何 提交于 2019-11-30 05:04:29
I want to make a tile based game for android. At the moment I am drawing each tile as a separate bitmap. I have a big for loop that reads from a string and draws different tiles depending on what character it finds to draw the level. I have allowed the user to scroll the screen using scrolling gestures. However the game is too slow. It takes a long time to update the screen after the user scrolls. I presume this is because it has to draw each tile's bitmap individually. What would be a faster way to draw the level? I was thinking I could merge all the tiles into one bitmap. But I don't know

Java: What is a good data structure for storing a coordinate map for an infinite game world?

感情迁移 提交于 2019-11-29 20:35:38
I am used to coding in PHP but I am not really proficient with Java and this has been a problem for some time now. I expect it to be a fairly easy solution, however I cannot find any good example code any way I search it, so here goes: I am programming a game that takes place in a 2d random generated infinite world on a tile based map (nitpicking: I know it will not be truly infinite. I just expect the world to be quite large). The usual approach of map[x][y] multidimensional array started out as a basic idea, but since Java does not provide a way for non-integer (i.e. negative) array key

How to repeat an image in C#

会有一股神秘感。 提交于 2019-11-29 17:27:33
问题 I have an image with a certain pattern. How do I repeat it in another image using GDI? Is there any method to do it in GDI? 回答1: In C#, you can create a TextureBrush that'll tile your image wherever you use it, and then fill an area with it. Something like this (an example that fills the whole image)... // Use `using` blocks for GDI objects you create, so they'll be released // quickly when you're done with them. using (TextureBrush brush = new TextureBrush(yourImage, WrapMode.Tile)) using

Repeat drawable in imageview?

爷,独闯天下 提交于 2019-11-29 05:44:09
Is it possible to repeat a drawable in an ImageView? I manage to repeat my drawable as a divider in a ListView, but not as an ImageView. Here is my repeated image definition: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/xdividerrepeat" android:tileMode="repeat"/> Thanks Markus Matthew Willis You could use a "dummy" view like a LinearLayout to accomplish this. Just create a LinearLayout with the size you need and set its background drawable to be your repeating bitmap. See Android Tile Bitmap . Yes it's possible. You just need to specify the scale

iPhone - CGImageCreateWithImageInRect rotating some camera roll pictures

一曲冷凌霜 提交于 2019-11-29 04:40:16
问题 I am working on a pixelate application for iPhone. Because the pictures taken with the iPhone 4 camera are too big and therefore the application is working really slow when updating the pixelated picture, I am trying to create tiles of the picture first and just update the tiles not the hole picture. When building the tiles, it works for camera roll picture taken in landscape mode (2592 x 1936 pxl) and with low resolution pictures, but not with picture taken in portrait mode (1936 x 2592 pxl)

How to remove gaps between tiled textures?

ε祈祈猫儿з 提交于 2019-11-29 01:53:14
I'm using LibGDX to make a platformer. I'm using square tiles for the platforms but when they are drawn some of them have gaps between them. When I zoom in/out or move the camera around the gaps move position. More details: Tiles are 32x32 and I have tried both 32x32 and 64x64. Tiles are lined up 32 pixels apart (e.g. first tile would be x=0 y=0, second x=32 y=0, and so on in both x and y directions). The gaps are not texture artifacts as I have checked this. I use the TexturePacker with padding. My best guess is that it is a problem when converting the textures to screen coords but have no

Java: What is a good data structure for storing a coordinate map for an infinite game world?

不想你离开。 提交于 2019-11-28 16:39:13
问题 I am used to coding in PHP but I am not really proficient with Java and this has been a problem for some time now. I expect it to be a fairly easy solution, however I cannot find any good example code any way I search it, so here goes: I am programming a game that takes place in a 2d random generated infinite world on a tile based map (nitpicking: I know it will not be truly infinite. I just expect the world to be quite large). The usual approach of map[x][y] multidimensional array started

Tiling a 2D Texture to Fill a Rectangle

故事扮演 提交于 2019-11-28 02:06:39
问题 Is it possible to tile an image in XNA so that it fills the entirety of a rectangle? I've tried Googling the subject, but I can't find anything that seems to work (I'm probably missing something obvious though). I found this MSDN page, but I can't seem to get it to work. Here's my code: spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null); But this just stretched the texture to fill the rectangle, not tile it. Any help is appreciated. Thanks in advance. 回答1:

Repeat drawable in imageview?

风格不统一 提交于 2019-11-27 23:36:50
问题 Is it possible to repeat a drawable in an ImageView? I manage to repeat my drawable as a divider in a ListView, but not as an ImageView. Here is my repeated image definition: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/xdividerrepeat" android:tileMode="repeat"/> Thanks Markus 回答1: You could use a "dummy" view like a LinearLayout to accomplish this. Just create a LinearLayout with the size you need and set its background drawable to be your

How to remove gaps between tiled textures?

China☆狼群 提交于 2019-11-27 16:19:11
问题 I'm using LibGDX to make a platformer. I'm using square tiles for the platforms but when they are drawn some of them have gaps between them. When I zoom in/out or move the camera around the gaps move position. More details: Tiles are 32x32 and I have tried both 32x32 and 64x64. Tiles are lined up 32 pixels apart (e.g. first tile would be x=0 y=0, second x=32 y=0, and so on in both x and y directions). The gaps are not texture artifacts as I have checked this. I use the TexturePacker with