Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void render(float delta) {
- // Clear the Screen!
- Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
- Gdx.gl.glClearColor(0, 0, 0, 1);
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
- System.out.println("DrawCalls: " + GLProfiler.drawCalls);
- // Convert the touch coordinates
- FixedTouch = viewport.unproject(new Vector2(Gdx.input.getX(), Gdx.input.getY()));
- // Set the position of the camera, based on the players location. The
- // Player will always be centered!
- Camera3D.Position.x = player.Position.x + 0.5f;
- Camera3D.Position.z = -player.Position.z + 32.25f;
- // Set this instance of WhichOption
- WhichOption = pauseMenuButtons.WhichOption;
- // Debugging
- // player.Debug();
- Sign.Update(player.Position, player.Direction);
- player.Talking = Talking;
- // Run Methods
- // CameraControls();
- // ModelControls();
- // TextControls();
- HandleControls();
- HandleMenus();
- PauseMenuControls();
- // Update the sprite for animation purposes.
- pokemonSprite.Update(delta, false);
- // Make the pokemon bounce.
- if (WhichMenu == "PokemonMenu") {
- Timer.Update(delta);
- if (Timer.getTimeElapsed() < Timer.getTargetTime() / 2) {
- YAdd = 0;
- }
- if (Timer.getTimeElapsed() > Timer.getTargetTime() / 2) {
- YAdd = 2;
- }
- if (Timer.isCompleted()) {
- Timer.Reset();
- Timer.Start();
- }
- }
- // Update All of the Objects
- pauseMenuButtons.Update();
- player.Update(delta, PalletTownCollisionMap);
- Camera.update();
- poketch.Update();
- PalletTown.Update(delta);
- tweenManager.update(delta);
- Camera3D.Update();
- // Draw 3d Stuff
- modelBatch.begin(Camera3D.Camera);
- PalletTown.Draw(modelBatch, environment);
- modelBatch.end();
- if(player.CalculateDistance){
- for (int i = 0; i < Trees.size(); i++) {
- Trees.get(i).CalculateDistance(player);
- }
- for (int i = 0; i < Flowers.size(); i++) {
- Flowers.get(i).CalculateDistance(player);
- }
- for(int i = 0; i < Grass.size(); i++) {
- Grass.get(i).CalculateDistance(player);
- }
- player.CalculateDistance = false;
- }
- //When placed here drawcalls is 332.
- GLProfiler.reset();
- // Draw All of the Decals!
- for (int i = 0; i < Trees.size(); i++) {
- if (Trees.get(i).DistanceFromPlayer < DrawDistance) {
- Trees.get(i).Draw(decalBatch);
- }
- }
- for (int i = 0; i < Flowers.size(); i++) {
- if (Flowers.get(i).DistanceFromPlayer < DrawDistance) {
- Flowers.get(i).Draw(decalBatch);
- }
- }
- for(int i = 0; i < Grass.size(); i++) {
- if (Grass.get(i).DistanceFromPlayer < DrawDistance) {
- Grass.get(i).Draw(decalBatch);
- }
- }
- player.Draw(decalBatch, Camera3D);
- if (OtherPlayers.size() > 0) {
- for (int i = 0; i < OtherPlayers.size(); i++) {
- OtherPlayers.get(i).SecondaryUpdate(delta, player.Position, player.Direction);
- OtherPlayers.get(i).Draw(decalBatch, Camera3D);
- }
- }
- decalBatch.flush();
- //When reset is placed here, the drawcalls is 8.
- }
Advertisement
Add Comment
Please, Sign In to add comment