I have been using a simple 3rd party game engine, from the book "Beginning Android Games".
The example code uses a fixed resolution (320 x 480) and this is scaled on output. Not surprisingly, the bitmaps and everything else is scaled and looks pretty poor. My code is set up to use the native resolution of the device and handles scaling internally. I can modify the code to use whatever resolution I want, and this works fine. In this engine, the graphics and almost everything else is handled through abstract classes and interfaces. The way the game engine is set up, it doesn't actually use the Android graphics engine until after the game environment is set up. The first place that I can get hold of the actual resolution through SurfaceView is in the "run" loop, way after the game engine has been initialised. I need the screen resolution *before* I set up the location of sprites and game state. Modifying the engine to move the game setup into the run method would break lots of other things. Can anybody tell me how I can get the actual hardware resolution of the device (so I can set up the game objects properly) without waiting until the "run" method which has access to SurfaceView? dstRec in the following gives me the resolution, but this is way to late for me to use when setting up the game. public void run() { Rect dstRect = new Rect(); long startTime = System.nanoTime(); while(running) { if(!holder.getSurface().isValid()) continue; float deltaTime = (System.nanoTime()-startTime) / 1000000000.0f; startTime = System.nanoTime(); game.getCurrentScreen().update(deltaTime); game.getCurrentScreen().present(deltaTime); Canvas canvas = holder.lockCanvas(); canvas.getClipBounds(dstRect); canvas.drawBitmap(framebuffer, null, dstRect, null); holder.unlockCanvasAndPost(canvas); } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en