Hot answers tagged

9

It won't hurt performance. It might in fact be (very, very negligible) faster because you save the overhead of passing these objects to the game objects. The reason static classes are often frowned upon is that their static properties are global variables and globals cause all kinds of problems architecture-wise. For example, when you ever decide you might ...


3

If you're definitely only ever going to have one instance of these objects, and presumably you are, then this would be a better way to go. However, maybe a better solution would be to use the Singleton pattern, and (for example) create a static GetScreen() method in the Screen class that any other class can call to obtain the single instance of the Screen ...


1

The nice thing about the Factory pattern is that the base class can be abstract and you can have different derived Factory classes. That means you can have an ExplosionFactory, a BulletFactory, an EnemyFactory and so on, which all inherit from the basic class GameObjectFactory. Any code which is common to all objects would be in the GameObjectFactory while ...


1

I don't know android specifically, but if you are using OpenGL ES, you can use a shader to make this work. First create a image like this in black color. Then use a color tint. Now use a fragment shader to draw this texture. The code looks like this. #ifdef GL_ES precision mediump float; #endif varying vec2 texCoords; uniform vec4 color; uniform ...


1

Your whole matrix is incorrect. For example, this is one of the ways it should look like: So, in code: dest.m00 = 1.0f / (tanHalfFOV * aspectRatio); dest.m10 = 0; dest.m20 = 0; dest.m30 = 0; dest.m01 = 0; dest.m11 = 1.0f / tanHalfFOV; dest.m21 = 0; dest.m31 = 0; dest.m02 = 0; dest.m12 = 0; dest.m22 = -(far + near) / range; dest.m32 = -2 * far * near / ...



Only top voted, non community-wiki answers of a minimum length are eligible