[Q] [idea]Alternative way to achieve 2d hud in 3d game - Android Software Development

I asked a similar question on stackoverflow but I didn't get any replies(which is weird)
I'm trying to create a HUD for my 3D game. originally I was planning on just adding a textview to show the score but that looks ugly, then I thought about using an orthographic projection to render 2d images and text.
But then I thought of something. There are two types of way to make games on android: using OpenGL ES and using Canvas
How much of an effect would adding a canvas on top of the opengl surfaceview have on speed? using a canvas to draw the hud is definitely easier and gives you more flexibility, but would this have too much of a negative effect on performance?
I thought about this because when making the 2D hud with ortho perspective I was using separate 'nodes' that moved around in the 3d space, which works, but then when I was adding nodes for drawing text I saw that I needed to use a canvas to draw to bitmap, and then map that bitmap as a texture to a plane mesh....That seemed to me like a waste of functionality because a canvas can do much more than just draw text.
So my question to you is:
Would having to surface views on top of each other (one for opengl, on for canvas) have a hug negative effect on speed, or not work on older devices, etc?

It's not about adding one canvas, if there are perfomance issues more will be needed to have a visible effect.
XDA App

Related

Uniform Look 'n Feel

We all find a lot of very interesting software in this forum which at the moment is far superior to what Microsoft or the vendors come up with.
The thing that bothers me (personally) a bit is the non-uniformity of all the applications offered. One application is doing nice pulldown menus with custom based settings while the other is doing the native windows thingy.. If we could work out a standard "framework", this way we spare ourselves the work of re-inventing the wheel over and over again and we can focus on the actual functionality.
Here some examples of what could be done:
- Default way of browsing files (kinetic scrolling list, like throttle launcher)
- Default listbox (see 1st)
- Semi Transparent keyboard (to see what you're typing through the KB)
- Transparent scrollbars (like the omnia viewer)
- Transparent menu's
- Look for active today screen and adapt wallpaper (Manilla, 2day, etc.)
- Sizeable custom title bars (for big screens or small screens)
- Resolution aware (no pixels but %'s)
- Tilt Sensor / Accelerometer abstraction
- Uniform but skinable (skin will be used for every app based on this famework)
- Etc.
Is there somewhere being worked on this kind of thing? I was thinking in making some open source re-usable classes in which we can put it all.. I don't say I can do this (alone) but if we make it a group effort it could be a very nice concept imho..

[Q] Custom View question

Apparently XDA thinks my code is a link to an outside website ??? so it's attached in a .txt
Here's my problem. I finally figured out how to get my custom view
working, but discovered that "canvas.drawCircle(..)" draws based on
the screens dimensions and not the bitmap drawn to the canvas (I may be
misusing some terms/concepts here, still a little iffy on the whole
custom view).
Basically, I have a bitmap of a map image (decoded from a .jpg resource), and I want to be able to draw relative to the bitmap's pixel dimensions, and to the bitmap if possible, so that when it's panned/zoomed, it stays in its respective
place. Here is the code for my custom view. I x'd out my latitude and
longitude. The touch handling is code adapted from a Hello, Android
(3e) excerpt.
I'm currently working with "MAP" mode, but it will also come into
play for NAV. But I basically need to draw relative to the bitmap, which is
scaled and manipulated through the canvas(?) so that the current
location dot will stay in the same spot when the bitmap is panned or
zoomed, instead of staying in a static location based on the screen's
dimensions. Any advice?
-Mike

Pinch Zoom Transformations

Hey everyone!
I have been trying to get pinch zoom working in a SurfaceView, and I can get it to detect if a pinch is happening and all, but here is my dilemma.
I am using canvas to draw a grid to the background. The grid is a 2d array of Rect objects, so as I pinch, I change the size of the Rects. My problem is getting it to zoom into the correct area of the grid.
So, my question is how to do the correct transformation on something like this? Is there a way to put an ImageView into the canvas and draw to that? I will post the relevant code when I get home from work later today, but I figured I would post this just to see if anyone had done something similar.
Thanks in advance!

How to Optimize Your Flash SWF Files

Flash files are used widely, but when people use it, they always need new demand. People always chase perfect. SWF files optimization is one of the chasing things. Here is the tip for how to optimaiz flash swf files.
General optimization
Please use symbols, animated or otherwise, for every element that appears more than once. You need to use tweened animations when you are creating animation sequences, because these animations occupy less file space than keyframs. Use movie clips instead of graphic symbols for animations sequences. You need to reduce the area of change in each keyframe as possible as you can to make the action happen in as small area as possible. Try your best to avoid animating bitmap elements and use bitmap images as background or static elements.
Colors
You can use Color menu in the Symbol Property inspector to create many instances of a single symbol in different colors. Then you need to use Color Mixer to match the color palette of the document to a browser-specific palette. Use gradients sparingly. You need about 50 bytes for filling an area with gradient color. You can use alpha transparency sparingly because it can slow playback.
Texts and fonts
You need limit the number of fonts and font style. Please use embedded fonts sparingly because they can increase file size. Select only the needed characters instead of including the entire font for Embed Fonts options.
Lines and elements
Do your best to group elements. You can separate elements that minimize the number of separate lines that are used to describe shapes by using layers. Reduce the number of special line types as possible as you can, such as dashed, dotted, ragged. Solid lines require less memory and lines that are created with the Pencil tool need less memory than brush strokes.
With these tips, you need not to spend extra money to buy some software or tool. What’s more, these tips are easy to understand, you are not required much flash knowledge.

Ball game - chaning ball position

I am making simple ball game and l have problem.I can't change position of Ball. I tried:
1. SetX() and setY() but lower APIs aren't supported.
2. Params and margins but when I move it left or right, the whole activity content is moving with it. Up and down moving is working fine. (Activity will have 10 ImageViews)
3. Android animations - Problem is that I can't get coorinates (getLeft(), getTop()) during the animation.
4. Canvas and draw elements - I change position of image with onDraw() and invalidate() functions but when I but backgorund and all other images (as bitmaps) it is very slow.
Can you give to me any ideas or suggestions? Thanks in advance.
Can you post the code? What do you exactly want to be done, there can be many different "ball games". You want to change the position of a bitmap or circle on the screen create x and y variables, draw bitmap or circle using them and if they change, the object will be drawn elsewhere

Categories

Resources