• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Help with screen drawing issues

Hello. I have been working on a multiplatform game engine (working on android specific code first, due to its opengl being the most finicky...), and I was wondering if anyone could help me with this rendering issue. Alright, so in the main activity, I'm creating a new instance of a class called "Game" which is a class that will eventually be abstract, but until then, it will receive input, process on screen objects, and render the screen (an input, tick, and render method for those who follow the same conventions I am currently using). In my custom GLSurfaceView class, I am passing in this instance of the Game object in the constructor, which is then passed into the custom GLView class. For some reason, the Game class will not render when done in this fashion, but WILL render when created inside the GLView. This is obviously not acceptable for an engine, due to not being object-oriented, and not being able to process the game separate from rendering it. Here's the relevant code:

Main Activity:
Code:
public Game game;

@Override
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    game = new Game();
    glsview = new GLSView(this, game);
    setContentView(glsview);
}

Custom GLSurfaceView (GLSView):
Code:
public GLView glview;

public GLSView(Context context, Game game){
    super(context);
    glview = new GLView(game);
    ...

GLView:
Code:
public Game game;
public GLView(Game game){
    this.game = game;
}
 
Back
Top Bottom