Android :: Game Stutters When Drawing Outside Screen
Apr 25, 2010
I have a game built for 480x320 screen resolution. When playing the game on a phone with a higher screen resolution (480 x 800 or 480 x 856) the game automatically stretches to fit the screen which works great. Because of different screen dimensions there is a piece of the screen on the right side (game is in landscape mode) that is black, not used by the game. I want to fill this up with an image, so the whole screen is filled. I only draw that image on screens bigger than 480x320. This all works fine, the image is displayed exactly the way I want to. The only problem is that the game runs less smooth then it used to run. There are small stutters noticeable. When I just draw a rectangle instead of an image the same problem occurs. Does anyone have an idea why this is happening?
View 8 Replies
Sep 16, 2009
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 how to do this.
Anyway here is my code so you can see the problem:
package org.example.tutorial2d;
import android.app.Activity;
import android.os.Bundle;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.GestureDetector.OnGestureListener;
import org.example.tutorial2d.Panel;
public class Tutorial2D extends Activity implements OnGestureListener {
GestureDetector gestureScanner; Panel main;
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
gestureScanner = new GestureDetector(this);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
main = new Panel(this); setContentView(main); }
@Override public boolean onTouchEvent(MotionEvent me) {
return gestureScanner.onTouchEvent(me); }
@Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
main.handleScroll(distanceX,distanceY); return true; }
@Override public boolean onDown(MotionEvent e) { return true;
} @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return true;
} @Override public void onLongPress(MotionEvent e){
} @Override public void onShowPress(MotionEvent e) {
} @Override public boolean onSingleTapUp(MotionEvent e) { return true; } }
And the class that does all the work:
package org.example.tutorial2d;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import org.example.tutorial2d.Point;
public class Panel extends View {
private int scrollX = 0; private int scrollY = 0;
public Panel(Context context) { super(context);
} @Override public void onDraw(Canvas canvas) {
/*Bitmap scratch; //Drawable scratch;
//scratch = getContext().getResources().getDrawable(
// R.drawable.icon); canvas.drawColor(Color.BLACK);
//scratch.draw(canvas); int origin = 0;
scratch = BitmapFactory.decodeResource(getResources(), R.drawable.horizontal5);
canvas.drawBitmap(scratch, origin, origin, null);
int width = scratch.getWidth(); int height = scratch.getHeight();
scratch = BitmapFactory.decodeResource(getResources(), R.drawable.room4entrynesw3x3);
canvas.drawBitmap(scratch, origin + width, origin - 32, null);
[Code]
View 3 Replies
View Related
Nov 15, 2010
I've got a game, a custom View class draws my gameboard. I'm thinking of drawing some elements on a separate layer above the gameboard. I could do this in the View's canvas code, but since they won't change frequently, was thinking of introducing a frame layout to display this top layer.I'm not sure which route to take, the only reason I wouldn't do the FrameLayout is because I'm not sure if it has an impact on battery life. Everytime onDraw() is called, the system probably has to do an alpha composition of the two layers. Is that more battery consuming than drawing the elements from that layer myself in my canvas on every frame? Hard to answer since I'm not sure how complex the drawing will be yet, any general opinions?
View 1 Replies
View Related
Aug 24, 2010
Now I have (1: the UI-loop, there my SurfaceView is placed), (2: a second thread, there the draw function from the UI-loop is called AND the update calculations from my Engine) and (3: the engine, there all the calculations stuff are).Now I wonder how the best and smoothest way to do the SurfaceView independent from the actual frame rate. How shall I do so it will compensate if there is a low frame rate?
View 2 Replies
View Related
Oct 17, 2010
Is there a game for android in which a person draws stuff on screen and others users guess? I have a game like it on my sister's ipad but want one for my Samsung Epic. Game is super addicting! Please let me know!
View 4 Replies
View Related
Nov 5, 2010
Ii haven't made any big changes to my Desire and all was working well. suddenly a couple of days ago i noticed that things slowed down significantly.
exmples: when drawing the unlock screen, there is a big lag till the home screen comes up huge lag in opening programmes or menus
so, the only app i recently installed was the BA (british airways) android app. could this have affected the whole phone?
what steps can i take to check what might be wrong?looking at the SPARE PARTS app, i can see that CPU usage shows a huge bar for "init".i don't know if this is a normal process? anyone got info on this? might have nothing to do with my phone lagging of course.
View 1 Replies
View Related
Jan 7, 2010
I wrote a reading software. I implemented the page turning effect when user tap the screen to turn to next/pre page. The display is ok on G1 (320X200 size) but it can not works well on Droid(480*854 size), the font looks a litter fuzzy, not clear as G1. I explain my codes for page turning:
1) create a canvas A
2) create bitmap.
3) set bitmap on canvas A
4) draw the new page content on canvas A
5) the current showing page has been saved in bitmap before since we do from step 1) to setp 4),
6) In order to implement the turning effect of scrolling from left to right, I draw the old bitmap part and draw the new bitmap part until the whole new bitmap has been drawn. all of bitmaps are drawing by canvas.drawBitmap() in onDraw() function.
7) when step 6) is done, it means the new page has been shown on screen, and the bitmap has been saved to use in next page turning.
The above is the whole actions for my page turning. On G1, no problem. But on Droid phone, the font is not clear, I tried if I directly draw text by canvas in OnDraw() not through bitmap, It is ok, but it can not implement the page turning effect that I need. I don't know why, could you please help me to take a look and tell me where is wrong or miss some steps?
View 2 Replies
View Related
Nov 15, 2010
How to draw, say, a rectangle on the screen with it being proportional to the current device?
e.g. a rectangle, centered on the viewport, one pixel smaller than the screen on each border.
I can live with Orthogonal, but would like perspective (basically everything at Z=something should be proportional to the screen, and the upper parts of the elements being distorted by perspective)
I can calculate everything on my own if i know the relation... but i don't have a starting point.
I could experiment and get to a relation myself... i even resorted to that while coding for the Wii, but that's a really bad decision on Android and all the screen ratios/sizes out there...
View 1 Replies
View Related
Sep 3, 2009
My application required to draw image on full screen. now the phone screen size will be different. So will i have to make different image for each phone or i can use just one image and it can display on full screen in any device.
View 2 Replies
View Related
Jun 27, 2010
Can somebody take me step-by-step how to draw 2D stuff over a 3D scene (such as controls, etc.). What I've been doing so far has not been working (it only draws the 3D scene), which is (in every frame): draw the 3D scene as normal, projection matrix mode, load identity, call GLU.gluOrtho2D(gl, 0, myScreenWidthInPixels, 0, myScreenHeightInPixels), switch the array pointers (vertices and texture coords) to the ones for my 2D stuff, then drawElements with an appropriate index list. (then switch the array pointers back so the 3D stuff works again).I get nothing added to the screen (just the 3D stuff).Do I need to be doing something else for it to draw? Can somebody take me step-by-step?
View 5 Replies
View Related
Nov 16, 2009
I have been playing with Android for a couple of months, so I'm still kindof newbie on this. I've looking for previous questions like mine, but I was unable to find any proper solution. So here goes my question:
I'm trying to draw a Camera Preview in a certain part of the screen (for instance, square upper-left). So what I suppose I should do is the following:
CODE:.............
And on the Preview Class I have the following lines:
CODE:....................
View 2 Replies
View Related
Sep 17, 2010
Is there off screen drawing possible in android like a imageContext in objective C. if it is kindly tell me the link or some kind of hint.
View 2 Replies
View Related
Nov 10, 2010
I'm developing an Android application. I'm very new on it. I have the following classes:
class CustomGLSurfaceView extends GLSurfaceView
class CustomRenderer implements GLSurfaceView.Renderer
CustomGLSurfaceView uses CustomRenderer to render a cube on onDrawFrame method.
I've added an onTouchEvent(MotionEvent event) on CustomGLSurfaceView to manage touch events:
class CustomGLSurfaceView extends GLSurfaceView {
// For touch inputs - previous touch (x, y)
private float previousX; private float previousY;
private CustomRenderer myRenderer; public CustomGLSurfaceView(Context context) {
super(context); myRenderer = new CustomRenderer(); setRenderer(myRenderer);
} @Override public boolean onTouchEvent(MotionEvent event) {
float currentX = event.getX(); float currentY = event.getY();
switch (event.getAction()) { case MotionEvent.ACTION_MOVE:
myRenderer.handleMovement(currentY, currentY, previousX, previousY);
} // Save current x, y
previousX = currentX; previousY = currentY;
return true; // Event handled } }
May I have to modify onDrawFrame to draw something new or to rotate the cube? I thing I must do it on handleMovement.
View 1 Replies
View Related
Mar 19, 2012
YouTube 3.5.5 faces random stutters during playback on their ICS?
I face a 1 second of freeze after 1-2 min of video playback.
SGS2
View 1 Replies
View Related
Mar 18, 2013
So my Galaxy s3 all of a sudden started to have stutters, i have a custom rom Foxhound 2.3, and when i try any custom kernel it lags as hell. (Stock also gives stutters so its not kernel related i think)
For example perseus stutters my phone in app drawer and every time i open an application.
Syah 1.8.9. although its better, still have some stutters...
the only one that can have the phone more stable is the stock one. I dont really mind having the stock kernel its just that it makes the phone more stable but it still stutters when opening apps and in the app drawer.
Its weird because in applications i have no problems, and when im playing games is all good to.. even the more heavy intensive ones. Also my boot and shutdown animation stutter or jitters a little bit.. a thing that dint happened.
Also the benchmarks are good as always +/- 16000 on antutu, no changes... so i don't really understand whats happening...
Steps so far:
-Tested other custom roms including CM10.1 Nightly
-Tested various kernel.
-Flashed stock rom with odin
Every time with megawipe. always...
View 2 Replies
View Related
Oct 16, 2010
I got Samsung Galaxy 5.
I got some gameloft games (HD versions) installed but as I Run them only Top left (approx 1/4)view of game screen appers.
As whole game can not to fitted on one screen..
|--------------------|
| |
| |
| |
|Gamel |
| |
|--------------------
It looks like half of screen is cut like on "oft" of Gameloft is invisible
View 3 Replies
View Related
Nov 4, 2009
I was watching a video on Android 2.0 (from the Google Conference, I believe) and the presenter show a feature that allowed you to pull up your contact list and simply start "drawing" the letters of the contact you are looking for and it will jump right to it, rather than having to scroll down. For example you would draw "e" then "r" and it would jump right to Eric.
I haven't seen this discussed anywhere else when testing the phone, so I thought either this feature didn't make it or it needs to be enabled or something.
Anyone else seen or know anything about this?
View 5 Replies
View Related
Feb 25, 2010
It would end up looking something like the PSP. You would think that this would be an incredible feature for gamers and any platform that was serious about gaming. Then we wouldn't have to use touchscreen controls, barely passable d-pads, or optical trackballs?
View 3 Replies
View Related
Jun 15, 2010
What's the best way of intercepting screen touches and coords during a game loop? At this point, I don't have a View from my main.xml file, so the normal OnTouchEvent doesn't apply, as far as I can tell. What's the usual procedure for this?
View 2 Replies
View Related
Dec 17, 2009
In my game because it is a board game, I do not want the screen to timeout which the user is playing my game. Any idea on how to do this?
View 2 Replies
View Related
Jan 18, 2012
I am working on a game for android at the moment, and was wondering how i would change the screen depending on orientation.
So if the user turned the phone horizontally then the app would be viewed horizontally if you know what i mean
Also how would i make a timer, so if a button were pressed, how would i say stop for 2 seconds and then go to link?
View 3 Replies
View Related
Apr 16, 2010
Anyone have download and played the "Air Attach"? In this game,
1.The man can go right when you touch and move finger to the right and can go left when touch and move finger to the left,
2.Touch and release, it is launching a missile
I'm also want to develop a game and have this function, Would you tell me how to implement it?
View 7 Replies
View Related
Jun 24, 2010
So I was planning on writing a Chess-based mini game as part of a project. I was working on my pitch when I realized that I had to represent 64 clickable squares on a screen of that size. I found a couple of ways around it. Like letting them choose a row number from 1-8 and a column number from A-H OR providing them with four arrow keys to navigate across the screen. But it just takes the fun and intensity out of the game.
View 8 Replies
View Related
Sep 18, 2009
I've been working on a game framework for a little while, and while its far from perfect, I've put the current version online. To be honest, I haven't used much OpenGL in the past. Before last week I had never tried using it. If anyone would like to take a look, please do, I'd appreciate all the help possible on speeding it up. There are many features I have in mind and am planning at the minute, but so far it supports:
# Texture and Sprite management # Text, using TTF fonts # Organised layers # Two audio management classes, one optimized for music, the other for sound effects # Sprite dynamics (acceleration, terminal velocity, collisions) # Animation # Handlers to manage events fired through movement, animation, screen touches, accelerometer input, device shaking and collisions # Several minor features aimed at speeding development, such as screen settings and vibration.
View 1 Replies
View Related
May 22, 2010
I have a square grid, for a turn based game ( grid is similar to the chess board ), but the moves in the games are different based on whether you have lapped your opponent pawn at least once or not.i.e if you have not lapped (beaten any of the opponents pawns) in the outer most grid as below.if you have lapped your opponent pawn once at least, then you get to reach home,this way.Any player having all his pawns reaching "home" first wins.The ones in yellow are safe-houses, i.e both the opponent pawn and the player's pawn get to stay in the same grid, this is not considered to be lapping ( the opponent ).The lapped pawn will return to its start point.Now the question is, what is the effective way to store the paths for the all the pawns.we will have 4 pawns for the player and 4 opponent pawns.Is there any pattern to store such static information, in a elegant way?
View 1 Replies
View Related
Nov 12, 2010
I have a puzzle game with a 7x7 grid of graphics, and a timer, its just about ready to go. But I am stuck on how to go about saving/continuing game. For example when someone exits I want them to be able to save and exit, then come back and click continue to pick up where they left off with all of the graphics in the right place, timer and score. I looked at onSaveInstanceState android examples, but not sure if this is what I need or how to implement it in my case.
View 8 Replies
View Related
Apr 25, 2014
i am developing application on android but i have a problem, how can i fit my app to every screen size and also tablets?
I mean if i have images in the game and background so lets say it looks fine on galaxy s3 but on tablet it will look very small , how can i make the app scale itself to the screen without hurting the image and background looks.
View 5 Replies
View Related
Mar 26, 2014
I want to make a splash screen for my game. I need the image to fit the screen's width but I want the height to be larger than the screen's. Than, I will have an animation moving the image vertically, hiding the top part and showing the bottom one.
I have searched a lot and I am more puzzled now on how I should do this.
Firstly the only solution I found for the fitting part was a combination of java and xml. But the problem here is that the java class doesn't produce a bigger than the screen image, but a cropped image. So, I can't make the animation later on.
Should I do it only in java and don't use xml at all? Or is it possible to do this through xml only (which would be better I think)?
View 1 Replies
View Related
Aug 11, 2013
so I got this phone, mediatek MT6589 1,2ghz with 1080x1920 resolution display, GPU powerVR SGX544 (those are what it says on the spec)
when playing 2D games, there are no lags, stutterings, i got smooth animations and responsive controls.
but when trying to play 3D based games, i only got like 5-10 fps, even for low end games like asphalt 6, riptide 1, minion rush, etc.
some 3D games have the option to lower textures, effects, shaders, but some don't.What I'm trying to ask is :
- Can we tweak, modify build.prop to trick those games (that do not have quality settings in options) to load low quality graphics? If we can, which line?
- I tried to install "resolution changer lite" from the playstore, looks like when I change resolution to 1024x600, every games run smooth without lag. But this resolution changing really messed up my homescreen, icons, menus, even hardware buttons don't work.
FYI: for reference this device's antutu score is 12000+, 2d score= 600, 3d score = 2100
View 1 Replies
View Related
Aug 23, 2010
Anyone got it working? when i launch it loads up then when selecting new game white blocks over the screen. Update 9/3/10, http://www.symbiantalk.net/showthread.php?41938-The-Sims-3-HD-Android-Update-12-08-10 scroll down half way and follow links for SGS phone it is the vibrant sims3.apk =D
View 6 Replies
View Related