quest window wiggling removed

master
GammelJAN 5 years ago
parent 269e214ada
commit 50b459acc0

@ -336,14 +336,6 @@ public class MapContainer {
}
}
// center camera
for(Actor a : getStage().getActors()){
if(a instanceof Player){
getStage().getCamera().position.set((a.getX()+a.getWidth()/2), (a.getY()+a.getHeight()/2), 0);
getStage().getCamera().update();
break;
}
}
if(getT() != null){
getT().draw(getStage().getBatch(), getStage().getCamera().position.x, getStage().getCamera().position.y, getStage().getCamera().combined);
if(getT().opacity == 0){

@ -1,4 +1,4 @@
/*
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
@ -27,6 +27,8 @@ import com.trs.main.Quest;
public class QuestWindow {
final double animationSpeed = 0.05;
BitmapFont font;
ShapeRenderer renderer;
boolean visible;
@ -61,7 +63,7 @@ public class QuestWindow {
}
float boxX = playerX + Main.CAMERA_WIDTH/2 - 0.2f*Main.CAMERA_WIDTH - 30;
float boxX = playerX + Main.CAMERA_WIDTH/2 - 200;
float boxY = playerY + Main.CAMERA_HEIGHT/2 - 0.4f*Main.CAMERA_HEIGHT - 30;
float boxWidth = 0.2f*Main.CAMERA_WIDTH;
float boxHeight = 0.4f*Main.CAMERA_HEIGHT;
@ -70,7 +72,7 @@ public class QuestWindow {
if(visible && Main.gamestate != 2){
if(visiblePerc < 1){
visiblePerc += 0.2;
visiblePerc += animationSpeed;
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
renderer.begin(ShapeRenderer.ShapeType.Filled);
@ -110,14 +112,13 @@ public class QuestWindow {
batch.end();
if(selectedQuest > 0){
UIDrawer.drawCharBox(batch, font, boxX - 16 , boxY + boxHeight/2 - 16, 32, "<");
UIDrawer.drawCharBox(batch, font, boxX - 16 , boxY + boxHeight/2 - 16, 32, "<");
}
if(selectedQuest < quests.length-1){
UIDrawer.drawCharBox(batch, font, boxX + boxWidth - 16 , boxY + boxHeight/2 - 16, 32, ">");
UIDrawer.drawCharBox(batch, font, boxX + boxWidth - 16 , boxY + boxHeight/2 - 16, 32, ">");
}
UIDrawer.drawCharBox(batch, font, boxX + boxWidth - 16 , boxY + boxHeight - 16, 32, "^");
UIDrawer.drawIcon(batch, boxX + boxWidth/2, boxY + boxHeight, 0);
Gdx.gl.glDisable(GL20.GL_BLEND);
@ -130,7 +131,7 @@ public class QuestWindow {
}
else{
if(visiblePerc > 0){
visiblePerc -= 0.2;
visiblePerc -= animationSpeed;
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
renderer.begin(ShapeRenderer.ShapeType.Filled);

@ -12,6 +12,7 @@ import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.sun.tools.javac.util.Abort;
/**
*
@ -19,6 +20,7 @@ import com.badlogic.gdx.graphics.g2d.Sprite;
*/
public class UIDrawer {
static Sprite box32 = new Sprite(new Texture(Gdx.files.internal("textureData/UI/box.png")));
static Texture questbook = new Texture(Gdx.files.internal("textureData/UI/questbook.png"));
@ -27,8 +29,7 @@ public class UIDrawer {
font.setColor(Color.WHITE);
switch(size){
case 16:
font.draw(batch, ""+character, x + 16 - getTextWidth(font, character)/2, y + 16 - getTextHeight(font, character)/2);
break;
throw new OutOfMemoryError("nice");
case 32:
box32.setPosition(x, y);
box32.draw(batch);
@ -36,6 +37,8 @@ public class UIDrawer {
font.draw(batch, ""+character, x + 16 - getTextWidth(font, character)/2, y + 16 + (getTextHeight(font, character)/2) - 2);
font.getData().setScale(1);
break;
default:
throw new OutOfMemoryError("nice");
}
batch.end();
@ -47,6 +50,8 @@ public class UIDrawer {
case 0:
batch.draw(questbook, x - questbook.getWidth()/2, y - questbook.getHeight()/2);
break;
default:
throw new Abort();
}
batch.end();

@ -41,14 +41,23 @@ public class GameScreen extends AbstractScreen{
@Override
public void render(float f) {
map.render(f);
Quest[] rects = new Quest[map.getPlayer().getQuests().size()];
for(int i = 0; i< map.getPlayer().getQuests().size(); i++){
rects[i] = map.getPlayer().getQuests().get(i);
}
qw.draw(rects, map.getStage().getBatch(), map.getPlayer().getX()+32, map.getPlayer().getY()+32);
//qw.draw(rects, map.getStage().getBatch(), map.getPlayer().getX()+32, map.getPlayer().getY()+32);
qw.draw(rects, map.getStage().getBatch(), map.getStage().getCamera().position.x, map.getStage().getCamera().position.y );
if(map.getCollidingDoor() != null) {
loadNewMap(map.getCollidingDoor().destinationMap, map.getCollidingDoor().destinationDoor);
}
Player a = map.getPlayer();
map.getStage().getCamera().position.set((a.getX()+a.getWidth()/2), (a.getY()+a.getHeight()/2), 0);
map.getStage().getCamera().update();
}
@Override

@ -18,5 +18,4 @@ public class DesktopLauncher {
//config.fullscreen = true;
new LwjglApplication(new Main(), config);
}
}
}
Loading…
Cancel
Save