Rev 194 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.Bauzoid.graphics;
import android.content.res.Resources;
import com.gebauz.Bauzoid.app.BauzoidException;
import com.gebauz.Bauzoid.app.Game;
import com.gebauz.Bauzoid.app.GameObject;
import com.gebauz.Bauzoid.graphics.renderstate.RenderStates;
public class Graphics extends GameObject
{
private int mWidth =
0;
private int mHeight =
0;
public RenderStates renderStates =
new RenderStates
();
/** Constructor. */
public Graphics(Game game
)
{
super(game
);
try
{
renderStates.
initialize();
}
catch (BauzoidException ex
)
{
ex.
printStackTrace();
}
}
public void onSurfaceLost
()
{
// destroy resources
}
public void onSurfaceRecreated
()
{
// recreate resources
}
/** Update the GL Surface's dimensions. */
public void updateSurfaceDimensions
(int w,
int h
)
{
mWidth = w
;
mHeight = h
;
}
/** Get the GL Surface's width in pixels. */
public final int getWidth
()
{
return mWidth
;
}
/** Get the GL Surface's height in pixels. */
public final int getHeight
()
{
return mHeight
;
}
/** Convenience method to get the game app's resources. */
public final Resources getResources
()
{
return getGame
().
getResources();
}
}