Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mygdx.game;
- import com.badlogic.gdx.ApplicationAdapter;
- import com.badlogic.gdx.Game;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.graphics.GL20;
- import com.badlogic.gdx.graphics.Texture;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- public class sandbox_main extends Game {
- SpriteBatch batch;
- Texture img;
- @Override
- public void create () {
- batch = new SpriteBatch();
- img = new Texture("badlogic.jpg");
- setScreen(new testScreen());
- }
- @Override
- public void render ()
- { super.render();
- /*Gdx.gl.glClearColor(0, 1, 0, 1);
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
- batch.begin();
- batch.draw(img, 0, 0);
- batch.end();*/
- }
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- package com.mygdx.game;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.Input.Keys;
- import com.badlogic.gdx.InputProcessor;
- import com.badlogic.gdx.Screen;
- import com.badlogic.gdx.graphics.GL20;
- import com.badlogic.gdx.graphics.Texture;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- public class testScreen implements Screen, InputProcessor
- { SpriteBatch batch;
- Texture img;
- public void show()
- { batch = new SpriteBatch();
- img = new Texture("badlogic.jpg");
- System.out.println("I am inside the Show method :P");
- }
- public void render(float delta)
- {
- Gdx.gl.glClearColor(1, 0, 0, 1);
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
- batch.begin();
- batch.draw(img, 0, 0);
- batch.end();
- }
- public void resize(int width, int height)
- {
- }
- public void pause()
- {
- }
- public void resume()
- {
- }
- public void hide()
- {
- }
- public void dispose()
- {
- }
- @Override
- public boolean keyDown(int keycode) {
- System.out.println("Key Pressed! "+keycode);
- return false;
- }
- @Override
- public boolean keyUp(int keycode) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean keyTyped(char character) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean touchDown(int screenX, int screenY, int pointer, int button) {
- System.out.println("Touch Down!! "+screenX+" , "+screenY);
- return false;
- }
- @Override
- public boolean touchUp(int screenX, int screenY, int pointer, int button) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean touchDragged(int screenX, int screenY, int pointer) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean mouseMoved(int screenX, int screenY) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean scrolled(int amount) {
- // TODO Auto-generated method stub
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement