Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.test.myfirsttriangle;
- import com.badlogic.gdx.ApplicationListener;
- import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
- import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
- public class MyFirstTriangle implements ApplicationListener {
- public static int width = 5;
- public static int height = 2;
- public static float blockWidth = 0.25f;
- public static float blockHeight = 0.1f;
- public static boolean blocks[][];
- @Override
- public void create() {
- for (int i = 0; i < height; i++) {
- for (int j = 0; j < width; j++) {
- blocks[i][j] = true;
- }
- }
- }
- @Override
- public void dispose() { }
- @Override
- public void pause() { }
- @Override
- public void render() {
- //Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
- //mesh.render(GL10.GL_TRIANGLES, 0, 4);
- ShapeRenderer shapeRenderer = new ShapeRenderer();
- shapeRenderer.begin(ShapeType.FilledRectangle);
- shapeRenderer.setColor(0, 1, 0, 1);
- for (int i = 0; i < height; i++) {
- for (int j = 0; j < width; j++) {
- shapeRenderer.filledRect((float)(-0.95+blockWidth*i), (float)(0.85+blockHeight*j), blockWidth, blockHeight);
- }
- }
- shapeRenderer.end();
- }
- @Override
- public void resize(int width, int height) { }
- @Override
- public void resume() { }
- }
Add Comment
Please, Sign In to add comment