Updated for new GameKit version.

This commit is contained in:
Quentin Bazin 2019-04-13 15:06:52 +02:00
parent 1b373d9c2a
commit 0cc6cbb873
19 changed files with 26 additions and 27 deletions

View File

@ -14,13 +14,13 @@
#ifndef PLAYERBOX_HPP_
#define PLAYERBOX_HPP_
#include <gk/gl/IDrawable.hpp>
#include <gk/gl/Drawable.hpp>
#include <gk/gl/VertexBuffer.hpp>
#include <gk/gl/Transformable.hpp>
#include "Player.hpp"
class PlayerBox : public gk::IDrawable, public gk::Transformable, public Player {
class PlayerBox : public gk::Drawable, public gk::Transformable, public Player {
public:
PlayerBox();

View File

@ -14,13 +14,13 @@
#ifndef CUBE_HPP_
#define CUBE_HPP_
#include <gk/gl/IDrawable.hpp>
#include <gk/gl/Drawable.hpp>
#include <gk/gl/Transformable.hpp>
#include <gk/gl/VertexBuffer.hpp>
class Block;
class Cube : public gk::IDrawable, public gk::Transformable {
class Cube : public gk::Drawable, public gk::Transformable {
public:
Cube(float size = 1.0f);

View File

@ -18,7 +18,7 @@
#include <gk/graphics/Sprite.hpp>
class Text : public gk::IDrawable, public gk::Transformable {
class Text : public gk::Drawable, public gk::Transformable {
public:
Text();

View File

@ -16,10 +16,10 @@
#include <gk/core/Rect.hpp>
#include <gk/core/SDLHeaders.hpp>
#include <gk/gl/IDrawable.hpp>
#include <gk/gl/Drawable.hpp>
#include <gk/gl/Transformable.hpp>
class Widget : public gk::IDrawable, public gk::Transformable {
class Widget : public gk::Drawable, public gk::Transformable {
public:
Widget(Widget *parent = nullptr) : m_parent(parent) {}
Widget(unsigned int width, unsigned int height, Widget *parent = nullptr)

View File

@ -23,7 +23,7 @@ class ClientCommandHandler;
class ClientPlayer;
class Hotbar;
class BlockCursor : public gk::IDrawable {
class BlockCursor : public gk::Drawable {
public:
BlockCursor(ClientPlayer &player, ClientWorld &world, ClientCommandHandler &client)
: m_player(player), m_world(world), m_client(client) {}

View File

@ -16,7 +16,7 @@
#include <gk/graphics/RectangleShape.hpp>
class Crosshair : public gk::IDrawable {
class Crosshair : public gk::Drawable {
public:
Crosshair();

View File

@ -18,7 +18,7 @@
class ClientPlayer;
class DebugOverlay : public gk::Transformable, public gk::IDrawable {
class DebugOverlay : public gk::Transformable, public gk::Drawable {
public:
DebugOverlay(const ClientPlayer &player);

View File

@ -22,7 +22,7 @@
#include "DebugOverlay.hpp"
#include "Hotbar.hpp"
class HUD : public gk::Transformable, public gk::IDrawable {
class HUD : public gk::Transformable, public gk::Drawable {
public:
HUD(ClientPlayer &player, ClientWorld &world, ClientCommandHandler &client);

View File

@ -32,8 +32,6 @@ class GameState : public gk::ApplicationState {
public:
GameState(const std::string &host = "localhost", int port = 4242);
void setupClientCommandCallbacks();
void onEvent(const SDL_Event &event) override;
void update() override;

View File

@ -49,7 +49,7 @@ class LuaGUIState : public InterfaceState {
std::vector<CraftingWidget> m_craftingWidgets;
std::vector<InventoryWidget> m_inventoryWidgets;
std::vector<std::unique_ptr<Widget>> m_widgets;
std::vector<std::unique_ptr<gk::IDrawable>> m_drawables;
std::vector<std::unique_ptr<gk::Drawable>> m_drawables;
gk::RectangleShape m_background;
};

View File

@ -14,7 +14,8 @@
#ifndef CLIENTCHUNK_HPP_
#define CLIENTCHUNK_HPP_
#include <gk/gl/IDrawable.hpp>
#include <gk/gl/Drawable.hpp>
#include <gk/gl/Texture.hpp>
#include "Chunk.hpp"
#include "ChunkBuilder.hpp"

View File

@ -22,7 +22,7 @@
class ClientCommandHandler;
class ClientWorld : public World, public gk::IDrawable {
class ClientWorld : public World, public gk::Drawable {
public:
ClientWorld();

View File

@ -64,8 +64,8 @@ void Text::updateTextSprites() {
// this piece of code to make it look good
// I'll remove it later anyway
void Text::updateCharWidth() {
const int width = m_texture.width();
const int height = m_texture.height();
const int width = m_texture.getSize().x;
const int height = m_texture.getSize().y;
unsigned int data[width * height];
gk::Texture::bind(&m_texture);

View File

@ -22,9 +22,9 @@ Crosshair::Crosshair() {
m_vShape1.setSize(0.0002 * xFactor, 0.001 * yFactor - m_hShape.height() / 2);
m_vShape2.setSize(0.0002 * xFactor, 0.001 * yFactor - m_hShape.height() / 2);
m_hShape.setColor(gk::Color{200, 200, 200, 180});
m_vShape1.setColor(gk::Color{200, 200, 200, 180});
m_vShape2.setColor(gk::Color{200, 200, 200, 180});
m_hShape.setFillColor(gk::Color{200, 200, 200, 180});
m_vShape1.setFillColor(gk::Color{200, 200, 200, 180});
m_vShape2.setFillColor(gk::Color{200, 200, 200, 180});
m_hShape.setPosition(SCREEN_WIDTH / 2 - m_hShape.width() / 2, SCREEN_HEIGHT / 2 - m_hShape.height() / 2, 0);
m_vShape1.setPosition(SCREEN_WIDTH / 2 - m_vShape1.width() / 2, SCREEN_HEIGHT / 2 - m_hShape.height() / 2 - m_vShape1.height(), 0);

View File

@ -23,7 +23,7 @@ InventoryState::InventoryState(gk::ApplicationState *parent) : InterfaceState(pa
gk::Mouse::setCursorVisible(true);
gk::Mouse::resetToWindowCenter();
m_background.setColor(gk::Color{0, 0, 0, 127});
m_background.setFillColor(gk::Color{0, 0, 0, 127});
m_background.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
}

View File

@ -35,7 +35,7 @@ LuaGUIState::LuaGUIState(ClientCommandHandler &client, ClientPlayer &player, Cli
gk::Mouse::setCursorVisible(true);
gk::Mouse::resetToWindowCenter();
m_background.setColor(gk::Color{0, 0, 0, 127});
m_background.setFillColor(gk::Color{0, 0, 0, 127});
m_background.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
m_mainWidget.setScale(GUI_SCALE, GUI_SCALE);

View File

@ -26,7 +26,7 @@ PauseMenuState::PauseMenuState(gk::ApplicationState *parent) : InterfaceState(pa
gk::Mouse::setCursorVisible(true);
gk::Mouse::resetToWindowCenter();
m_background.setColor(gk::Color{0, 0, 0, 127});
m_background.setFillColor(gk::Color{0, 0, 0, 127});
m_background.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
m_menuWidget.setScale(GUI_SCALE, GUI_SCALE, 1);

View File

@ -26,13 +26,13 @@ ServerLoadingState::ServerLoadingState() {
m_text.setFont(gk::ResourceHandler::getInstance().get<gk::Font>("font-default"));
m_text.setCharacterSize(8 * 6);
m_text.setText("Loading world...");
m_text.setString("Loading world...");
m_text.setColor(gk::Color::White);
m_text.setPosition(SCREEN_WIDTH / 2.0 - m_text.getLocalBounds().width / 2.0, 200);
m_textShadow.setFont(gk::ResourceHandler::getInstance().get<gk::Font>("font-default"));
m_textShadow.setCharacterSize(8 * 6);
m_textShadow.setText(m_text.text());
m_textShadow.setString(m_text.string());
m_textShadow.setColor(gk::Color{70, 70, 70, 255});
m_textShadow.setPosition(m_text.getPosition().x + 6, m_text.getPosition().y + 6);
}

View File

@ -26,7 +26,7 @@
#include "World.hpp"
SettingsMenuState::SettingsMenuState(gk::ApplicationState *parent) : InterfaceState(parent) {
m_background.setColor(gk::Color{0, 0, 0, 127});
m_background.setFillColor(gk::Color{0, 0, 0, 127});
m_background.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
m_menuWidget.setScale(GUI_SCALE, GUI_SCALE, 1);