mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-30 20:13:31 +00:00
pragma once everywhere
This commit is contained in:
@@ -1,63 +1,61 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__Font_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__Font_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
#include <cctype>
|
||||
|
||||
#include "../renderer/gles.h"
|
||||
|
||||
class Textures;
|
||||
class Options;
|
||||
|
||||
class Font
|
||||
{
|
||||
public:
|
||||
Font(Options* options, const std::string& name, Textures* textures);
|
||||
//Font(Options* options, const std::string& name, Textures* textures, int imgW, int imgH, int x, int y, int cols, int rows, unsigned char charOffset);
|
||||
|
||||
void init(Options* options);
|
||||
void onGraphicsReset();
|
||||
|
||||
void draw(const char* str, float x, float y, int color);
|
||||
void draw(const std::string& str, float x, float y, int color);
|
||||
void draw(const char* str, float x, float y, int color, bool darken);
|
||||
void draw(const std::string& str, float x, float y, int color, bool darken);
|
||||
void drawShadow(const std::string& str, float x, float y, int color);
|
||||
void drawShadow(const char* str, float x, float y, int color);
|
||||
void drawWordWrap(const std::string& str, float x, float y, float w, int col);
|
||||
|
||||
int width(const std::string& str);
|
||||
int height(const std::string& str);
|
||||
|
||||
static std::string sanitize(const std::string& str);
|
||||
private:
|
||||
void buildChar(unsigned char i, float x = 0, float y = 0);
|
||||
void drawSlow(const std::string& str, float x, float y, int color, bool darken = false);
|
||||
void drawSlow(const char* str, float x, float y, int color, bool darken = false);
|
||||
public:
|
||||
int fontTexture;
|
||||
int lineHeight;
|
||||
static const int DefaultLineHeight = 10;
|
||||
private:
|
||||
int charWidths[256];
|
||||
float fcharWidths[256];
|
||||
int listPos;
|
||||
|
||||
int index;
|
||||
int count;
|
||||
GLuint lists[1024];
|
||||
|
||||
std::string fontName;
|
||||
Textures* _textures;
|
||||
|
||||
Options* options;
|
||||
|
||||
int _x, _y;
|
||||
int _cols;
|
||||
int _rows;
|
||||
unsigned char _charOffset;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__Font_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
#include <cctype>
|
||||
|
||||
#include "../renderer/gles.h"
|
||||
|
||||
class Textures;
|
||||
class Options;
|
||||
|
||||
class Font
|
||||
{
|
||||
public:
|
||||
Font(Options* options, const std::string& name, Textures* textures);
|
||||
//Font(Options* options, const std::string& name, Textures* textures, int imgW, int imgH, int x, int y, int cols, int rows, unsigned char charOffset);
|
||||
|
||||
void init(Options* options);
|
||||
void onGraphicsReset();
|
||||
|
||||
void draw(const char* str, float x, float y, int color);
|
||||
void draw(const std::string& str, float x, float y, int color);
|
||||
void draw(const char* str, float x, float y, int color, bool darken);
|
||||
void draw(const std::string& str, float x, float y, int color, bool darken);
|
||||
void drawShadow(const std::string& str, float x, float y, int color);
|
||||
void drawShadow(const char* str, float x, float y, int color);
|
||||
void drawWordWrap(const std::string& str, float x, float y, float w, int col);
|
||||
|
||||
int width(const std::string& str);
|
||||
int height(const std::string& str);
|
||||
|
||||
static std::string sanitize(const std::string& str);
|
||||
private:
|
||||
void buildChar(unsigned char i, float x = 0, float y = 0);
|
||||
void drawSlow(const std::string& str, float x, float y, int color, bool darken = false);
|
||||
void drawSlow(const char* str, float x, float y, int color, bool darken = false);
|
||||
public:
|
||||
int fontTexture;
|
||||
int lineHeight;
|
||||
static const int DefaultLineHeight = 10;
|
||||
private:
|
||||
int charWidths[256];
|
||||
float fcharWidths[256];
|
||||
int listPos;
|
||||
|
||||
int index;
|
||||
int count;
|
||||
GLuint lists[1024];
|
||||
|
||||
std::string fontName;
|
||||
Textures* _textures;
|
||||
|
||||
Options* options;
|
||||
|
||||
int _x, _y;
|
||||
int _cols;
|
||||
int _rows;
|
||||
unsigned char _charOffset;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,133 +1,131 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__Gui_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__Gui_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include "GuiComponent.h"
|
||||
#include "Font.h"
|
||||
#include "../player/input/touchscreen/TouchAreaModel.h"
|
||||
#include "../renderer/RenderChunk.h"
|
||||
#include "../../util/Random.h"
|
||||
#include "../IConfigListener.h"
|
||||
|
||||
class MinecraftClient;
|
||||
class ItemInstance;
|
||||
class Textures;
|
||||
class Tesselator;
|
||||
struct IntRectangle;
|
||||
|
||||
struct GuiMessage
|
||||
{
|
||||
std::string message;
|
||||
int ticks;
|
||||
};
|
||||
|
||||
typedef std::vector<GuiMessage> GuiMessageList;
|
||||
|
||||
class Gui: public GuiComponent, IConfigListener
|
||||
{
|
||||
public:
|
||||
Gui(MinecraftClient& minecraft);
|
||||
~Gui();
|
||||
|
||||
int getSlotIdAt(int x, int y);
|
||||
void flashSlot(int slotId);
|
||||
bool isInside(int x, int y);
|
||||
RectangleArea getRectangleArea(int extendSide);
|
||||
void getSlotPos(int slot, int& posX, int& posY);
|
||||
int getNumSlots();
|
||||
|
||||
void handleClick(int button, int x, int y);
|
||||
void handleKeyPressed( int key );
|
||||
void scrollChat(int delta);
|
||||
|
||||
void tick();
|
||||
void render(float a, bool mouseFree, int xMouse, int yMouse);
|
||||
|
||||
void renderToolBar( float a, int ySlot, const int screenWidth );
|
||||
|
||||
void renderChatMessages( const int screenHeight, unsigned int max, bool isChatting, Font* font );
|
||||
|
||||
// draw a string containing simple [color]...[/color] tags; color names are matched
|
||||
// case-insensitively and default to white. alpha is applied to each segment.
|
||||
// draw tagged string (ignores simple [color]…[/color] tags)
|
||||
static void drawColoredString(Font* font, const std::string& text, float x, float y, int alpha);
|
||||
static float getColoredWidth(Font* font, const std::string& text);
|
||||
|
||||
void renderOnSelectItemNameText( const int screenWidth, Font* font, int ySlot );
|
||||
|
||||
void renderSleepAnimation( const int screenWidth, const int screenHeight );
|
||||
|
||||
void renderBubbles();
|
||||
void renderHearts();
|
||||
void renderDebugInfo();
|
||||
void renderPlayerList(Font* font, int screenWidth, int screenHeight);
|
||||
|
||||
void renderProgressIndicator( const bool isTouchInterface, const int screenWidth, const int screenHeight, float a );
|
||||
|
||||
void addMessage(const std::string& string);
|
||||
void clearMessages();
|
||||
void postError(int errCode);
|
||||
|
||||
void onGraphicsReset();
|
||||
void inventoryUpdated();
|
||||
|
||||
void setNowPlaying(const std::string& string);
|
||||
void displayClientMessage(const std::string& messageId);
|
||||
void renderSlotText(const ItemInstance* item, float x, float y, bool hasFinite, bool shadow);
|
||||
void texturesLoaded( Textures* textures );
|
||||
|
||||
void onConfigChanged(const Config& config);
|
||||
void onLevelGenerated();
|
||||
|
||||
void setScissorRect(const IntRectangle& rect);
|
||||
|
||||
static float floorAlignToScreenPixel(float);
|
||||
static int itemCountItoa(char* buf, int count);
|
||||
private:
|
||||
void renderVignette(float br, int w, int h);
|
||||
void renderSlot(int slot, int x, int y, float a);
|
||||
void tickItemDrop();
|
||||
float cubeSmoothStep(float percentage, float min, float max);
|
||||
public:
|
||||
float progress = 0.f;
|
||||
std::string selectedName;
|
||||
static float InvGuiScale;
|
||||
static float GuiScale;
|
||||
|
||||
private:
|
||||
//ItemRenderer itemRenderer;
|
||||
GuiMessageList guiMessages;
|
||||
int chatScrollOffset = 0;
|
||||
Random random;
|
||||
|
||||
MinecraftClient& minecraft;
|
||||
int tickCount = 0;
|
||||
float itemNameOverlayTime = 2;
|
||||
std::string overlayMessageString;
|
||||
int overlayMessageTime = 0;
|
||||
bool animateOverlayMessageColor = false;
|
||||
|
||||
float tbr = 1.f;
|
||||
|
||||
RenderChunk _inventoryRc;
|
||||
bool _inventoryNeedsUpdate = true;
|
||||
|
||||
int _flashSlotId = -1;
|
||||
float _flashSlotStartTime = -1;
|
||||
|
||||
Font* _slotFont = nullptr;
|
||||
int _numSlots = 4;
|
||||
|
||||
RenderChunk rcFeedbackOuter;
|
||||
RenderChunk rcFeedbackInner;
|
||||
|
||||
// For dropping
|
||||
static const float DropTicks;
|
||||
float _currentDropTicks = -1;
|
||||
int _currentDropSlot = -1;
|
||||
|
||||
bool _openInventorySlot;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__Gui_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include "GuiComponent.h"
|
||||
#include "Font.h"
|
||||
#include "../player/input/touchscreen/TouchAreaModel.h"
|
||||
#include "../renderer/RenderChunk.h"
|
||||
#include "../../util/Random.h"
|
||||
#include "../IConfigListener.h"
|
||||
|
||||
class MinecraftClient;
|
||||
class ItemInstance;
|
||||
class Textures;
|
||||
class Tesselator;
|
||||
struct IntRectangle;
|
||||
|
||||
struct GuiMessage
|
||||
{
|
||||
std::string message;
|
||||
int ticks;
|
||||
};
|
||||
|
||||
typedef std::vector<GuiMessage> GuiMessageList;
|
||||
|
||||
class Gui: public GuiComponent, IConfigListener
|
||||
{
|
||||
public:
|
||||
Gui(MinecraftClient& minecraft);
|
||||
~Gui();
|
||||
|
||||
int getSlotIdAt(int x, int y);
|
||||
void flashSlot(int slotId);
|
||||
bool isInside(int x, int y);
|
||||
RectangleArea getRectangleArea(int extendSide);
|
||||
void getSlotPos(int slot, int& posX, int& posY);
|
||||
int getNumSlots();
|
||||
|
||||
void handleClick(int button, int x, int y);
|
||||
void handleKeyPressed( int key );
|
||||
void scrollChat(int delta);
|
||||
|
||||
void tick();
|
||||
void render(float a, bool mouseFree, int xMouse, int yMouse);
|
||||
|
||||
void renderToolBar( float a, int ySlot, const int screenWidth );
|
||||
|
||||
void renderChatMessages( const int screenHeight, unsigned int max, bool isChatting, Font* font );
|
||||
|
||||
// draw a string containing simple [color]...[/color] tags; color names are matched
|
||||
// case-insensitively and default to white. alpha is applied to each segment.
|
||||
// draw tagged string (ignores simple [color]…[/color] tags)
|
||||
static void drawColoredString(Font* font, const std::string& text, float x, float y, int alpha);
|
||||
static float getColoredWidth(Font* font, const std::string& text);
|
||||
|
||||
void renderOnSelectItemNameText( const int screenWidth, Font* font, int ySlot );
|
||||
|
||||
void renderSleepAnimation( const int screenWidth, const int screenHeight );
|
||||
|
||||
void renderBubbles();
|
||||
void renderHearts();
|
||||
void renderDebugInfo();
|
||||
void renderPlayerList(Font* font, int screenWidth, int screenHeight);
|
||||
|
||||
void renderProgressIndicator( const bool isTouchInterface, const int screenWidth, const int screenHeight, float a );
|
||||
|
||||
void addMessage(const std::string& string);
|
||||
void clearMessages();
|
||||
void postError(int errCode);
|
||||
|
||||
void onGraphicsReset();
|
||||
void inventoryUpdated();
|
||||
|
||||
void setNowPlaying(const std::string& string);
|
||||
void displayClientMessage(const std::string& messageId);
|
||||
void renderSlotText(const ItemInstance* item, float x, float y, bool hasFinite, bool shadow);
|
||||
void texturesLoaded( Textures* textures );
|
||||
|
||||
void onConfigChanged(const Config& config);
|
||||
void onLevelGenerated();
|
||||
|
||||
void setScissorRect(const IntRectangle& rect);
|
||||
|
||||
static float floorAlignToScreenPixel(float);
|
||||
static int itemCountItoa(char* buf, int count);
|
||||
private:
|
||||
void renderVignette(float br, int w, int h);
|
||||
void renderSlot(int slot, int x, int y, float a);
|
||||
void tickItemDrop();
|
||||
float cubeSmoothStep(float percentage, float min, float max);
|
||||
public:
|
||||
float progress = 0.f;
|
||||
std::string selectedName;
|
||||
static float InvGuiScale;
|
||||
static float GuiScale;
|
||||
|
||||
private:
|
||||
//ItemRenderer itemRenderer;
|
||||
GuiMessageList guiMessages;
|
||||
int chatScrollOffset = 0;
|
||||
Random random;
|
||||
|
||||
MinecraftClient& minecraft;
|
||||
int tickCount = 0;
|
||||
float itemNameOverlayTime = 2;
|
||||
std::string overlayMessageString;
|
||||
int overlayMessageTime = 0;
|
||||
bool animateOverlayMessageColor = false;
|
||||
|
||||
float tbr = 1.f;
|
||||
|
||||
RenderChunk _inventoryRc;
|
||||
bool _inventoryNeedsUpdate = true;
|
||||
|
||||
int _flashSlotId = -1;
|
||||
float _flashSlotStartTime = -1;
|
||||
|
||||
Font* _slotFont = nullptr;
|
||||
int _numSlots = 4;
|
||||
|
||||
RenderChunk rcFeedbackOuter;
|
||||
RenderChunk rcFeedbackInner;
|
||||
|
||||
// For dropping
|
||||
static const float DropTicks;
|
||||
float _currentDropTicks = -1;
|
||||
int _currentDropSlot = -1;
|
||||
|
||||
bool _openInventorySlot;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__GuiComponent_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__GuiComponent_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
class Font;
|
||||
class Minecraft;
|
||||
|
||||
class GuiComponent
|
||||
{
|
||||
public:
|
||||
GuiComponent();
|
||||
virtual ~GuiComponent();
|
||||
|
||||
void drawString(Font* font, const std::string& str, int x, int y, int color);
|
||||
void drawCenteredString(Font* font, const std::string& str, int x, int y, int color);
|
||||
|
||||
void blit(int x, int y, int sx, int sy, int w, int h, int sw=0, int sh=0);
|
||||
void blit(float x, float y, int sx, int sy, float w, float h, int sw=0, int sh=0);
|
||||
|
||||
protected:
|
||||
void fill(int x0, int y0, int x1, int y1, int col);
|
||||
void fill(float x0, float y0, float x1, float y1, int col);
|
||||
void fillGradient(int x0, int y0, int x1, int y1, int col1, int col2);
|
||||
void fillGradient(float x0, float y0, float x1, float y1, int col1, int col2);
|
||||
void fillHorizontalGradient(int x0, int y0, int x1, int y1, int col1, int col2);
|
||||
void fillHorizontalGradient(float x0, float y0, float x1, float y1, int col1, int col2);
|
||||
|
||||
float blitOffset;
|
||||
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__GuiComponent_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
class Font;
|
||||
class Minecraft;
|
||||
|
||||
class GuiComponent
|
||||
{
|
||||
public:
|
||||
GuiComponent();
|
||||
virtual ~GuiComponent();
|
||||
|
||||
void drawString(Font* font, const std::string& str, int x, int y, int color);
|
||||
void drawCenteredString(Font* font, const std::string& str, int x, int y, int color);
|
||||
|
||||
void blit(int x, int y, int sx, int sy, int w, int h, int sw=0, int sh=0);
|
||||
void blit(float x, float y, int sx, int sy, float w, float h, int sw=0, int sh=0);
|
||||
|
||||
protected:
|
||||
void fill(int x0, int y0, int x1, int y1, int col);
|
||||
void fill(float x0, float y0, float x1, float y1, int col);
|
||||
void fillGradient(int x0, int y0, int x1, int y1, int col1, int col2);
|
||||
void fillGradient(float x0, float y0, float x1, float y1, int col1, int col2);
|
||||
void fillHorizontalGradient(int x0, int y0, int x1, int y1, int col1, int col2);
|
||||
void fillHorizontalGradient(float x0, float y0, float x1, float y1, int col1, int col2);
|
||||
|
||||
float blitOffset;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,83 +1,81 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__Screen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__Screen_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <vector>
|
||||
#include "GuiComponent.h"
|
||||
|
||||
class Font;
|
||||
class Minecraft;
|
||||
class Button;
|
||||
class TextBox;
|
||||
struct IntRectangle;
|
||||
|
||||
class Screen: public GuiComponent
|
||||
{
|
||||
public:
|
||||
Screen();
|
||||
|
||||
virtual void render(int xm, int ym, float a);
|
||||
|
||||
void init(Minecraft* minecraft, int width, int height);
|
||||
virtual void init();
|
||||
|
||||
void setSize(int width, int height);
|
||||
virtual void setupPositions() {};
|
||||
|
||||
virtual void updateEvents();
|
||||
virtual void mouseEvent();
|
||||
virtual void keyboardEvent();
|
||||
virtual void keyboardTextEvent();
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
|
||||
virtual void tick() {}
|
||||
|
||||
virtual void removed() {}
|
||||
|
||||
virtual void renderBackground();
|
||||
virtual void renderBackground(int vo);
|
||||
virtual void renderDirtBackground(int vo);
|
||||
// query
|
||||
virtual bool renderGameBehind();
|
||||
virtual bool hasClippingArea(IntRectangle& out);
|
||||
|
||||
virtual bool isPauseScreen();
|
||||
virtual bool isErrorScreen();
|
||||
virtual bool isInGameScreen();
|
||||
virtual bool closeOnPlayerHurt();
|
||||
|
||||
virtual void confirmResult(bool result, int id) {}
|
||||
virtual void lostFocus();
|
||||
virtual void toGUICoordinate(int& x, int& y);
|
||||
protected:
|
||||
void updateTabButtonSelection();
|
||||
|
||||
virtual void buttonClicked(Button* button) {}
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
|
||||
// mouse wheel movement (dx/dy are wheel deltas, xm/ym are GUI coords)
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) {}
|
||||
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void charPressed(char inputChar);
|
||||
public:
|
||||
int width;
|
||||
int height;
|
||||
bool passEvents;
|
||||
//GuiParticles* particles;
|
||||
protected:
|
||||
Minecraft* minecraft;
|
||||
std::vector<Button*> buttons;
|
||||
std::vector<TextBox*> textBoxes;
|
||||
|
||||
std::vector<Button*> tabButtons;
|
||||
int tabButtonIndex;
|
||||
|
||||
Font* font;
|
||||
private:
|
||||
Button* clickedButton;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__Screen_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <vector>
|
||||
#include "GuiComponent.h"
|
||||
|
||||
class Font;
|
||||
class Minecraft;
|
||||
class Button;
|
||||
class TextBox;
|
||||
struct IntRectangle;
|
||||
|
||||
class Screen: public GuiComponent
|
||||
{
|
||||
public:
|
||||
Screen();
|
||||
|
||||
virtual void render(int xm, int ym, float a);
|
||||
|
||||
void init(Minecraft* minecraft, int width, int height);
|
||||
virtual void init();
|
||||
|
||||
void setSize(int width, int height);
|
||||
virtual void setupPositions() {};
|
||||
|
||||
virtual void updateEvents();
|
||||
virtual void mouseEvent();
|
||||
virtual void keyboardEvent();
|
||||
virtual void keyboardTextEvent();
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
|
||||
virtual void tick() {}
|
||||
|
||||
virtual void removed() {}
|
||||
|
||||
virtual void renderBackground();
|
||||
virtual void renderBackground(int vo);
|
||||
virtual void renderDirtBackground(int vo);
|
||||
// query
|
||||
virtual bool renderGameBehind();
|
||||
virtual bool hasClippingArea(IntRectangle& out);
|
||||
|
||||
virtual bool isPauseScreen();
|
||||
virtual bool isErrorScreen();
|
||||
virtual bool isInGameScreen();
|
||||
virtual bool closeOnPlayerHurt();
|
||||
|
||||
virtual void confirmResult(bool result, int id) {}
|
||||
virtual void lostFocus();
|
||||
virtual void toGUICoordinate(int& x, int& y);
|
||||
protected:
|
||||
void updateTabButtonSelection();
|
||||
|
||||
virtual void buttonClicked(Button* button) {}
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
|
||||
// mouse wheel movement (dx/dy are wheel deltas, xm/ym are GUI coords)
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) {}
|
||||
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void charPressed(char inputChar);
|
||||
public:
|
||||
int width;
|
||||
int height;
|
||||
bool passEvents;
|
||||
//GuiParticles* particles;
|
||||
protected:
|
||||
Minecraft* minecraft;
|
||||
std::vector<Button*> buttons;
|
||||
std::vector<TextBox*> textBoxes;
|
||||
|
||||
std::vector<Button*> tabButtons;
|
||||
int tabButtonIndex;
|
||||
|
||||
Font* font;
|
||||
private:
|
||||
Button* clickedButton;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__TweenData_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__TweenData_H__
|
||||
|
||||
typedef struct TweenData {
|
||||
float cur;
|
||||
float dur;
|
||||
float start;
|
||||
float stop;
|
||||
} TweenData;
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__TweenData_H__*/
|
||||
#pragma once
|
||||
|
||||
typedef struct TweenData {
|
||||
float cur;
|
||||
float dur;
|
||||
float start;
|
||||
float stop;
|
||||
} TweenData;
|
||||
|
||||
|
||||
@@ -1,80 +1,78 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__Button_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__Button_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
#include "GuiElement.h"
|
||||
#include "../../Options.h"
|
||||
|
||||
class Font;
|
||||
class Minecraft;
|
||||
|
||||
class Button: public GuiElement
|
||||
{
|
||||
public:
|
||||
Button(int id, const std::string& msg);
|
||||
Button(int id, int x, int y, const std::string& msg);
|
||||
Button(int id, int x, int y, int w, int h, const std::string& msg);
|
||||
virtual ~Button() {}
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
|
||||
virtual bool clicked(Minecraft* minecraft, int mx, int my);
|
||||
virtual void released(int mx, int my);
|
||||
virtual void setPressed();
|
||||
|
||||
bool isInside(int xm, int ym);
|
||||
protected:
|
||||
virtual int getYImage(bool hovered);
|
||||
virtual void renderBg(Minecraft* minecraft, int xm, int ym);
|
||||
|
||||
virtual void renderFace(Minecraft* minecraft, int xm, int ym);
|
||||
bool hovered(Minecraft* minecraft, int xm, int ym);
|
||||
public:
|
||||
std::string msg;
|
||||
int id;
|
||||
|
||||
bool selected;
|
||||
protected:
|
||||
bool _currentlyDown;
|
||||
};
|
||||
|
||||
// @note: A bit backwards, but this is a button that
|
||||
// only reacts to clicks, but isn't rendered.
|
||||
class BlankButton: public Button
|
||||
{
|
||||
typedef Button super;
|
||||
public:
|
||||
BlankButton(int id);
|
||||
BlankButton(int id, int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
|
||||
namespace Touch {
|
||||
class TButton: public Button
|
||||
{
|
||||
typedef Button super;
|
||||
public:
|
||||
TButton(int id, const std::string& msg);
|
||||
TButton(int id, int x, int y, const std::string& msg);
|
||||
TButton(int id, int x, int y, int w, int h, const std::string& msg);
|
||||
protected:
|
||||
virtual void renderBg(Minecraft* minecraft, int xm, int ym);
|
||||
};
|
||||
|
||||
// "Header" in Touchscreen mode
|
||||
class THeader: public Button {
|
||||
typedef Button super;
|
||||
public:
|
||||
THeader(int id, const std::string& msg);
|
||||
THeader(int id, int x, int y, const std::string& msg);
|
||||
THeader(int id, int x, int y, int w, int h, const std::string& msg);
|
||||
protected:
|
||||
virtual void renderBg(Minecraft* minecraft, int xm, int ym);
|
||||
void render( Minecraft* minecraft, int xm, int ym );
|
||||
public:
|
||||
int xText;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__Button_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
#include "GuiElement.h"
|
||||
#include "../../Options.h"
|
||||
|
||||
class Font;
|
||||
class Minecraft;
|
||||
|
||||
class Button: public GuiElement
|
||||
{
|
||||
public:
|
||||
Button(int id, const std::string& msg);
|
||||
Button(int id, int x, int y, const std::string& msg);
|
||||
Button(int id, int x, int y, int w, int h, const std::string& msg);
|
||||
virtual ~Button() {}
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
|
||||
virtual bool clicked(Minecraft* minecraft, int mx, int my);
|
||||
virtual void released(int mx, int my);
|
||||
virtual void setPressed();
|
||||
|
||||
bool isInside(int xm, int ym);
|
||||
protected:
|
||||
virtual int getYImage(bool hovered);
|
||||
virtual void renderBg(Minecraft* minecraft, int xm, int ym);
|
||||
|
||||
virtual void renderFace(Minecraft* minecraft, int xm, int ym);
|
||||
bool hovered(Minecraft* minecraft, int xm, int ym);
|
||||
public:
|
||||
std::string msg;
|
||||
int id;
|
||||
|
||||
bool selected;
|
||||
protected:
|
||||
bool _currentlyDown;
|
||||
};
|
||||
|
||||
// @note: A bit backwards, but this is a button that
|
||||
// only reacts to clicks, but isn't rendered.
|
||||
class BlankButton: public Button
|
||||
{
|
||||
typedef Button super;
|
||||
public:
|
||||
BlankButton(int id);
|
||||
BlankButton(int id, int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
|
||||
namespace Touch {
|
||||
class TButton: public Button
|
||||
{
|
||||
typedef Button super;
|
||||
public:
|
||||
TButton(int id, const std::string& msg);
|
||||
TButton(int id, int x, int y, const std::string& msg);
|
||||
TButton(int id, int x, int y, int w, int h, const std::string& msg);
|
||||
protected:
|
||||
virtual void renderBg(Minecraft* minecraft, int xm, int ym);
|
||||
};
|
||||
|
||||
// "Header" in Touchscreen mode
|
||||
class THeader: public Button {
|
||||
typedef Button super;
|
||||
public:
|
||||
THeader(int id, const std::string& msg);
|
||||
THeader(int id, int x, int y, const std::string& msg);
|
||||
THeader(int id, int x, int y, int w, int h, const std::string& msg);
|
||||
protected:
|
||||
virtual void renderBg(Minecraft* minecraft, int xm, int ym);
|
||||
void render( Minecraft* minecraft, int xm, int ym );
|
||||
public:
|
||||
int xText;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,55 +1,53 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__GButton_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__GButton_H__
|
||||
#include "Button.h"
|
||||
|
||||
class GButton: public Button {
|
||||
typedef Button super;
|
||||
public:
|
||||
static const int LayerDefault = 1;
|
||||
static const int LayerSelected = 2;
|
||||
static const int LayerMax = 4;
|
||||
|
||||
GButton(int id)
|
||||
: super(id, "")
|
||||
{}
|
||||
~GButton() {
|
||||
for (unsigned int i = 0; i < layers.size(); ++i) {
|
||||
delete layers[i].first;
|
||||
}
|
||||
}
|
||||
|
||||
void addElement(int layerId, GuiElement* e) {
|
||||
if (!e || layerId < 0 || layerId >= LayerMax) {
|
||||
LOGE("Error @ GButton::element : Trying to add element %p at layer: %d\n", e, layerId);
|
||||
return;
|
||||
}
|
||||
layers.push_back(std::make_pair(e, layerId));
|
||||
}
|
||||
|
||||
void render( Minecraft* minecraft, int xm, int ym )
|
||||
{
|
||||
if (!visible) return;
|
||||
|
||||
bool isHovered = minecraft->isTouchscreen()?
|
||||
(_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height): false;
|
||||
|
||||
int layer = isHovered? LayerSelected : LayerDefault;
|
||||
if (layer < 0) return;
|
||||
|
||||
Tesselator& t = Tesselator::instance;
|
||||
t.addOffset((float)x, (float)y, 0);
|
||||
|
||||
for (unsigned int i = 0; i < layers.size(); ++i) {
|
||||
if ((layers[i].second & layer) != 0)
|
||||
layers[i].first->render(minecraft, 0, 0);
|
||||
}
|
||||
|
||||
t.addOffset((float)-x, (float)-y, 0);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::pair<GuiElement*, int> > layers;
|
||||
};
|
||||
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__GButton_H__*/
|
||||
#pragma once
|
||||
#include "Button.h"
|
||||
|
||||
class GButton: public Button {
|
||||
typedef Button super;
|
||||
public:
|
||||
static const int LayerDefault = 1;
|
||||
static const int LayerSelected = 2;
|
||||
static const int LayerMax = 4;
|
||||
|
||||
GButton(int id)
|
||||
: super(id, "")
|
||||
{}
|
||||
~GButton() {
|
||||
for (unsigned int i = 0; i < layers.size(); ++i) {
|
||||
delete layers[i].first;
|
||||
}
|
||||
}
|
||||
|
||||
void addElement(int layerId, GuiElement* e) {
|
||||
if (!e || layerId < 0 || layerId >= LayerMax) {
|
||||
LOGE("Error @ GButton::element : Trying to add element %p at layer: %d\n", e, layerId);
|
||||
return;
|
||||
}
|
||||
layers.push_back(std::make_pair(e, layerId));
|
||||
}
|
||||
|
||||
void render( Minecraft* minecraft, int xm, int ym )
|
||||
{
|
||||
if (!visible) return;
|
||||
|
||||
bool isHovered = minecraft->isTouchscreen()?
|
||||
(_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height): false;
|
||||
|
||||
int layer = isHovered? LayerSelected : LayerDefault;
|
||||
if (layer < 0) return;
|
||||
|
||||
Tesselator& t = Tesselator::instance;
|
||||
t.addOffset((float)x, (float)y, 0);
|
||||
|
||||
for (unsigned int i = 0; i < layers.size(); ++i) {
|
||||
if ((layers[i].second & layer) != 0)
|
||||
layers[i].first->render(minecraft, 0, 0);
|
||||
}
|
||||
|
||||
t.addOffset((float)-x, (float)-y, 0);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::pair<GuiElement*, int> > layers;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__GuiElement_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__GuiElement_H__
|
||||
#include "../GuiComponent.h"
|
||||
|
||||
class Tesselator;
|
||||
class Minecraft;
|
||||
|
||||
class GuiElement : public GuiComponent {
|
||||
public:
|
||||
GuiElement(bool active=false, bool visible=true, int x = 0, int y = 0, int width=24, int height=24);
|
||||
virtual ~GuiElement() {}
|
||||
|
||||
virtual void tick(Minecraft* minecraft) {}
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym) { }
|
||||
virtual void setupPositions() {}
|
||||
|
||||
virtual void mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum) {}
|
||||
virtual void mouseReleased(Minecraft* minecraft, int x, int y, int buttonNum) {}
|
||||
virtual void keyPressed(Minecraft* minecraft, int key) {}
|
||||
virtual void charPressed(Minecraft* minecraft, char key) {}
|
||||
|
||||
virtual bool pointInside(int x, int y);
|
||||
|
||||
void setVisible(bool visible);
|
||||
|
||||
bool active;
|
||||
bool visible;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__GuiElement_H__*/
|
||||
#pragma once
|
||||
#include "../GuiComponent.h"
|
||||
|
||||
class Tesselator;
|
||||
class Minecraft;
|
||||
|
||||
class GuiElement : public GuiComponent {
|
||||
public:
|
||||
GuiElement(bool active=false, bool visible=true, int x = 0, int y = 0, int width=24, int height=24);
|
||||
virtual ~GuiElement() {}
|
||||
|
||||
virtual void tick(Minecraft* minecraft) {}
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym) { }
|
||||
virtual void setupPositions() {}
|
||||
|
||||
virtual void mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum) {}
|
||||
virtual void mouseReleased(Minecraft* minecraft, int x, int y, int buttonNum) {}
|
||||
virtual void keyPressed(Minecraft* minecraft, int key) {}
|
||||
virtual void charPressed(Minecraft* minecraft, char key) {}
|
||||
|
||||
virtual bool pointInside(int x, int y);
|
||||
|
||||
void setVisible(bool visible);
|
||||
|
||||
bool active;
|
||||
bool visible;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__GuiElementContainer_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__GuiElementContainer_H__
|
||||
#include "GuiElement.h"
|
||||
#include <vector>
|
||||
class Tesselator;
|
||||
class Minecraft;
|
||||
|
||||
class GuiElementContainer : public GuiElement {
|
||||
public:
|
||||
GuiElementContainer(bool active=false, bool visible=true, int x = 0, int y = 0, int width=24, int height=24);
|
||||
virtual ~GuiElementContainer();
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
virtual void setupPositions();
|
||||
virtual void addChild(GuiElement* element);
|
||||
virtual void removeChild(GuiElement* element);
|
||||
|
||||
virtual void tick( Minecraft* minecraft );
|
||||
|
||||
virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
virtual void keyPressed(Minecraft* minecraft, int key);
|
||||
virtual void charPressed(Minecraft* minecraft, char key);
|
||||
|
||||
protected:
|
||||
std::vector<GuiElement*> children;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__GuiElementContainer_H__*/
|
||||
#pragma once
|
||||
#include "GuiElement.h"
|
||||
#include <vector>
|
||||
class Tesselator;
|
||||
class Minecraft;
|
||||
|
||||
class GuiElementContainer : public GuiElement {
|
||||
public:
|
||||
GuiElementContainer(bool active=false, bool visible=true, int x = 0, int y = 0, int width=24, int height=24);
|
||||
virtual ~GuiElementContainer();
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
virtual void setupPositions();
|
||||
virtual void addChild(GuiElement* element);
|
||||
virtual void removeChild(GuiElement* element);
|
||||
|
||||
virtual void tick( Minecraft* minecraft );
|
||||
|
||||
virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
virtual void keyPressed(Minecraft* minecraft, int key);
|
||||
virtual void charPressed(Minecraft* minecraft, char key);
|
||||
|
||||
protected:
|
||||
std::vector<GuiElement*> children;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,97 +1,95 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ImageButton_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ImageButton_H__
|
||||
|
||||
#include "Button.h"
|
||||
|
||||
typedef struct IntRectangle {
|
||||
IntRectangle()
|
||||
: x(0),
|
||||
y(0),
|
||||
w(1),
|
||||
h(1)
|
||||
{}
|
||||
IntRectangle(int x, int y, int w, int h)
|
||||
: x(x),
|
||||
y(y),
|
||||
w(w),
|
||||
h(h)
|
||||
{}
|
||||
|
||||
int x, y;
|
||||
int w, h;
|
||||
} IntRectangle;
|
||||
|
||||
typedef struct ImageDef {
|
||||
ImageDef()
|
||||
: hasSrc(false),
|
||||
x(0),
|
||||
y(0),
|
||||
width(16),
|
||||
height(16)
|
||||
{}
|
||||
|
||||
std::string name;
|
||||
int x;
|
||||
int y;
|
||||
float width;
|
||||
float height;
|
||||
|
||||
ImageDef& setSrc(const IntRectangle& srcRect) {
|
||||
hasSrc = true;
|
||||
src = srcRect;
|
||||
return *this;
|
||||
}
|
||||
IntRectangle* getSrc() {
|
||||
return hasSrc? &src : NULL;
|
||||
}
|
||||
protected:
|
||||
IntRectangle src;
|
||||
bool hasSrc;
|
||||
} ImageDef;
|
||||
|
||||
|
||||
class ImageButton: public Button
|
||||
{
|
||||
typedef Button super;
|
||||
public:
|
||||
ImageButton(int id, const std::string& msg);
|
||||
ImageButton(int id, const std::string& msg, const ImageDef& imageDef);
|
||||
void setImageDef(const ImageDef& imageDef, bool setButtonSize);
|
||||
|
||||
void render(Minecraft* minecraft, int xm, int ym);
|
||||
void renderBg(Minecraft* minecraft, int xm, int ym) {}
|
||||
|
||||
protected:
|
||||
virtual void setupDefault();
|
||||
virtual bool isSecondImage(bool hovered) { return hovered; }
|
||||
|
||||
ImageDef _imageDef;
|
||||
public:
|
||||
bool scaleWhenPressed;
|
||||
};
|
||||
|
||||
//
|
||||
// A toggleable Button
|
||||
//
|
||||
class OptionButton: public ImageButton
|
||||
{
|
||||
typedef ImageButton super;
|
||||
public:
|
||||
OptionButton(OptionId optId);
|
||||
|
||||
void toggle(Options* options);
|
||||
void updateImage(Options* options);
|
||||
|
||||
static const int ButtonId = 9999999;
|
||||
protected:
|
||||
bool isSecondImage(bool hovered) { return _secondImage; }
|
||||
|
||||
virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
|
||||
private:
|
||||
OptionId m_optId;
|
||||
bool _secondImage;
|
||||
};
|
||||
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ImageButton_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "Button.h"
|
||||
|
||||
typedef struct IntRectangle {
|
||||
IntRectangle()
|
||||
: x(0),
|
||||
y(0),
|
||||
w(1),
|
||||
h(1)
|
||||
{}
|
||||
IntRectangle(int x, int y, int w, int h)
|
||||
: x(x),
|
||||
y(y),
|
||||
w(w),
|
||||
h(h)
|
||||
{}
|
||||
|
||||
int x, y;
|
||||
int w, h;
|
||||
} IntRectangle;
|
||||
|
||||
typedef struct ImageDef {
|
||||
ImageDef()
|
||||
: hasSrc(false),
|
||||
x(0),
|
||||
y(0),
|
||||
width(16),
|
||||
height(16)
|
||||
{}
|
||||
|
||||
std::string name;
|
||||
int x;
|
||||
int y;
|
||||
float width;
|
||||
float height;
|
||||
|
||||
ImageDef& setSrc(const IntRectangle& srcRect) {
|
||||
hasSrc = true;
|
||||
src = srcRect;
|
||||
return *this;
|
||||
}
|
||||
IntRectangle* getSrc() {
|
||||
return hasSrc? &src : NULL;
|
||||
}
|
||||
protected:
|
||||
IntRectangle src;
|
||||
bool hasSrc;
|
||||
} ImageDef;
|
||||
|
||||
|
||||
class ImageButton: public Button
|
||||
{
|
||||
typedef Button super;
|
||||
public:
|
||||
ImageButton(int id, const std::string& msg);
|
||||
ImageButton(int id, const std::string& msg, const ImageDef& imageDef);
|
||||
void setImageDef(const ImageDef& imageDef, bool setButtonSize);
|
||||
|
||||
void render(Minecraft* minecraft, int xm, int ym);
|
||||
void renderBg(Minecraft* minecraft, int xm, int ym) {}
|
||||
|
||||
protected:
|
||||
virtual void setupDefault();
|
||||
virtual bool isSecondImage(bool hovered) { return hovered; }
|
||||
|
||||
ImageDef _imageDef;
|
||||
public:
|
||||
bool scaleWhenPressed;
|
||||
};
|
||||
|
||||
//
|
||||
// A toggleable Button
|
||||
//
|
||||
class OptionButton: public ImageButton
|
||||
{
|
||||
typedef ImageButton super;
|
||||
public:
|
||||
OptionButton(OptionId optId);
|
||||
|
||||
void toggle(Options* options);
|
||||
void updateImage(Options* options);
|
||||
|
||||
static const int ButtonId = 9999999;
|
||||
protected:
|
||||
bool isSecondImage(bool hovered) { return _secondImage; }
|
||||
|
||||
virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
|
||||
private:
|
||||
OptionId m_optId;
|
||||
bool _secondImage;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,62 +1,60 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__InventoryPane_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__InventoryPane_H__
|
||||
|
||||
#include "ScrollingPane.h"
|
||||
#include "ImageButton.h"
|
||||
|
||||
class Minecraft;
|
||||
class ItemInstance;
|
||||
class Font;
|
||||
class IArea;
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class IInventoryPaneCallback;
|
||||
|
||||
class InventoryPane: public ScrollingPane
|
||||
{
|
||||
typedef ScrollingPane super;
|
||||
public:
|
||||
InventoryPane(IInventoryPaneCallback* screen, Minecraft* mc, const IntRectangle& rect, int paneWidth, float clickMarginH, int numItems, int itemSize, int itemBorderSize);
|
||||
~InventoryPane();
|
||||
|
||||
void tick();
|
||||
void renderBatch( std::vector<GridItem>& item, float alpha );
|
||||
bool onSelect( int gridId, bool selected );
|
||||
void drawScrollBar( ScrollBar& hScroll );
|
||||
|
||||
void setRenderDecorations(bool value);
|
||||
|
||||
IntRectangle rect;
|
||||
int paneWidth;
|
||||
IArea* _clickArea;
|
||||
IInventoryPaneCallback* screen;
|
||||
Minecraft* mc;
|
||||
|
||||
int fillMarginX;
|
||||
int fillMarginY;
|
||||
|
||||
int markerType;
|
||||
int markerIndex;
|
||||
float markerShare;
|
||||
private:
|
||||
int lastItemIndex;
|
||||
int lastItemTicks;
|
||||
int BorderPixels;
|
||||
bool renderDecorations;
|
||||
|
||||
IntRectangle bg;
|
||||
};
|
||||
|
||||
class IInventoryPaneCallback
|
||||
{
|
||||
public:
|
||||
virtual ~IInventoryPaneCallback() {}
|
||||
virtual bool addItem(const InventoryPane* forPane, int index) = 0;
|
||||
virtual bool isAllowed( int slot ) = 0;
|
||||
virtual std::vector<const ItemInstance*> getItems(const InventoryPane* forPane) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__InventoryPane_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "ScrollingPane.h"
|
||||
#include "ImageButton.h"
|
||||
|
||||
class Minecraft;
|
||||
class ItemInstance;
|
||||
class Font;
|
||||
class IArea;
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class IInventoryPaneCallback;
|
||||
|
||||
class InventoryPane: public ScrollingPane
|
||||
{
|
||||
typedef ScrollingPane super;
|
||||
public:
|
||||
InventoryPane(IInventoryPaneCallback* screen, Minecraft* mc, const IntRectangle& rect, int paneWidth, float clickMarginH, int numItems, int itemSize, int itemBorderSize);
|
||||
~InventoryPane();
|
||||
|
||||
void tick();
|
||||
void renderBatch( std::vector<GridItem>& item, float alpha );
|
||||
bool onSelect( int gridId, bool selected );
|
||||
void drawScrollBar( ScrollBar& hScroll );
|
||||
|
||||
void setRenderDecorations(bool value);
|
||||
|
||||
IntRectangle rect;
|
||||
int paneWidth;
|
||||
IArea* _clickArea;
|
||||
IInventoryPaneCallback* screen;
|
||||
Minecraft* mc;
|
||||
|
||||
int fillMarginX;
|
||||
int fillMarginY;
|
||||
|
||||
int markerType;
|
||||
int markerIndex;
|
||||
float markerShare;
|
||||
private:
|
||||
int lastItemIndex;
|
||||
int lastItemTicks;
|
||||
int BorderPixels;
|
||||
bool renderDecorations;
|
||||
|
||||
IntRectangle bg;
|
||||
};
|
||||
|
||||
class IInventoryPaneCallback
|
||||
{
|
||||
public:
|
||||
virtual ~IInventoryPaneCallback() {}
|
||||
virtual bool addItem(const InventoryPane* forPane, int index) = 0;
|
||||
virtual bool isAllowed( int slot ) = 0;
|
||||
virtual std::vector<const ItemInstance*> getItems(const InventoryPane* forPane) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,95 +1,93 @@
|
||||
#ifndef ITEMPANE_H__
|
||||
#define ITEMPANE_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "ScrollingPane.h"
|
||||
#include "../../../world/item/ItemInstance.h"
|
||||
|
||||
class Font;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class Recipe;
|
||||
class ItemPane;
|
||||
|
||||
class CItem
|
||||
{
|
||||
public:
|
||||
CItem(const ItemInstance& ins, Recipe* recipe, const std::string& text)
|
||||
: item(ins),
|
||||
recipe(recipe),
|
||||
text(text),
|
||||
sortText(text),
|
||||
//maxBuildCount(0),
|
||||
numBuilt(0),
|
||||
inventoryCount(0),
|
||||
_canCraft(false)
|
||||
{
|
||||
}
|
||||
|
||||
typedef struct ReqItem {
|
||||
ReqItem() {}
|
||||
ReqItem(const ItemInstance& needItem, int has)
|
||||
: item(needItem), has(has) {}
|
||||
ItemInstance item;
|
||||
int has;
|
||||
bool enough() { return has >= item.count; }
|
||||
} ReqItem;
|
||||
|
||||
bool canCraft() {
|
||||
return _canCraft;// || maxBuildCount > 0;
|
||||
}
|
||||
void setCanCraft(bool status) {
|
||||
_canCraft = status;
|
||||
}
|
||||
|
||||
ItemInstance item;
|
||||
Recipe* recipe;
|
||||
std::string text;
|
||||
std::string sortText;
|
||||
//int maxBuildCount;
|
||||
int numBuilt;
|
||||
int inventoryCount;
|
||||
std::vector<ReqItem> neededItems;
|
||||
private:
|
||||
bool _canCraft;
|
||||
};
|
||||
|
||||
class IItemPaneCallback
|
||||
{
|
||||
public:
|
||||
virtual ~IItemPaneCallback() {}
|
||||
virtual void onItemSelected(const ItemPane* forPane, int index) = 0;
|
||||
virtual const std::vector<CItem*>& getItems(const ItemPane* forPane) = 0;
|
||||
};
|
||||
|
||||
class ItemPane: public ScrollingPane
|
||||
{
|
||||
typedef ScrollingPane super;
|
||||
public:
|
||||
ItemPane( IItemPaneCallback* screen,
|
||||
Textures* textures,
|
||||
const IntRectangle& rect,
|
||||
int numItems,
|
||||
int guiHeight,
|
||||
int physicalScreenHeight,
|
||||
bool isVertical = true);
|
||||
~ItemPane();
|
||||
|
||||
void renderBatch( std::vector<GridItem>& item, float alpha );
|
||||
bool onSelect( int gridId, bool selected );
|
||||
void drawScrollBar( ScrollBar& hScroll );
|
||||
//void setSize()
|
||||
|
||||
Font* f;
|
||||
Textures* textures;
|
||||
IItemPaneCallback* screen;
|
||||
|
||||
int physicalScreenHeight; // Needed for glScissor
|
||||
bool isVertical;
|
||||
|
||||
NinePatchLayer* guiSlotItem;
|
||||
NinePatchLayer* guiSlotItemSelected;
|
||||
};
|
||||
|
||||
#endif /*ITEMPANE_H__*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "ScrollingPane.h"
|
||||
#include "../../../world/item/ItemInstance.h"
|
||||
|
||||
class Font;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class Recipe;
|
||||
class ItemPane;
|
||||
|
||||
class CItem
|
||||
{
|
||||
public:
|
||||
CItem(const ItemInstance& ins, Recipe* recipe, const std::string& text)
|
||||
: item(ins),
|
||||
recipe(recipe),
|
||||
text(text),
|
||||
sortText(text),
|
||||
//maxBuildCount(0),
|
||||
numBuilt(0),
|
||||
inventoryCount(0),
|
||||
_canCraft(false)
|
||||
{
|
||||
}
|
||||
|
||||
typedef struct ReqItem {
|
||||
ReqItem() {}
|
||||
ReqItem(const ItemInstance& needItem, int has)
|
||||
: item(needItem), has(has) {}
|
||||
ItemInstance item;
|
||||
int has;
|
||||
bool enough() { return has >= item.count; }
|
||||
} ReqItem;
|
||||
|
||||
bool canCraft() {
|
||||
return _canCraft;// || maxBuildCount > 0;
|
||||
}
|
||||
void setCanCraft(bool status) {
|
||||
_canCraft = status;
|
||||
}
|
||||
|
||||
ItemInstance item;
|
||||
Recipe* recipe;
|
||||
std::string text;
|
||||
std::string sortText;
|
||||
//int maxBuildCount;
|
||||
int numBuilt;
|
||||
int inventoryCount;
|
||||
std::vector<ReqItem> neededItems;
|
||||
private:
|
||||
bool _canCraft;
|
||||
};
|
||||
|
||||
class IItemPaneCallback
|
||||
{
|
||||
public:
|
||||
virtual ~IItemPaneCallback() {}
|
||||
virtual void onItemSelected(const ItemPane* forPane, int index) = 0;
|
||||
virtual const std::vector<CItem*>& getItems(const ItemPane* forPane) = 0;
|
||||
};
|
||||
|
||||
class ItemPane: public ScrollingPane
|
||||
{
|
||||
typedef ScrollingPane super;
|
||||
public:
|
||||
ItemPane( IItemPaneCallback* screen,
|
||||
Textures* textures,
|
||||
const IntRectangle& rect,
|
||||
int numItems,
|
||||
int guiHeight,
|
||||
int physicalScreenHeight,
|
||||
bool isVertical = true);
|
||||
~ItemPane();
|
||||
|
||||
void renderBatch( std::vector<GridItem>& item, float alpha );
|
||||
bool onSelect( int gridId, bool selected );
|
||||
void drawScrollBar( ScrollBar& hScroll );
|
||||
//void setSize()
|
||||
|
||||
Font* f;
|
||||
Textures* textures;
|
||||
IItemPaneCallback* screen;
|
||||
|
||||
int physicalScreenHeight; // Needed for glScissor
|
||||
bool isVertical;
|
||||
|
||||
NinePatchLayer* guiSlotItem;
|
||||
NinePatchLayer* guiSlotItemSelected;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__LargeImageButton_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__LargeImageButton_H__
|
||||
|
||||
#include "ImageButton.h"
|
||||
|
||||
class LargeImageButton: public ImageButton
|
||||
{
|
||||
typedef ImageButton super;
|
||||
public:
|
||||
LargeImageButton(int id, const std::string& msg);
|
||||
LargeImageButton(int id, const std::string& msg, ImageDef& imageDef);
|
||||
|
||||
void render(Minecraft* minecraft, int xm, int ym);
|
||||
|
||||
private:
|
||||
void setupDefault();
|
||||
|
||||
float _buttonScale;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__LargeImageButton_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "ImageButton.h"
|
||||
|
||||
class LargeImageButton: public ImageButton
|
||||
{
|
||||
typedef ImageButton super;
|
||||
public:
|
||||
LargeImageButton(int id, const std::string& msg);
|
||||
LargeImageButton(int id, const std::string& msg, ImageDef& imageDef);
|
||||
|
||||
void render(Minecraft* minecraft, int xm, int ym);
|
||||
|
||||
private:
|
||||
void setupDefault();
|
||||
|
||||
float _buttonScale;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,78 +1,76 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__NinePatch_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__NinePatch_H__
|
||||
|
||||
#include "ImageButton.h"
|
||||
#include "../../renderer/TextureData.h"
|
||||
#include "../../renderer/Textures.h"
|
||||
#include "../../renderer/Tesselator.h"
|
||||
#include "../../Minecraft.h"
|
||||
|
||||
class Tesselator;
|
||||
|
||||
class NinePatchDescription {
|
||||
public:
|
||||
NinePatchDescription& transformUVForImage(const TextureData& d);
|
||||
NinePatchDescription& transformUVForImageSize(int w, int h);
|
||||
|
||||
float u0, u1, u2, u3;
|
||||
float v0, v1, v2, v3;
|
||||
float w, e, n, s;
|
||||
|
||||
static NinePatchDescription createSymmetrical(int texWidth, int texHeight, const IntRectangle& src, int xCutAt, int yCutAt);
|
||||
private:
|
||||
NinePatchDescription( float x, float y, float x1, float x2, float x3, float y1, float y2, float y3,
|
||||
float w, float e, float n, float s);
|
||||
|
||||
int imgW;
|
||||
int imgH;
|
||||
};
|
||||
|
||||
class NinePatchLayer: public GuiElement
|
||||
{
|
||||
struct CachedQuad;
|
||||
public:
|
||||
NinePatchLayer(const NinePatchDescription& desc, const std::string& imageName, Textures* textures, float w = 32, float h = 32);
|
||||
virtual ~NinePatchLayer() {};
|
||||
void setSize(float w, float h);
|
||||
|
||||
void draw(Tesselator& t, float x, float y);
|
||||
|
||||
NinePatchLayer* exclude(int excludeId);
|
||||
NinePatchLayer* setExcluded(int exludeBits);
|
||||
|
||||
float getWidth() { return w; }
|
||||
float getHeight() { return h; }
|
||||
|
||||
private:
|
||||
void buildQuad(int qid);
|
||||
void getPatchInfo(int xc, int yc, float& x0, float& x1, float& y0, float& y1);
|
||||
|
||||
void d(Tesselator& t, const CachedQuad& q);
|
||||
|
||||
float w, h;
|
||||
NinePatchDescription desc;
|
||||
std::string imageName;
|
||||
Textures* textures;
|
||||
int excluded;
|
||||
|
||||
typedef struct CachedQuad {
|
||||
float x0, x1, y0, y1, z;
|
||||
float u0, u1, v0, v1;
|
||||
} CachedQuad;
|
||||
CachedQuad quads[9];
|
||||
};
|
||||
|
||||
class NinePatchFactory {
|
||||
public:
|
||||
NinePatchFactory(Textures* textures, const std::string& imageName );
|
||||
|
||||
NinePatchLayer* createSymmetrical(const IntRectangle& src, int xCutAt, int yCutAt, float w = 32.0f, float h = 32.0f);
|
||||
|
||||
private:
|
||||
Textures* textures;
|
||||
std::string imageName;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__NinePatch_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "ImageButton.h"
|
||||
#include "../../renderer/TextureData.h"
|
||||
#include "../../renderer/Textures.h"
|
||||
#include "../../renderer/Tesselator.h"
|
||||
#include "../../Minecraft.h"
|
||||
|
||||
class Tesselator;
|
||||
|
||||
class NinePatchDescription {
|
||||
public:
|
||||
NinePatchDescription& transformUVForImage(const TextureData& d);
|
||||
NinePatchDescription& transformUVForImageSize(int w, int h);
|
||||
|
||||
float u0, u1, u2, u3;
|
||||
float v0, v1, v2, v3;
|
||||
float w, e, n, s;
|
||||
|
||||
static NinePatchDescription createSymmetrical(int texWidth, int texHeight, const IntRectangle& src, int xCutAt, int yCutAt);
|
||||
private:
|
||||
NinePatchDescription( float x, float y, float x1, float x2, float x3, float y1, float y2, float y3,
|
||||
float w, float e, float n, float s);
|
||||
|
||||
int imgW;
|
||||
int imgH;
|
||||
};
|
||||
|
||||
class NinePatchLayer: public GuiElement
|
||||
{
|
||||
struct CachedQuad;
|
||||
public:
|
||||
NinePatchLayer(const NinePatchDescription& desc, const std::string& imageName, Textures* textures, float w = 32, float h = 32);
|
||||
virtual ~NinePatchLayer() {};
|
||||
void setSize(float w, float h);
|
||||
|
||||
void draw(Tesselator& t, float x, float y);
|
||||
|
||||
NinePatchLayer* exclude(int excludeId);
|
||||
NinePatchLayer* setExcluded(int exludeBits);
|
||||
|
||||
float getWidth() { return w; }
|
||||
float getHeight() { return h; }
|
||||
|
||||
private:
|
||||
void buildQuad(int qid);
|
||||
void getPatchInfo(int xc, int yc, float& x0, float& x1, float& y0, float& y1);
|
||||
|
||||
void d(Tesselator& t, const CachedQuad& q);
|
||||
|
||||
float w, h;
|
||||
NinePatchDescription desc;
|
||||
std::string imageName;
|
||||
Textures* textures;
|
||||
int excluded;
|
||||
|
||||
typedef struct CachedQuad {
|
||||
float x0, x1, y0, y1, z;
|
||||
float u0, u1, v0, v1;
|
||||
} CachedQuad;
|
||||
CachedQuad quads[9];
|
||||
};
|
||||
|
||||
class NinePatchFactory {
|
||||
public:
|
||||
NinePatchFactory(Textures* textures, const std::string& imageName );
|
||||
|
||||
NinePatchLayer* createSymmetrical(const IntRectangle& src, int xCutAt, int yCutAt, float w = 32.0f, float h = 32.0f);
|
||||
|
||||
private:
|
||||
Textures* textures;
|
||||
std::string imageName;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,32 +1,30 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
#include "GuiElementContainer.h"
|
||||
#include "ScrollingPane.h"
|
||||
#include "../../Options.h"
|
||||
|
||||
class Font;
|
||||
class Minecraft;
|
||||
|
||||
class OptionsGroup: public GuiElementContainer {
|
||||
typedef GuiElementContainer super;
|
||||
public:
|
||||
OptionsGroup(std::string labelID);
|
||||
virtual void setupPositions();
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
OptionsGroup& addOptionItem(OptionId optId, Minecraft* minecraft);
|
||||
protected:
|
||||
|
||||
void createToggle(OptionId optId, Minecraft* minecraft);
|
||||
void createProgressSlider(OptionId optId, Minecraft* minecraft);
|
||||
void createStepSlider(OptionId optId, Minecraft* minecraft);
|
||||
void createTextbox(OptionId optId, Minecraft* minecraft);
|
||||
void createKey(OptionId optId, Minecraft* minecraft);
|
||||
|
||||
std::string label;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
#include "GuiElementContainer.h"
|
||||
#include "ScrollingPane.h"
|
||||
#include "../../Options.h"
|
||||
|
||||
class Font;
|
||||
class Minecraft;
|
||||
|
||||
class OptionsGroup: public GuiElementContainer {
|
||||
typedef GuiElementContainer super;
|
||||
public:
|
||||
OptionsGroup(std::string labelID);
|
||||
virtual void setupPositions();
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
OptionsGroup& addOptionItem(OptionId optId, Minecraft* minecraft);
|
||||
protected:
|
||||
|
||||
void createToggle(OptionId optId, Minecraft* minecraft);
|
||||
void createProgressSlider(OptionId optId, Minecraft* minecraft);
|
||||
void createStepSlider(OptionId optId, Minecraft* minecraft);
|
||||
void createTextbox(OptionId optId, Minecraft* minecraft);
|
||||
void createKey(OptionId optId, Minecraft* minecraft);
|
||||
|
||||
std::string label;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,27 +1,25 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsItem_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsItem_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "GuiElementContainer.h"
|
||||
#include "../../../world/item/ItemInstance.h"
|
||||
#include "../../../client/Options.h"
|
||||
class Font;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class ItemPane;
|
||||
|
||||
class OptionsItem: public GuiElementContainer
|
||||
{
|
||||
typedef GuiElementContainer super;
|
||||
public:
|
||||
OptionsItem(OptionId optionId, std::string label, GuiElement* element);
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
void setupPositions();
|
||||
|
||||
private:
|
||||
OptionId m_optionId;
|
||||
std::string m_label;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsItem_H__*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "GuiElementContainer.h"
|
||||
#include "../../../world/item/ItemInstance.h"
|
||||
#include "../../../client/Options.h"
|
||||
class Font;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class ItemPane;
|
||||
|
||||
class OptionsItem: public GuiElementContainer
|
||||
{
|
||||
typedef GuiElementContainer super;
|
||||
public:
|
||||
OptionsItem(OptionId optionId, std::string label, GuiElement* element);
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
void setupPositions();
|
||||
|
||||
private:
|
||||
OptionId m_optionId;
|
||||
std::string m_label;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,82 +1,80 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__RolledSelectionListH_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__RolledSelectionListH_H__
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
class MinecraftClient;
|
||||
class Tesselator;
|
||||
|
||||
|
||||
class RolledSelectionListH : public GuiComponent
|
||||
{
|
||||
static const int NO_DRAG = -1;
|
||||
static const int DRAG_OUTSIDE = -2;
|
||||
static const int DRAG_NORMAL = 0;
|
||||
public:
|
||||
RolledSelectionListH(MinecraftClient& minecraft, int width, int height, int x0, int x1, int y0, int y1, int itemWidth);
|
||||
|
||||
virtual int getItemAtPosition(int x, int y);
|
||||
|
||||
virtual bool capXPosition();
|
||||
|
||||
virtual void tick();
|
||||
virtual void render(int xm, int ym, float a);
|
||||
virtual void renderHoleBackground(/*float x0, float x1,*/ float y0, float y1, int a0, int a1);
|
||||
virtual void setRenderSelection(bool _renderSelection);
|
||||
virtual void setComponentSelected(bool selected);
|
||||
protected:
|
||||
void setRenderHeader(bool _renderHeader, int _headerHeight);
|
||||
|
||||
virtual int getNumberOfItems() = 0;
|
||||
|
||||
virtual void selectStart(int item, int localX, int localY) {}
|
||||
virtual void selectCancel() {}
|
||||
virtual void selectItem(int item, bool doubleClick) = 0;
|
||||
virtual bool isSelectedItem(int item) = 0;
|
||||
|
||||
virtual int getMaxPosition();
|
||||
virtual float getPos(float alpha);
|
||||
virtual void touched();
|
||||
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t) = 0;
|
||||
virtual void renderHeader(int x, int y, Tesselator& t) {}
|
||||
virtual void renderBackground() = 0;
|
||||
virtual void renderDecorations(int mouseX, int mouseY) {}
|
||||
|
||||
virtual void clickedHeader(int headerMouseX, int headerMouseY) {}
|
||||
int getItemAtXPositionRaw(int x);
|
||||
protected:
|
||||
MinecraftClient& minecraft;
|
||||
|
||||
float x0;
|
||||
float x1;
|
||||
int itemWidth;
|
||||
int width;
|
||||
int height;
|
||||
//private:
|
||||
float y0;
|
||||
float y1;
|
||||
|
||||
int dragState;
|
||||
float xDrag;
|
||||
float xo;
|
||||
float xoo;
|
||||
float xInertia;
|
||||
float _xinertia;
|
||||
|
||||
int selectionX;
|
||||
bool renderSelection;
|
||||
bool _componentSelected;
|
||||
|
||||
bool _renderTopBorder;
|
||||
bool _renderBottomBorder;
|
||||
|
||||
private:
|
||||
int headerWidth;
|
||||
bool doRenderHeader;
|
||||
long lastSelectionTime;
|
||||
int lastSelection;
|
||||
|
||||
float _lastxoo;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__RolledSelectionListH_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
class MinecraftClient;
|
||||
class Tesselator;
|
||||
|
||||
|
||||
class RolledSelectionListH : public GuiComponent
|
||||
{
|
||||
static const int NO_DRAG = -1;
|
||||
static const int DRAG_OUTSIDE = -2;
|
||||
static const int DRAG_NORMAL = 0;
|
||||
public:
|
||||
RolledSelectionListH(MinecraftClient& minecraft, int width, int height, int x0, int x1, int y0, int y1, int itemWidth);
|
||||
|
||||
virtual int getItemAtPosition(int x, int y);
|
||||
|
||||
virtual bool capXPosition();
|
||||
|
||||
virtual void tick();
|
||||
virtual void render(int xm, int ym, float a);
|
||||
virtual void renderHoleBackground(/*float x0, float x1,*/ float y0, float y1, int a0, int a1);
|
||||
virtual void setRenderSelection(bool _renderSelection);
|
||||
virtual void setComponentSelected(bool selected);
|
||||
protected:
|
||||
void setRenderHeader(bool _renderHeader, int _headerHeight);
|
||||
|
||||
virtual int getNumberOfItems() = 0;
|
||||
|
||||
virtual void selectStart(int item, int localX, int localY) {}
|
||||
virtual void selectCancel() {}
|
||||
virtual void selectItem(int item, bool doubleClick) = 0;
|
||||
virtual bool isSelectedItem(int item) = 0;
|
||||
|
||||
virtual int getMaxPosition();
|
||||
virtual float getPos(float alpha);
|
||||
virtual void touched();
|
||||
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t) = 0;
|
||||
virtual void renderHeader(int x, int y, Tesselator& t) {}
|
||||
virtual void renderBackground() = 0;
|
||||
virtual void renderDecorations(int mouseX, int mouseY) {}
|
||||
|
||||
virtual void clickedHeader(int headerMouseX, int headerMouseY) {}
|
||||
int getItemAtXPositionRaw(int x);
|
||||
protected:
|
||||
MinecraftClient& minecraft;
|
||||
|
||||
float x0;
|
||||
float x1;
|
||||
int itemWidth;
|
||||
int width;
|
||||
int height;
|
||||
//private:
|
||||
float y0;
|
||||
float y1;
|
||||
|
||||
int dragState;
|
||||
float xDrag;
|
||||
float xo;
|
||||
float xoo;
|
||||
float xInertia;
|
||||
float _xinertia;
|
||||
|
||||
int selectionX;
|
||||
bool renderSelection;
|
||||
bool _componentSelected;
|
||||
|
||||
bool _renderTopBorder;
|
||||
bool _renderBottomBorder;
|
||||
|
||||
private:
|
||||
int headerWidth;
|
||||
bool doRenderHeader;
|
||||
long lastSelectionTime;
|
||||
int lastSelection;
|
||||
|
||||
float _lastxoo;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,94 +1,92 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__RolledSelectionListV_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__RolledSelectionListV_H__
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
class Minecraft;
|
||||
class Tesselator;
|
||||
|
||||
|
||||
class RolledSelectionListV : public GuiComponent
|
||||
{
|
||||
static const int NO_DRAG = -1;
|
||||
static const int DRAG_OUTSIDE = -2;
|
||||
static const int DRAG_NORMAL = 0;
|
||||
public:
|
||||
RolledSelectionListV(Minecraft* minecraft, int width, int height, int x0, int x1, int y0, int y1, int itemHeight);
|
||||
|
||||
virtual int getItemAtPosition(int x, int y);
|
||||
|
||||
virtual bool capYPosition();
|
||||
|
||||
virtual void tick();
|
||||
virtual void render(int xm, int ym, float a);
|
||||
virtual void renderHoleBackground(/*float x0, float x1,*/ float y0, float y1, int a0, int a1);
|
||||
virtual void setRenderSelection(bool _renderSelection);
|
||||
virtual void setComponentSelected(bool selected);
|
||||
protected:
|
||||
void setRenderHeader(bool _renderHeader, int _headerHeight);
|
||||
|
||||
virtual int getNumberOfItems() = 0;
|
||||
|
||||
virtual void selectStart(int item) {}
|
||||
virtual void selectCancel() {}
|
||||
virtual void selectItem(int item, bool doubleClick) = 0;
|
||||
virtual bool isSelectedItem(int item) = 0;
|
||||
|
||||
virtual int getMaxPosition();
|
||||
virtual float getPos(float alpha);
|
||||
virtual void touched();
|
||||
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t) = 0;
|
||||
virtual void renderHeader(int x, int y, Tesselator& t) {}
|
||||
virtual void renderBackground() = 0;
|
||||
virtual void renderForeground() {}
|
||||
virtual void renderDecorations(int mouseX, int mouseY) {}
|
||||
|
||||
virtual void clickedHeader(int headerMouseX, int headerMouseY) {}
|
||||
virtual int convertSelection(int item, int xm, int ym) { return item; }
|
||||
|
||||
int getItemAtYPositionRaw(int y);
|
||||
void evaluate(int xm, int ym);
|
||||
virtual void onPreRender();
|
||||
virtual void onPostRender();
|
||||
void renderDirtBackground();
|
||||
protected:
|
||||
Minecraft* minecraft;
|
||||
|
||||
float x0;
|
||||
float x1;
|
||||
int itemHeight;
|
||||
int width;
|
||||
int height;
|
||||
//private:
|
||||
float y0;
|
||||
float y1;
|
||||
|
||||
int dragState;
|
||||
float yDrag;
|
||||
float yo;
|
||||
float yoo;
|
||||
float yInertia;
|
||||
float _yinertia;
|
||||
|
||||
int selectionY;
|
||||
bool renderSelection;
|
||||
bool _componentSelected;
|
||||
|
||||
bool _renderDirtBackground;
|
||||
bool _renderTopBorder;
|
||||
bool _renderBottomBorder;
|
||||
|
||||
int _lastxm;
|
||||
int _lastym;
|
||||
private:
|
||||
int headerHeight;
|
||||
bool doRenderHeader;
|
||||
long lastSelectionTime;
|
||||
int lastSelection;
|
||||
|
||||
float _lastyoo;
|
||||
|
||||
float _stickPixels;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__RolledSelectionListV_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
class Minecraft;
|
||||
class Tesselator;
|
||||
|
||||
|
||||
class RolledSelectionListV : public GuiComponent
|
||||
{
|
||||
static const int NO_DRAG = -1;
|
||||
static const int DRAG_OUTSIDE = -2;
|
||||
static const int DRAG_NORMAL = 0;
|
||||
public:
|
||||
RolledSelectionListV(Minecraft* minecraft, int width, int height, int x0, int x1, int y0, int y1, int itemHeight);
|
||||
|
||||
virtual int getItemAtPosition(int x, int y);
|
||||
|
||||
virtual bool capYPosition();
|
||||
|
||||
virtual void tick();
|
||||
virtual void render(int xm, int ym, float a);
|
||||
virtual void renderHoleBackground(/*float x0, float x1,*/ float y0, float y1, int a0, int a1);
|
||||
virtual void setRenderSelection(bool _renderSelection);
|
||||
virtual void setComponentSelected(bool selected);
|
||||
protected:
|
||||
void setRenderHeader(bool _renderHeader, int _headerHeight);
|
||||
|
||||
virtual int getNumberOfItems() = 0;
|
||||
|
||||
virtual void selectStart(int item) {}
|
||||
virtual void selectCancel() {}
|
||||
virtual void selectItem(int item, bool doubleClick) = 0;
|
||||
virtual bool isSelectedItem(int item) = 0;
|
||||
|
||||
virtual int getMaxPosition();
|
||||
virtual float getPos(float alpha);
|
||||
virtual void touched();
|
||||
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t) = 0;
|
||||
virtual void renderHeader(int x, int y, Tesselator& t) {}
|
||||
virtual void renderBackground() = 0;
|
||||
virtual void renderForeground() {}
|
||||
virtual void renderDecorations(int mouseX, int mouseY) {}
|
||||
|
||||
virtual void clickedHeader(int headerMouseX, int headerMouseY) {}
|
||||
virtual int convertSelection(int item, int xm, int ym) { return item; }
|
||||
|
||||
int getItemAtYPositionRaw(int y);
|
||||
void evaluate(int xm, int ym);
|
||||
virtual void onPreRender();
|
||||
virtual void onPostRender();
|
||||
void renderDirtBackground();
|
||||
protected:
|
||||
Minecraft* minecraft;
|
||||
|
||||
float x0;
|
||||
float x1;
|
||||
int itemHeight;
|
||||
int width;
|
||||
int height;
|
||||
//private:
|
||||
float y0;
|
||||
float y1;
|
||||
|
||||
int dragState;
|
||||
float yDrag;
|
||||
float yo;
|
||||
float yoo;
|
||||
float yInertia;
|
||||
float _yinertia;
|
||||
|
||||
int selectionY;
|
||||
bool renderSelection;
|
||||
bool _componentSelected;
|
||||
|
||||
bool _renderDirtBackground;
|
||||
bool _renderTopBorder;
|
||||
bool _renderBottomBorder;
|
||||
|
||||
int _lastxm;
|
||||
int _lastym;
|
||||
private:
|
||||
int headerHeight;
|
||||
bool doRenderHeader;
|
||||
long lastSelectionTime;
|
||||
int lastSelection;
|
||||
|
||||
float _lastyoo;
|
||||
|
||||
float _stickPixels;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,69 +1,67 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ScrolledSelectionList_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ScrolledSelectionList_H__
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
class Minecraft;
|
||||
class Tesselator;
|
||||
|
||||
|
||||
class ScrolledSelectionList : public GuiComponent
|
||||
{
|
||||
static const int NO_DRAG = -1;
|
||||
static const int DRAG_OUTSIDE = -2;
|
||||
static const int DRAG_NORMAL = 0;
|
||||
static const int DRAG_SKIP = 1; // special case to fix android jump bug
|
||||
public:
|
||||
ScrolledSelectionList(Minecraft* _minecraft, int _width, int _height, int _y0, int _y1, int _itemHeight);
|
||||
|
||||
virtual void setRenderSelection(bool _renderSelection);
|
||||
protected:
|
||||
void setRenderHeader(bool _renderHeader, int _headerHeight);
|
||||
|
||||
virtual int getNumberOfItems() = 0;
|
||||
|
||||
virtual void selectItem(int item, bool doubleClick) = 0;
|
||||
virtual bool isSelectedItem(int item) = 0;
|
||||
|
||||
virtual int getMaxPosition();
|
||||
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t) = 0;
|
||||
virtual void renderHeader(int x, int y, Tesselator& t) {}
|
||||
virtual void renderBackground() = 0;
|
||||
virtual void renderDecorations(int mouseX, int mouseY) {}
|
||||
|
||||
virtual void clickedHeader(int headerMouseX, int headerMouseY) {}
|
||||
public:
|
||||
virtual int getItemAtPosition(int x, int y);
|
||||
|
||||
virtual void capYPosition();
|
||||
|
||||
virtual void render(int xm, int ym, float a);
|
||||
virtual void renderHoleBackground(float y0, float y1, int a0, int a1);
|
||||
void renderDirtBackground();
|
||||
protected:
|
||||
Minecraft* minecraft;
|
||||
|
||||
float y0;
|
||||
float y1;
|
||||
int itemHeight;
|
||||
private:
|
||||
int width;
|
||||
int height;
|
||||
float x1;
|
||||
float x0;
|
||||
|
||||
int ignoreY; // new attempt to fix android jump bug
|
||||
int dragState;
|
||||
float yDrag;
|
||||
float yo;
|
||||
float yInertia;
|
||||
|
||||
int selectionY;
|
||||
long lastSelectionTime;
|
||||
|
||||
bool renderSelection;
|
||||
bool doRenderHeader;
|
||||
int headerHeight;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ScrolledSelectionList_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
class Minecraft;
|
||||
class Tesselator;
|
||||
|
||||
|
||||
class ScrolledSelectionList : public GuiComponent
|
||||
{
|
||||
static const int NO_DRAG = -1;
|
||||
static const int DRAG_OUTSIDE = -2;
|
||||
static const int DRAG_NORMAL = 0;
|
||||
static const int DRAG_SKIP = 1; // special case to fix android jump bug
|
||||
public:
|
||||
ScrolledSelectionList(Minecraft* _minecraft, int _width, int _height, int _y0, int _y1, int _itemHeight);
|
||||
|
||||
virtual void setRenderSelection(bool _renderSelection);
|
||||
protected:
|
||||
void setRenderHeader(bool _renderHeader, int _headerHeight);
|
||||
|
||||
virtual int getNumberOfItems() = 0;
|
||||
|
||||
virtual void selectItem(int item, bool doubleClick) = 0;
|
||||
virtual bool isSelectedItem(int item) = 0;
|
||||
|
||||
virtual int getMaxPosition();
|
||||
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t) = 0;
|
||||
virtual void renderHeader(int x, int y, Tesselator& t) {}
|
||||
virtual void renderBackground() = 0;
|
||||
virtual void renderDecorations(int mouseX, int mouseY) {}
|
||||
|
||||
virtual void clickedHeader(int headerMouseX, int headerMouseY) {}
|
||||
public:
|
||||
virtual int getItemAtPosition(int x, int y);
|
||||
|
||||
virtual void capYPosition();
|
||||
|
||||
virtual void render(int xm, int ym, float a);
|
||||
virtual void renderHoleBackground(float y0, float y1, int a0, int a1);
|
||||
void renderDirtBackground();
|
||||
protected:
|
||||
Minecraft* minecraft;
|
||||
|
||||
float y0;
|
||||
float y1;
|
||||
int itemHeight;
|
||||
private:
|
||||
int width;
|
||||
int height;
|
||||
float x1;
|
||||
float x0;
|
||||
|
||||
int ignoreY; // new attempt to fix android jump bug
|
||||
int dragState;
|
||||
float yDrag;
|
||||
float yo;
|
||||
float yInertia;
|
||||
|
||||
int selectionY;
|
||||
long lastSelectionTime;
|
||||
|
||||
bool renderSelection;
|
||||
bool doRenderHeader;
|
||||
int headerHeight;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,203 +1,201 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ScrollingPane_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ScrollingPane_H__
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
#include "ImageButton.h"
|
||||
#include "../../player/input/touchscreen/TouchAreaModel.h"
|
||||
#include "../../../world/phys/Vec3.h"
|
||||
#include "../../Timer.h"
|
||||
|
||||
enum ScrollingPaneFlags {
|
||||
SF_LockX = 1 << 0,
|
||||
SF_LockY = 1 << 1,
|
||||
SF_WrapX = 1 << 2,
|
||||
SF_WrapY = 1 << 3,
|
||||
SF_HardLimits = 1 << 4,
|
||||
SF_MultiSelect = 1 << 5,
|
||||
//SF_Snap = 1 << 6,
|
||||
//SF_CustomSnap = 1 << 7,
|
||||
//SF_Scissor = 1 << 8,
|
||||
SF_ShowScrollbar= 1 << 9,
|
||||
SF_NoHoldSelect = 1 << 10
|
||||
};
|
||||
|
||||
typedef struct ScrollBar {
|
||||
ScrollBar()
|
||||
: alpha(0),
|
||||
fading(-1)
|
||||
{}
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
//bool visible;
|
||||
float alpha;
|
||||
int fading;
|
||||
} ScrollBar;
|
||||
|
||||
class ScrollingPane: public GuiComponent {
|
||||
public:
|
||||
typedef struct GridItem {
|
||||
int id;
|
||||
int x, y;
|
||||
// The GUI coordinates comes in (xf, yf)
|
||||
float xf, yf;
|
||||
bool selected;
|
||||
} GridItem;
|
||||
|
||||
ScrollingPane(int flags, const IntRectangle& boundingBox, const IntRectangle& itemRect, int columns, int numItems, float screenScale = 1.0f, const IntRectangle& itemBoundingRect = IntRectangle(0,0,0,0));
|
||||
~ScrollingPane();
|
||||
//void init(Minecraft*, int width, int height);
|
||||
void tick();
|
||||
void render(int xm, int ym, float alpha);
|
||||
|
||||
// scroll the content by the given amount (dx horizontal, dy vertical)
|
||||
// positive values move content downward/rightward
|
||||
void scrollBy(float dx, float dy);
|
||||
|
||||
bool getGridItemFor_slow(int itemIndex, GridItem& out);
|
||||
|
||||
void setSelected(int id, bool selected);
|
||||
|
||||
// This function is called with all visible GridItems. The base
|
||||
// implementation just dispatches each item to renderItem in y,x order
|
||||
virtual void renderBatch(std::vector<GridItem>& items, float alpha);
|
||||
virtual void renderItem(GridItem& item, float alpha);
|
||||
|
||||
//void render(int xx, int yy);
|
||||
bool queryHoldTime(int* gridId, int* heldMs);
|
||||
|
||||
protected:
|
||||
GridItem getItemForPos(float x, float y, bool isScreenPos);
|
||||
void handleUserInput();
|
||||
void addDeltaPos(float x, float y, float dt, int z);
|
||||
|
||||
void translate(float xo, float yo);
|
||||
|
||||
int flags;
|
||||
|
||||
int columns;
|
||||
int rows;
|
||||
int numItems;
|
||||
|
||||
int px, py;
|
||||
float fpx, fpy;
|
||||
|
||||
float screenScale;
|
||||
float invScreenScale;
|
||||
//bool hasItemBounding;
|
||||
|
||||
IntRectangle bbox;
|
||||
IntRectangle itemRect;
|
||||
IntRectangle itemBbox;
|
||||
RectangleArea area;
|
||||
RectangleArea bboxArea;
|
||||
|
||||
// Dragging info
|
||||
std::vector<float> dragDeltas;
|
||||
int dragState;
|
||||
Vec3 dragBeginPos;
|
||||
Vec3 dragBeginScreenPos;
|
||||
int dragTicks;
|
||||
float dragLastDeltaTimeStamp;
|
||||
Vec3 dragLastPos;
|
||||
|
||||
float dx, dy;
|
||||
float friction;
|
||||
|
||||
float dstx, dsty;
|
||||
|
||||
// Rewrite
|
||||
bool dragging; //!
|
||||
bool decelerating;
|
||||
bool tracking; //!
|
||||
|
||||
bool pagingEnabled; //!
|
||||
|
||||
Vec3 _contentOffset; //!
|
||||
Vec3 _contentOffsetBeforeDeceleration; //*
|
||||
|
||||
int lastEventTime; //<
|
||||
|
||||
Vec3 decelerationVelocity; //*
|
||||
Vec3 minDecelerationPoint; //*
|
||||
Vec3 maxDecelerationPoint; //*
|
||||
|
||||
float penetrationDeceleration; //<
|
||||
float penetrationAcceleration; //<
|
||||
|
||||
Vec3 minPoint; //*
|
||||
Vec3 startPosition; //*
|
||||
Vec3 startTouchPosition; //*
|
||||
Vec3 startTimePosition; //*
|
||||
|
||||
bool wasDeceleratingWhenTouchesBegan; //*
|
||||
bool firstDrag; //<
|
||||
|
||||
float startTime; //<
|
||||
//float startTime
|
||||
|
||||
IntRectangle size;
|
||||
int lastFrame;
|
||||
|
||||
bool _scrollEnabled; //!
|
||||
bool touchesHaveMoved; //*
|
||||
|
||||
virtual void didEndDragging() {}
|
||||
virtual void didEndDecelerating() {}
|
||||
virtual void willBeginDecelerating() {}
|
||||
virtual void willBeginDragging() {}
|
||||
|
||||
int te_moved,
|
||||
te_ended,
|
||||
te_highlight;
|
||||
int highlightTimer;
|
||||
int highlightStarted;
|
||||
GridItem highlightItem;
|
||||
|
||||
bool* selected;
|
||||
int selectedId;
|
||||
|
||||
ScrollBar vScroll, hScroll;
|
||||
|
||||
IntRectangle adjustedContentSize;
|
||||
void touchesBegan(float x, float y, int t);
|
||||
void touchesMoved(float x, float y, int t);
|
||||
void touchesEnded(float x, float y, int t);
|
||||
void touchesCancelled(float x, float y, int t);
|
||||
void beginTracking(float x, float y, int t);
|
||||
void onHoldItem();
|
||||
|
||||
void _onSelect( int id );
|
||||
virtual bool onSelect(int gridId, bool selected);
|
||||
|
||||
Vec3& contentOffset();
|
||||
|
||||
void startDecelerationAnimation(bool force);
|
||||
void stopDecelerationAnimation();
|
||||
void stepThroughDecelerationAnimation(bool f);
|
||||
|
||||
void setContentOffset(float x, float y);
|
||||
void setContentOffset(Vec3 a);
|
||||
void setContentOffsetWithAnimation(Vec3 b, bool doScroll);
|
||||
void snapContentOffsetToBounds(bool snap); //*
|
||||
void adjustContentSize();
|
||||
//TouchAreaModel _areaModel;
|
||||
|
||||
bool isAllSet(int flag) { return (flags & flag) == flag; }
|
||||
bool isSet(int flag) { return (flags & flag) != 0; }
|
||||
bool isNotSet(int flag) { return !isSet(flag); }
|
||||
|
||||
void updateHorizontalScrollIndicator();
|
||||
void updateVerticalScrollIndicator();
|
||||
void hideScrollIndicators(); //*
|
||||
void updateScrollFade( ScrollBar& vScroll );
|
||||
private:
|
||||
Timer _timer;
|
||||
bool _doStepTimer;
|
||||
bool _wasDown;
|
||||
float _lx;
|
||||
float _ly;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__ScrollingPane_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
#include "ImageButton.h"
|
||||
#include "../../player/input/touchscreen/TouchAreaModel.h"
|
||||
#include "../../../world/phys/Vec3.h"
|
||||
#include "../../Timer.h"
|
||||
|
||||
enum ScrollingPaneFlags {
|
||||
SF_LockX = 1 << 0,
|
||||
SF_LockY = 1 << 1,
|
||||
SF_WrapX = 1 << 2,
|
||||
SF_WrapY = 1 << 3,
|
||||
SF_HardLimits = 1 << 4,
|
||||
SF_MultiSelect = 1 << 5,
|
||||
//SF_Snap = 1 << 6,
|
||||
//SF_CustomSnap = 1 << 7,
|
||||
//SF_Scissor = 1 << 8,
|
||||
SF_ShowScrollbar= 1 << 9,
|
||||
SF_NoHoldSelect = 1 << 10
|
||||
};
|
||||
|
||||
typedef struct ScrollBar {
|
||||
ScrollBar()
|
||||
: alpha(0),
|
||||
fading(-1)
|
||||
{}
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
//bool visible;
|
||||
float alpha;
|
||||
int fading;
|
||||
} ScrollBar;
|
||||
|
||||
class ScrollingPane: public GuiComponent {
|
||||
public:
|
||||
typedef struct GridItem {
|
||||
int id;
|
||||
int x, y;
|
||||
// The GUI coordinates comes in (xf, yf)
|
||||
float xf, yf;
|
||||
bool selected;
|
||||
} GridItem;
|
||||
|
||||
ScrollingPane(int flags, const IntRectangle& boundingBox, const IntRectangle& itemRect, int columns, int numItems, float screenScale = 1.0f, const IntRectangle& itemBoundingRect = IntRectangle(0,0,0,0));
|
||||
~ScrollingPane();
|
||||
//void init(Minecraft*, int width, int height);
|
||||
void tick();
|
||||
void render(int xm, int ym, float alpha);
|
||||
|
||||
// scroll the content by the given amount (dx horizontal, dy vertical)
|
||||
// positive values move content downward/rightward
|
||||
void scrollBy(float dx, float dy);
|
||||
|
||||
bool getGridItemFor_slow(int itemIndex, GridItem& out);
|
||||
|
||||
void setSelected(int id, bool selected);
|
||||
|
||||
// This function is called with all visible GridItems. The base
|
||||
// implementation just dispatches each item to renderItem in y,x order
|
||||
virtual void renderBatch(std::vector<GridItem>& items, float alpha);
|
||||
virtual void renderItem(GridItem& item, float alpha);
|
||||
|
||||
//void render(int xx, int yy);
|
||||
bool queryHoldTime(int* gridId, int* heldMs);
|
||||
|
||||
protected:
|
||||
GridItem getItemForPos(float x, float y, bool isScreenPos);
|
||||
void handleUserInput();
|
||||
void addDeltaPos(float x, float y, float dt, int z);
|
||||
|
||||
void translate(float xo, float yo);
|
||||
|
||||
int flags;
|
||||
|
||||
int columns;
|
||||
int rows;
|
||||
int numItems;
|
||||
|
||||
int px, py;
|
||||
float fpx, fpy;
|
||||
|
||||
float screenScale;
|
||||
float invScreenScale;
|
||||
//bool hasItemBounding;
|
||||
|
||||
IntRectangle bbox;
|
||||
IntRectangle itemRect;
|
||||
IntRectangle itemBbox;
|
||||
RectangleArea area;
|
||||
RectangleArea bboxArea;
|
||||
|
||||
// Dragging info
|
||||
std::vector<float> dragDeltas;
|
||||
int dragState;
|
||||
Vec3 dragBeginPos;
|
||||
Vec3 dragBeginScreenPos;
|
||||
int dragTicks;
|
||||
float dragLastDeltaTimeStamp;
|
||||
Vec3 dragLastPos;
|
||||
|
||||
float dx, dy;
|
||||
float friction;
|
||||
|
||||
float dstx, dsty;
|
||||
|
||||
// Rewrite
|
||||
bool dragging; //!
|
||||
bool decelerating;
|
||||
bool tracking; //!
|
||||
|
||||
bool pagingEnabled; //!
|
||||
|
||||
Vec3 _contentOffset; //!
|
||||
Vec3 _contentOffsetBeforeDeceleration; //*
|
||||
|
||||
int lastEventTime; //<
|
||||
|
||||
Vec3 decelerationVelocity; //*
|
||||
Vec3 minDecelerationPoint; //*
|
||||
Vec3 maxDecelerationPoint; //*
|
||||
|
||||
float penetrationDeceleration; //<
|
||||
float penetrationAcceleration; //<
|
||||
|
||||
Vec3 minPoint; //*
|
||||
Vec3 startPosition; //*
|
||||
Vec3 startTouchPosition; //*
|
||||
Vec3 startTimePosition; //*
|
||||
|
||||
bool wasDeceleratingWhenTouchesBegan; //*
|
||||
bool firstDrag; //<
|
||||
|
||||
float startTime; //<
|
||||
//float startTime
|
||||
|
||||
IntRectangle size;
|
||||
int lastFrame;
|
||||
|
||||
bool _scrollEnabled; //!
|
||||
bool touchesHaveMoved; //*
|
||||
|
||||
virtual void didEndDragging() {}
|
||||
virtual void didEndDecelerating() {}
|
||||
virtual void willBeginDecelerating() {}
|
||||
virtual void willBeginDragging() {}
|
||||
|
||||
int te_moved,
|
||||
te_ended,
|
||||
te_highlight;
|
||||
int highlightTimer;
|
||||
int highlightStarted;
|
||||
GridItem highlightItem;
|
||||
|
||||
bool* selected;
|
||||
int selectedId;
|
||||
|
||||
ScrollBar vScroll, hScroll;
|
||||
|
||||
IntRectangle adjustedContentSize;
|
||||
void touchesBegan(float x, float y, int t);
|
||||
void touchesMoved(float x, float y, int t);
|
||||
void touchesEnded(float x, float y, int t);
|
||||
void touchesCancelled(float x, float y, int t);
|
||||
void beginTracking(float x, float y, int t);
|
||||
void onHoldItem();
|
||||
|
||||
void _onSelect( int id );
|
||||
virtual bool onSelect(int gridId, bool selected);
|
||||
|
||||
Vec3& contentOffset();
|
||||
|
||||
void startDecelerationAnimation(bool force);
|
||||
void stopDecelerationAnimation();
|
||||
void stepThroughDecelerationAnimation(bool f);
|
||||
|
||||
void setContentOffset(float x, float y);
|
||||
void setContentOffset(Vec3 a);
|
||||
void setContentOffsetWithAnimation(Vec3 b, bool doScroll);
|
||||
void snapContentOffsetToBounds(bool snap); //*
|
||||
void adjustContentSize();
|
||||
//TouchAreaModel _areaModel;
|
||||
|
||||
bool isAllSet(int flag) { return (flags & flag) == flag; }
|
||||
bool isSet(int flag) { return (flags & flag) != 0; }
|
||||
bool isNotSet(int flag) { return !isSet(flag); }
|
||||
|
||||
void updateHorizontalScrollIndicator();
|
||||
void updateVerticalScrollIndicator();
|
||||
void hideScrollIndicators(); //*
|
||||
void updateScrollFade( ScrollBar& vScroll );
|
||||
private:
|
||||
Timer _timer;
|
||||
bool _doStepTimer;
|
||||
bool _wasDown;
|
||||
float _lx;
|
||||
float _ly;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,48 +1,46 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__Slider_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__Slider_H__
|
||||
|
||||
#include "GuiElement.h"
|
||||
#include "../../../client/Options.h"
|
||||
#include <client/Option.h>
|
||||
|
||||
class Slider : public GuiElement {
|
||||
typedef GuiElement super;
|
||||
public:
|
||||
virtual void render( Minecraft* minecraft, int xm, int ym );
|
||||
virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
virtual void tick(Minecraft* minecraft);
|
||||
|
||||
protected:
|
||||
Slider(OptionId optId);
|
||||
|
||||
OptionId m_optId;
|
||||
|
||||
bool m_mouseDownOnElement;
|
||||
float m_percentage;
|
||||
int m_numSteps;
|
||||
};
|
||||
|
||||
class SliderFloat : public Slider {
|
||||
public:
|
||||
SliderFloat(Minecraft* minecraft, OptionId option);
|
||||
|
||||
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) override;
|
||||
|
||||
protected:
|
||||
OptionFloat* m_option;
|
||||
};
|
||||
|
||||
|
||||
class SliderInt : public Slider {
|
||||
public:
|
||||
SliderInt(Minecraft* minecraft, OptionId option);
|
||||
|
||||
virtual void render( Minecraft* minecraft, int xm, int ym ) override;
|
||||
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) override;
|
||||
|
||||
protected:
|
||||
OptionInt* m_option;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__Slider_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "GuiElement.h"
|
||||
#include "../../../client/Options.h"
|
||||
#include <client/Option.h>
|
||||
|
||||
class Slider : public GuiElement {
|
||||
typedef GuiElement super;
|
||||
public:
|
||||
virtual void render( Minecraft* minecraft, int xm, int ym );
|
||||
virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum );
|
||||
virtual void tick(Minecraft* minecraft);
|
||||
|
||||
protected:
|
||||
Slider(OptionId optId);
|
||||
|
||||
OptionId m_optId;
|
||||
|
||||
bool m_mouseDownOnElement;
|
||||
float m_percentage;
|
||||
int m_numSteps;
|
||||
};
|
||||
|
||||
class SliderFloat : public Slider {
|
||||
public:
|
||||
SliderFloat(Minecraft* minecraft, OptionId option);
|
||||
|
||||
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) override;
|
||||
|
||||
protected:
|
||||
OptionFloat* m_option;
|
||||
};
|
||||
|
||||
|
||||
class SliderInt : public Slider {
|
||||
public:
|
||||
SliderInt(Minecraft* minecraft, OptionId option);
|
||||
|
||||
virtual void render( Minecraft* minecraft, int xm, int ym ) override;
|
||||
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) override;
|
||||
|
||||
protected:
|
||||
OptionInt* m_option;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,44 +1,42 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__TextBox_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__TextBox_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
#include "GuiElement.h"
|
||||
#include "../../Options.h"
|
||||
#include "../../../platform/input/Mouse.h"
|
||||
#include "../../../platform/input/Keyboard.h"
|
||||
|
||||
class Font;
|
||||
class Minecraft;
|
||||
|
||||
class TextBox: public GuiElement
|
||||
{
|
||||
public:
|
||||
TextBox(int id, const std::string& msg);
|
||||
TextBox(int id, int x, int y, const std::string& msg);
|
||||
TextBox(int id, int x, int y, int w, int h, const std::string& msg);
|
||||
|
||||
virtual void mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum);
|
||||
|
||||
virtual void setFocus(Minecraft* minecraft);
|
||||
virtual bool loseFocus(Minecraft* minecraft);
|
||||
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
|
||||
virtual void keyPressed(Minecraft* minecraft, int key);
|
||||
virtual void charPressed(Minecraft* minecraft, char c);
|
||||
virtual void tick(Minecraft* minecraft);
|
||||
|
||||
public:
|
||||
std::string hint;
|
||||
std::string text;
|
||||
int id;
|
||||
|
||||
int blinkTicks;
|
||||
|
||||
bool focused;
|
||||
bool blink;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__TextBox_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include <string>
|
||||
#include "GuiElement.h"
|
||||
#include "../../Options.h"
|
||||
#include "../../../platform/input/Mouse.h"
|
||||
#include "../../../platform/input/Keyboard.h"
|
||||
|
||||
class Font;
|
||||
class Minecraft;
|
||||
|
||||
class TextBox: public GuiElement
|
||||
{
|
||||
public:
|
||||
TextBox(int id, const std::string& msg);
|
||||
TextBox(int id, int x, int y, const std::string& msg);
|
||||
TextBox(int id, int x, int y, int w, int h, const std::string& msg);
|
||||
|
||||
virtual void mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum);
|
||||
|
||||
virtual void setFocus(Minecraft* minecraft);
|
||||
virtual bool loseFocus(Minecraft* minecraft);
|
||||
|
||||
virtual void render(Minecraft* minecraft, int xm, int ym);
|
||||
|
||||
virtual void keyPressed(Minecraft* minecraft, int key);
|
||||
virtual void charPressed(Minecraft* minecraft, char c);
|
||||
virtual void tick(Minecraft* minecraft);
|
||||
|
||||
public:
|
||||
std::string hint;
|
||||
std::string text;
|
||||
int id;
|
||||
|
||||
int blinkTicks;
|
||||
|
||||
bool focused;
|
||||
bool blink;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,79 +1,77 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ArmorScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ArmorScreen_H__
|
||||
|
||||
#include "BaseContainerScreen.h"
|
||||
|
||||
#include "../components/InventoryPane.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class Font;
|
||||
class CItem;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class Tesselator;
|
||||
|
||||
class ArmorScreen: public Screen,
|
||||
public Touch::IInventoryPaneCallback
|
||||
{
|
||||
typedef Screen super;
|
||||
typedef std::vector<CItem*> ItemList;
|
||||
|
||||
static const int NUM_ARMORBUTTONS = 4;
|
||||
public:
|
||||
ArmorScreen();
|
||||
~ArmorScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
bool renderGameBehind();
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
// IInventoryPaneCallback
|
||||
bool addItem(const Touch::InventoryPane* pane, int itemId);
|
||||
bool isAllowed( int slot );
|
||||
std::vector<const ItemInstance*> getItems( const Touch::InventoryPane* forPane );
|
||||
private:
|
||||
void renderPlayer(float xo, float yo);
|
||||
|
||||
void setupInventoryPane();
|
||||
void updateItems();
|
||||
|
||||
void drawSlotItemAt(Tesselator& t, int slot, const ItemInstance* item, int x, int y);
|
||||
ItemInstance moveOver(const ItemInstance* item, int maxCount);
|
||||
void takeAndClearSlot( int slot );
|
||||
void handleRenderPane(Touch::InventoryPane* pane, Tesselator& t, int xm, int ym, float a);
|
||||
bool canMoveToSlot(int slot, const ItemInstance* item);
|
||||
ItemList _items;
|
||||
|
||||
std::string currentItemDesc;
|
||||
ItemInstance burnResult;
|
||||
float descWidth;
|
||||
ImageButton btnClose;
|
||||
|
||||
BlankButton btnArmor0;
|
||||
BlankButton btnArmor1;
|
||||
BlankButton btnArmor2;
|
||||
BlankButton btnArmor3;
|
||||
BlankButton* armorButtons[4];
|
||||
|
||||
Touch::THeader bHeader;
|
||||
|
||||
Touch::InventoryPane* inventoryPane;
|
||||
IntRectangle inventoryPaneRect;
|
||||
IntRectangle guiPlayerBgRect;
|
||||
|
||||
std::vector<const ItemInstance*> armorItems;
|
||||
bool doRecreatePane;
|
||||
|
||||
// GUI elements such as 9-Patches
|
||||
NinePatchLayer* guiBackground;
|
||||
NinePatchLayer* guiSlot;
|
||||
NinePatchLayer* guiPaneFrame;
|
||||
NinePatchLayer* guiPlayerBg;
|
||||
Player* player;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ArmorScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "BaseContainerScreen.h"
|
||||
|
||||
#include "../components/InventoryPane.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class Font;
|
||||
class CItem;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class Tesselator;
|
||||
|
||||
class ArmorScreen: public Screen,
|
||||
public Touch::IInventoryPaneCallback
|
||||
{
|
||||
typedef Screen super;
|
||||
typedef std::vector<CItem*> ItemList;
|
||||
|
||||
static const int NUM_ARMORBUTTONS = 4;
|
||||
public:
|
||||
ArmorScreen();
|
||||
~ArmorScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
bool renderGameBehind();
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
// IInventoryPaneCallback
|
||||
bool addItem(const Touch::InventoryPane* pane, int itemId);
|
||||
bool isAllowed( int slot );
|
||||
std::vector<const ItemInstance*> getItems( const Touch::InventoryPane* forPane );
|
||||
private:
|
||||
void renderPlayer(float xo, float yo);
|
||||
|
||||
void setupInventoryPane();
|
||||
void updateItems();
|
||||
|
||||
void drawSlotItemAt(Tesselator& t, int slot, const ItemInstance* item, int x, int y);
|
||||
ItemInstance moveOver(const ItemInstance* item, int maxCount);
|
||||
void takeAndClearSlot( int slot );
|
||||
void handleRenderPane(Touch::InventoryPane* pane, Tesselator& t, int xm, int ym, float a);
|
||||
bool canMoveToSlot(int slot, const ItemInstance* item);
|
||||
ItemList _items;
|
||||
|
||||
std::string currentItemDesc;
|
||||
ItemInstance burnResult;
|
||||
float descWidth;
|
||||
ImageButton btnClose;
|
||||
|
||||
BlankButton btnArmor0;
|
||||
BlankButton btnArmor1;
|
||||
BlankButton btnArmor2;
|
||||
BlankButton btnArmor3;
|
||||
BlankButton* armorButtons[4];
|
||||
|
||||
Touch::THeader bHeader;
|
||||
|
||||
Touch::InventoryPane* inventoryPane;
|
||||
IntRectangle inventoryPaneRect;
|
||||
IntRectangle guiPlayerBgRect;
|
||||
|
||||
std::vector<const ItemInstance*> armorItems;
|
||||
bool doRecreatePane;
|
||||
|
||||
// GUI elements such as 9-Patches
|
||||
NinePatchLayer* guiBackground;
|
||||
NinePatchLayer* guiSlot;
|
||||
NinePatchLayer* guiPaneFrame;
|
||||
NinePatchLayer* guiPlayerBg;
|
||||
Player* player;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,50 +1,48 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__BaseContainerScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__BaseContainerScreen_H__
|
||||
|
||||
//package net.minecraft.client.gui.screens;
|
||||
|
||||
#include <vector>
|
||||
#include "../Screen.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../player/LocalPlayer.h"
|
||||
|
||||
class BaseContainerMenu;
|
||||
|
||||
class BaseContainerScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
BaseContainerScreen(BaseContainerMenu* menu)
|
||||
: menu(menu)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void init() {
|
||||
super::init();
|
||||
minecraft->player->containerMenu = menu;
|
||||
}
|
||||
|
||||
virtual void tick() {
|
||||
super::tick();
|
||||
if (!minecraft->player->isAlive() || minecraft->player->removed)
|
||||
minecraft->player->closeContainer();
|
||||
}
|
||||
|
||||
virtual void keyPressed( int eventKey )
|
||||
{
|
||||
if (eventKey == Keyboard::KEY_ESCAPE) {
|
||||
minecraft->player->closeContainer();
|
||||
} else {
|
||||
super::keyPressed(eventKey);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool closeOnPlayerHurt() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
BaseContainerMenu* menu;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__BaseContainerScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui.screens;
|
||||
|
||||
#include <vector>
|
||||
#include "../Screen.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../player/LocalPlayer.h"
|
||||
|
||||
class BaseContainerMenu;
|
||||
|
||||
class BaseContainerScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
BaseContainerScreen(BaseContainerMenu* menu)
|
||||
: menu(menu)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void init() {
|
||||
super::init();
|
||||
minecraft->player->containerMenu = menu;
|
||||
}
|
||||
|
||||
virtual void tick() {
|
||||
super::tick();
|
||||
if (!minecraft->player->isAlive() || minecraft->player->removed)
|
||||
minecraft->player->closeContainer();
|
||||
}
|
||||
|
||||
virtual void keyPressed( int eventKey )
|
||||
{
|
||||
if (eventKey == Keyboard::KEY_ESCAPE) {
|
||||
minecraft->player->closeContainer();
|
||||
} else {
|
||||
super::keyPressed(eventKey);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool closeOnPlayerHurt() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
BaseContainerMenu* menu;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ChatScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ChatScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
|
||||
class ChatScreen: public Screen
|
||||
{
|
||||
public:
|
||||
ChatScreen() {}
|
||||
virtual ~ChatScreen() {}
|
||||
|
||||
void init();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button) {};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ChatScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
|
||||
class ChatScreen: public Screen
|
||||
{
|
||||
public:
|
||||
ChatScreen() {}
|
||||
virtual ~ChatScreen() {}
|
||||
|
||||
void init();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button) {};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -1,72 +1,70 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ChestScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ChestScreen_H__
|
||||
|
||||
#include "BaseContainerScreen.h"
|
||||
|
||||
#include "../components/InventoryPane.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class Font;
|
||||
class CItem;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class FillingContainer;
|
||||
class ChestTileEntity;
|
||||
class Tesselator;
|
||||
|
||||
class ChestScreen: public BaseContainerScreen,
|
||||
public Touch::IInventoryPaneCallback
|
||||
{
|
||||
typedef BaseContainerScreen super;
|
||||
typedef std::vector<CItem*> ItemList;
|
||||
friend class ItemPane;
|
||||
public:
|
||||
ChestScreen(Player* player, ChestTileEntity* chest);
|
||||
~ChestScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
bool renderGameBehind();
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
// IInventoryPaneCallback
|
||||
bool addItem(const Touch::InventoryPane* pane, int itemId);
|
||||
bool isAllowed( int slot );
|
||||
std::vector<const ItemInstance*> getItems( const Touch::InventoryPane* forPane );
|
||||
//const ItemList& getItems(const ItemPane* forPane);
|
||||
private:
|
||||
void setupPane();
|
||||
|
||||
void drawSlotItemAt(Tesselator& t, const ItemInstance* item, int x, int y, bool selected);
|
||||
bool handleAddItem(FillingContainer* from, FillingContainer* to, int itemIndex);
|
||||
void handleRenderPane(Touch::InventoryPane* pane, Tesselator& t, int xm, int ym, float a);
|
||||
|
||||
std::string currentItemDesc;
|
||||
ImageButton btnClose;
|
||||
Touch::THeader bHeader;
|
||||
Touch::THeader bHeaderChest;
|
||||
|
||||
Touch::InventoryPane* inventoryPane;
|
||||
Touch::InventoryPane* chestPane;
|
||||
IntRectangle panesBbox;
|
||||
|
||||
std::vector<const ItemInstance*> inventoryItems;
|
||||
std::vector<const ItemInstance*> chestItems;
|
||||
bool doRecreatePane;
|
||||
|
||||
int selectedSlot;
|
||||
|
||||
// GUI elements such as 9-Patches
|
||||
NinePatchLayer* guiBackground;
|
||||
NinePatchLayer* guiSlot;
|
||||
NinePatchLayer* guiSlotMarked;
|
||||
NinePatchLayer* guiSlotMarker;
|
||||
NinePatchLayer* guiPaneFrame;
|
||||
Player* player;
|
||||
ChestTileEntity* chest;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ChestScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "BaseContainerScreen.h"
|
||||
|
||||
#include "../components/InventoryPane.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class Font;
|
||||
class CItem;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class FillingContainer;
|
||||
class ChestTileEntity;
|
||||
class Tesselator;
|
||||
|
||||
class ChestScreen: public BaseContainerScreen,
|
||||
public Touch::IInventoryPaneCallback
|
||||
{
|
||||
typedef BaseContainerScreen super;
|
||||
typedef std::vector<CItem*> ItemList;
|
||||
friend class ItemPane;
|
||||
public:
|
||||
ChestScreen(Player* player, ChestTileEntity* chest);
|
||||
~ChestScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
bool renderGameBehind();
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
// IInventoryPaneCallback
|
||||
bool addItem(const Touch::InventoryPane* pane, int itemId);
|
||||
bool isAllowed( int slot );
|
||||
std::vector<const ItemInstance*> getItems( const Touch::InventoryPane* forPane );
|
||||
//const ItemList& getItems(const ItemPane* forPane);
|
||||
private:
|
||||
void setupPane();
|
||||
|
||||
void drawSlotItemAt(Tesselator& t, const ItemInstance* item, int x, int y, bool selected);
|
||||
bool handleAddItem(FillingContainer* from, FillingContainer* to, int itemIndex);
|
||||
void handleRenderPane(Touch::InventoryPane* pane, Tesselator& t, int xm, int ym, float a);
|
||||
|
||||
std::string currentItemDesc;
|
||||
ImageButton btnClose;
|
||||
Touch::THeader bHeader;
|
||||
Touch::THeader bHeaderChest;
|
||||
|
||||
Touch::InventoryPane* inventoryPane;
|
||||
Touch::InventoryPane* chestPane;
|
||||
IntRectangle panesBbox;
|
||||
|
||||
std::vector<const ItemInstance*> inventoryItems;
|
||||
std::vector<const ItemInstance*> chestItems;
|
||||
bool doRecreatePane;
|
||||
|
||||
int selectedSlot;
|
||||
|
||||
// GUI elements such as 9-Patches
|
||||
NinePatchLayer* guiBackground;
|
||||
NinePatchLayer* guiSlot;
|
||||
NinePatchLayer* guiSlotMarked;
|
||||
NinePatchLayer* guiSlotMarker;
|
||||
NinePatchLayer* guiPaneFrame;
|
||||
Player* player;
|
||||
ChestTileEntity* chest;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ChooseLevelScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ChooseLevelScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../../../world/level/storage/LevelStorageSource.h"
|
||||
|
||||
class ChooseLevelScreen: public Screen
|
||||
{
|
||||
public:
|
||||
void init();
|
||||
|
||||
protected:
|
||||
std::string getUniqueLevelName(const std::string& level);
|
||||
|
||||
private:
|
||||
void loadLevelSource();
|
||||
|
||||
LevelSummaryList levels;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ChooseLevelScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../../../world/level/storage/LevelStorageSource.h"
|
||||
|
||||
class ChooseLevelScreen: public Screen
|
||||
{
|
||||
public:
|
||||
void init();
|
||||
|
||||
protected:
|
||||
std::string getUniqueLevelName(const std::string& level);
|
||||
|
||||
private:
|
||||
void loadLevelSource();
|
||||
|
||||
LevelSummaryList levels;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,40 +1,38 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ConfirmScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ConfirmScreen_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include "../Screen.h"
|
||||
#include <string>
|
||||
|
||||
class ConfirmScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
ConfirmScreen(Screen* parent_, const std::string& title1_, const std::string& title2_, int id_);
|
||||
ConfirmScreen(Screen* parent_, const std::string& title1_, const std::string& title2_, const std::string& yesButton, const std::string& noButton, int id_);
|
||||
~ConfirmScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
bool handleBackEvent(bool isDown);
|
||||
void render(int xm, int ym, float a);
|
||||
protected:
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
virtual void postResult(bool isOk);
|
||||
|
||||
Screen* parent;
|
||||
int id;
|
||||
private:
|
||||
std::string title1;
|
||||
std::string title2;
|
||||
|
||||
std::string yesButtonText;
|
||||
std::string noButtonText;
|
||||
|
||||
Button* yesButton; // 0
|
||||
Button* noButton; // 1
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ConfirmScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include "../Screen.h"
|
||||
#include <string>
|
||||
|
||||
class ConfirmScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
ConfirmScreen(Screen* parent_, const std::string& title1_, const std::string& title2_, int id_);
|
||||
ConfirmScreen(Screen* parent_, const std::string& title1_, const std::string& title2_, const std::string& yesButton, const std::string& noButton, int id_);
|
||||
~ConfirmScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
bool handleBackEvent(bool isDown);
|
||||
void render(int xm, int ym, float a);
|
||||
protected:
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
virtual void postResult(bool isOk);
|
||||
|
||||
Screen* parent;
|
||||
int id;
|
||||
private:
|
||||
std::string title1;
|
||||
std::string title2;
|
||||
|
||||
std::string yesButtonText;
|
||||
std::string noButtonText;
|
||||
|
||||
Button* yesButton; // 0
|
||||
Button* noButton; // 1
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ConsoleScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ConsoleScreen_H__
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include <string>
|
||||
@@ -31,4 +30,3 @@ private:
|
||||
int _cursorBlink; // tick counter for cursor blink
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ConsoleScreen_H__*/
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__CreditsScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__CreditsScreen_H__
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
@@ -29,4 +28,3 @@ private:
|
||||
float _scrollSpeed;
|
||||
};
|
||||
|
||||
#endif /* NET_MINECRAFT_CLIENT_GUI_SCREENS__CreditsScreen_H__ */
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__DeathScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__DeathScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
class Button;
|
||||
|
||||
class DeathScreen: public Screen
|
||||
{
|
||||
public:
|
||||
DeathScreen();
|
||||
|
||||
virtual ~DeathScreen();
|
||||
|
||||
void init();
|
||||
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
private:
|
||||
Button* bRespawn;
|
||||
Button* bTitle;
|
||||
bool _hasChosen;
|
||||
int _tick;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__DeathScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
class Button;
|
||||
|
||||
class DeathScreen: public Screen
|
||||
{
|
||||
public:
|
||||
DeathScreen();
|
||||
|
||||
virtual ~DeathScreen();
|
||||
|
||||
void init();
|
||||
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
private:
|
||||
Button* bRespawn;
|
||||
Button* bTitle;
|
||||
bool _hasChosen;
|
||||
int _tick;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__DialogDefinitions_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__DialogDefinitions_H__
|
||||
|
||||
class DialogDefinitions {
|
||||
public:
|
||||
static const int DIALOG_CREATE_NEW_WORLD = 1;
|
||||
static const int DIALOG_NEW_CHAT_MESSAGE = 2;
|
||||
static const int DIALOG_MAINMENU_OPTIONS = 3;
|
||||
static const int DIALOG_RENAME_MP_WORLD = 4;
|
||||
static const int DIALOG_DEMO_FEATURE_DISABLED = 98;
|
||||
};
|
||||
|
||||
#endif /*#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__DialogDefinitions_H__*/
|
||||
#pragma once
|
||||
|
||||
class DialogDefinitions {
|
||||
public:
|
||||
static const int DIALOG_CREATE_NEW_WORLD = 1;
|
||||
static const int DIALOG_NEW_CHAT_MESSAGE = 2;
|
||||
static const int DIALOG_MAINMENU_OPTIONS = 3;
|
||||
static const int DIALOG_RENAME_MP_WORLD = 4;
|
||||
static const int DIALOG_DEMO_FEATURE_DISABLED = 98;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,57 +1,55 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__DisconnectionScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__DisconnectionScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../Font.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include <string>
|
||||
|
||||
class DisconnectionScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
DisconnectionScreen(const std::string& msg)
|
||||
: _msg(msg),
|
||||
_back(NULL)
|
||||
{}
|
||||
|
||||
~DisconnectionScreen() {
|
||||
delete _back;
|
||||
}
|
||||
|
||||
void init() {
|
||||
if (/* minecraft->useTouchscreen() */ true)
|
||||
_back = new Touch::TButton(1, "Ok");
|
||||
else
|
||||
_back = new Button(1, "Ok");
|
||||
|
||||
buttons.push_back(_back);
|
||||
tabButtons.push_back(_back);
|
||||
|
||||
_back->width = 128;
|
||||
_back->x = (width - _back->width) / 2;
|
||||
_back->y = height / 2;
|
||||
}
|
||||
|
||||
void render( int xm, int ym, float a ) {
|
||||
renderBackground();
|
||||
super::render(xm, ym, a);
|
||||
|
||||
int center = (width - minecraft->font->width(_msg)) / 2;
|
||||
minecraft->font->drawShadow(_msg, (float)center, (float)(height / 2 - 32), 0xffffffff);
|
||||
}
|
||||
|
||||
void buttonClicked(Button* button) {
|
||||
if (button->id == _back->id) {
|
||||
minecraft->leaveGame();
|
||||
}
|
||||
}
|
||||
bool isInGameScreen() { return false; }
|
||||
|
||||
private:
|
||||
std::string _msg;
|
||||
Button* _back;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__DisconnectionScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../Font.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include <string>
|
||||
|
||||
class DisconnectionScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
DisconnectionScreen(const std::string& msg)
|
||||
: _msg(msg),
|
||||
_back(NULL)
|
||||
{}
|
||||
|
||||
~DisconnectionScreen() {
|
||||
delete _back;
|
||||
}
|
||||
|
||||
void init() {
|
||||
if (/* minecraft->useTouchscreen() */ true)
|
||||
_back = new Touch::TButton(1, "Ok");
|
||||
else
|
||||
_back = new Button(1, "Ok");
|
||||
|
||||
buttons.push_back(_back);
|
||||
tabButtons.push_back(_back);
|
||||
|
||||
_back->width = 128;
|
||||
_back->x = (width - _back->width) / 2;
|
||||
_back->y = height / 2;
|
||||
}
|
||||
|
||||
void render( int xm, int ym, float a ) {
|
||||
renderBackground();
|
||||
super::render(xm, ym, a);
|
||||
|
||||
int center = (width - minecraft->font->width(_msg)) / 2;
|
||||
minecraft->font->drawShadow(_msg, (float)center, (float)(height / 2 - 32), 0xffffffff);
|
||||
}
|
||||
|
||||
void buttonClicked(Button* button) {
|
||||
if (button->id == _back->id) {
|
||||
minecraft->leaveGame();
|
||||
}
|
||||
}
|
||||
bool isInGameScreen() { return false; }
|
||||
|
||||
private:
|
||||
std::string _msg;
|
||||
Button* _back;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,84 +1,82 @@
|
||||
#ifndef _FURNACESCREEN_H__
|
||||
#define _FURNACESCREEN_H__
|
||||
|
||||
#include "BaseContainerScreen.h"
|
||||
|
||||
#include "../components/InventoryPane.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class Font;
|
||||
class CItem;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class Tesselator;
|
||||
|
||||
class FurnaceScreen: public BaseContainerScreen,
|
||||
public Touch::IInventoryPaneCallback
|
||||
{
|
||||
typedef BaseContainerScreen super;
|
||||
typedef std::vector<CItem*> ItemList;
|
||||
public:
|
||||
FurnaceScreen(Player* player, FurnaceTileEntity* furnace);
|
||||
~FurnaceScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
bool renderGameBehind();
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
// IInventoryPaneCallback
|
||||
bool addItem(const Touch::InventoryPane* pane, int itemId);
|
||||
bool isAllowed( int slot );
|
||||
std::vector<const ItemInstance*> getItems( const Touch::InventoryPane* forPane );
|
||||
private:
|
||||
//void addItem(Recipe* recipe);
|
||||
void recheckRecipes();
|
||||
|
||||
void clearItems();
|
||||
void updateResult(const ItemInstance* item);
|
||||
void setupInventoryPane();
|
||||
void updateItems();
|
||||
|
||||
void drawSlotItemAt(Tesselator& t, const ItemInstance* item, int x, int y, bool selected);
|
||||
ItemInstance moveOver(const ItemInstance* item, int maxCount);
|
||||
void takeAndClearSlot( int slot );
|
||||
bool handleAddItem( int slot, const ItemInstance* item );
|
||||
void handleRenderPane(Touch::InventoryPane* pane, Tesselator& t, int xm, int ym, float a);
|
||||
bool canMoveToFurnace(int inventorySlot, const ItemInstance* item);
|
||||
ItemList _items;
|
||||
|
||||
std::string currentItemDesc;
|
||||
ItemInstance burnResult;
|
||||
float descWidth;
|
||||
ImageButton btnClose;
|
||||
BlankButton btnIngredient;
|
||||
BlankButton btnFuel;
|
||||
BlankButton btnResult;
|
||||
Touch::THeader bHeader;
|
||||
|
||||
Touch::InventoryPane* inventoryPane;
|
||||
IntRectangle inventoryPaneRect;
|
||||
|
||||
ItemList listFuel;
|
||||
ItemList listIngredient;
|
||||
std::vector<int> inventorySlots;
|
||||
std::vector<const ItemInstance*> inventoryItems;
|
||||
bool doRecreatePane;
|
||||
|
||||
int selectedSlot;
|
||||
int lastBurnTypeId;
|
||||
|
||||
// GUI elements such as 9-Patches
|
||||
NinePatchLayer* guiBackground;
|
||||
NinePatchLayer* guiSlot;
|
||||
NinePatchLayer* guiSlotMarked;
|
||||
NinePatchLayer* guiSlotMarker;
|
||||
NinePatchLayer* guiPaneFrame;
|
||||
Player* player;
|
||||
FurnaceTileEntity* furnace;
|
||||
};
|
||||
|
||||
#endif /*_FURNACESCREEN_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "BaseContainerScreen.h"
|
||||
|
||||
#include "../components/InventoryPane.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class Font;
|
||||
class CItem;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
class Tesselator;
|
||||
|
||||
class FurnaceScreen: public BaseContainerScreen,
|
||||
public Touch::IInventoryPaneCallback
|
||||
{
|
||||
typedef BaseContainerScreen super;
|
||||
typedef std::vector<CItem*> ItemList;
|
||||
public:
|
||||
FurnaceScreen(Player* player, FurnaceTileEntity* furnace);
|
||||
~FurnaceScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
bool renderGameBehind();
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
// IInventoryPaneCallback
|
||||
bool addItem(const Touch::InventoryPane* pane, int itemId);
|
||||
bool isAllowed( int slot );
|
||||
std::vector<const ItemInstance*> getItems( const Touch::InventoryPane* forPane );
|
||||
private:
|
||||
//void addItem(Recipe* recipe);
|
||||
void recheckRecipes();
|
||||
|
||||
void clearItems();
|
||||
void updateResult(const ItemInstance* item);
|
||||
void setupInventoryPane();
|
||||
void updateItems();
|
||||
|
||||
void drawSlotItemAt(Tesselator& t, const ItemInstance* item, int x, int y, bool selected);
|
||||
ItemInstance moveOver(const ItemInstance* item, int maxCount);
|
||||
void takeAndClearSlot( int slot );
|
||||
bool handleAddItem( int slot, const ItemInstance* item );
|
||||
void handleRenderPane(Touch::InventoryPane* pane, Tesselator& t, int xm, int ym, float a);
|
||||
bool canMoveToFurnace(int inventorySlot, const ItemInstance* item);
|
||||
ItemList _items;
|
||||
|
||||
std::string currentItemDesc;
|
||||
ItemInstance burnResult;
|
||||
float descWidth;
|
||||
ImageButton btnClose;
|
||||
BlankButton btnIngredient;
|
||||
BlankButton btnFuel;
|
||||
BlankButton btnResult;
|
||||
Touch::THeader bHeader;
|
||||
|
||||
Touch::InventoryPane* inventoryPane;
|
||||
IntRectangle inventoryPaneRect;
|
||||
|
||||
ItemList listFuel;
|
||||
ItemList listIngredient;
|
||||
std::vector<int> inventorySlots;
|
||||
std::vector<const ItemInstance*> inventoryItems;
|
||||
bool doRecreatePane;
|
||||
|
||||
int selectedSlot;
|
||||
int lastBurnTypeId;
|
||||
|
||||
// GUI elements such as 9-Patches
|
||||
NinePatchLayer* guiBackground;
|
||||
NinePatchLayer* guiSlot;
|
||||
NinePatchLayer* guiSlotMarked;
|
||||
NinePatchLayer* guiSlotMarker;
|
||||
NinePatchLayer* guiPaneFrame;
|
||||
Player* player;
|
||||
FurnaceTileEntity* furnace;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__InBedScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__InBedScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
class Button;
|
||||
|
||||
class InBedScreen: public Screen
|
||||
{
|
||||
public:
|
||||
InBedScreen();
|
||||
|
||||
virtual ~InBedScreen();
|
||||
|
||||
void init();
|
||||
|
||||
void setupPositions();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
private:
|
||||
Button* bWakeUp;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__InBedScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
class Button;
|
||||
|
||||
class InBedScreen: public Screen
|
||||
{
|
||||
public:
|
||||
InBedScreen();
|
||||
|
||||
virtual ~InBedScreen();
|
||||
|
||||
void init();
|
||||
|
||||
void setupPositions();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
private:
|
||||
Button* bWakeUp;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,59 +1,57 @@
|
||||
#ifndef _MINECRAFT_INGAMEBLOCKSELECTIONSCREEN_H_
|
||||
#define _MINECRAFT_INGAMEBLOCKSELECTIONSCREEN_H_
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../../player/input/touchscreen/TouchAreaModel.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class IngameBlockSelectionScreen : public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
IngameBlockSelectionScreen();
|
||||
virtual ~IngameBlockSelectionScreen() {}
|
||||
|
||||
virtual void init() override;
|
||||
virtual void removed() override;
|
||||
|
||||
void render(int xm, int ym, float a) override;
|
||||
|
||||
protected:
|
||||
virtual void mouseClicked(int x, int y, int buttonNum) override;
|
||||
virtual void mouseReleased(int x, int y, int buttonNum) override;
|
||||
|
||||
virtual void buttonClicked(Button* button) override;
|
||||
|
||||
// wheel input for creative inventory scrolling
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
|
||||
virtual void keyPressed(int eventKey) override;
|
||||
private:
|
||||
void renderSlots();
|
||||
void renderSlot(int slot, int x, int y, float a);
|
||||
void renderDemoOverlay();
|
||||
|
||||
int getSelectedSlot(int x, int y);
|
||||
void selectSlotAndClose();
|
||||
|
||||
//int getLinearSlotId(int x, int y);
|
||||
int getSlotPosX(int slotX);
|
||||
int getSlotPosY(int slotY);
|
||||
|
||||
int getSlotHeight();
|
||||
|
||||
bool isAllowed(int slot);
|
||||
|
||||
private:
|
||||
int InventoryCols;
|
||||
int InventoryRows;
|
||||
int InventorySize;
|
||||
|
||||
int selectedItem;
|
||||
bool _pendingQuit;
|
||||
|
||||
Button bArmor;
|
||||
|
||||
RectangleArea _area;
|
||||
};
|
||||
|
||||
#endif
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../../player/input/touchscreen/TouchAreaModel.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class IngameBlockSelectionScreen : public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
IngameBlockSelectionScreen();
|
||||
virtual ~IngameBlockSelectionScreen() {}
|
||||
|
||||
virtual void init() override;
|
||||
virtual void removed() override;
|
||||
|
||||
void render(int xm, int ym, float a) override;
|
||||
|
||||
protected:
|
||||
virtual void mouseClicked(int x, int y, int buttonNum) override;
|
||||
virtual void mouseReleased(int x, int y, int buttonNum) override;
|
||||
|
||||
virtual void buttonClicked(Button* button) override;
|
||||
|
||||
// wheel input for creative inventory scrolling
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
|
||||
virtual void keyPressed(int eventKey) override;
|
||||
private:
|
||||
void renderSlots();
|
||||
void renderSlot(int slot, int x, int y, float a);
|
||||
void renderDemoOverlay();
|
||||
|
||||
int getSelectedSlot(int x, int y);
|
||||
void selectSlotAndClose();
|
||||
|
||||
//int getLinearSlotId(int x, int y);
|
||||
int getSlotPosX(int slotX);
|
||||
int getSlotPosY(int slotY);
|
||||
|
||||
int getSlotHeight();
|
||||
|
||||
bool isAllowed(int slot);
|
||||
|
||||
private:
|
||||
int InventoryCols;
|
||||
int InventoryRows;
|
||||
int InventorySize;
|
||||
|
||||
int selectedItem;
|
||||
bool _pendingQuit;
|
||||
|
||||
Button bArmor;
|
||||
|
||||
RectangleArea _area;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,70 +1,68 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__JoinGameScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__JoinGameScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/ScrolledSelectionList.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../../network/RakNetInstance.h"
|
||||
|
||||
|
||||
class JoinGameScreen;
|
||||
|
||||
class AvailableGamesList : public ScrolledSelectionList
|
||||
{
|
||||
int selectedItem;
|
||||
ServerList copiedServerList;
|
||||
|
||||
friend class JoinGameScreen;
|
||||
|
||||
public:
|
||||
|
||||
AvailableGamesList(Minecraft* _minecraft, int _width, int _height)
|
||||
: ScrolledSelectionList(_minecraft, _width, _height, 24, _height - 30, 28)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual int getNumberOfItems() { return (int)copiedServerList.size(); }
|
||||
|
||||
virtual void selectItem(int item, bool doubleClick) { selectedItem = item; }
|
||||
virtual bool isSelectedItem(int item) { return item == selectedItem; }
|
||||
|
||||
virtual void renderBackground() {}
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t)
|
||||
{
|
||||
const PingedCompatibleServer& s = copiedServerList[i];
|
||||
unsigned int color = s.isSpecial? 0xff00b0 : 0xffffa0;
|
||||
drawString(minecraft->font, s.name.C_String(), x, y + 2, color);
|
||||
drawString(minecraft->font, s.address.ToString(false), x, y + 16, 0xffffa0);
|
||||
}
|
||||
};
|
||||
|
||||
class JoinGameScreen: public Screen
|
||||
{
|
||||
public:
|
||||
JoinGameScreen();
|
||||
virtual ~JoinGameScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
|
||||
virtual bool isIndexValid(int index);
|
||||
|
||||
virtual void tick();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
Button bJoin;
|
||||
Button bBack;
|
||||
AvailableGamesList* gamesList;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__JoinGameScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/ScrolledSelectionList.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../../network/RakNetInstance.h"
|
||||
|
||||
|
||||
class JoinGameScreen;
|
||||
|
||||
class AvailableGamesList : public ScrolledSelectionList
|
||||
{
|
||||
int selectedItem;
|
||||
ServerList copiedServerList;
|
||||
|
||||
friend class JoinGameScreen;
|
||||
|
||||
public:
|
||||
|
||||
AvailableGamesList(Minecraft* _minecraft, int _width, int _height)
|
||||
: ScrolledSelectionList(_minecraft, _width, _height, 24, _height - 30, 28)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual int getNumberOfItems() { return (int)copiedServerList.size(); }
|
||||
|
||||
virtual void selectItem(int item, bool doubleClick) { selectedItem = item; }
|
||||
virtual bool isSelectedItem(int item) { return item == selectedItem; }
|
||||
|
||||
virtual void renderBackground() {}
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t)
|
||||
{
|
||||
const PingedCompatibleServer& s = copiedServerList[i];
|
||||
unsigned int color = s.isSpecial? 0xff00b0 : 0xffffa0;
|
||||
drawString(minecraft->font, s.name.C_String(), x, y + 2, color);
|
||||
drawString(minecraft->font, s.address.ToString(false), x, y + 16, 0xffffa0);
|
||||
}
|
||||
};
|
||||
|
||||
class JoinGameScreen: public Screen
|
||||
{
|
||||
public:
|
||||
JoinGameScreen();
|
||||
virtual ~JoinGameScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
|
||||
virtual bool isIndexValid(int index);
|
||||
|
||||
virtual void tick();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
Button bJoin;
|
||||
Button bBack;
|
||||
AvailableGamesList* gamesList;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,49 +1,47 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__OptionsScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__OptionsScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/OptionsGroup.h"
|
||||
|
||||
class ImageButton;
|
||||
class OptionsPane;
|
||||
|
||||
class OptionsScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
|
||||
void init();
|
||||
void generateOptionScreens();
|
||||
|
||||
public:
|
||||
OptionsScreen();
|
||||
~OptionsScreen();
|
||||
|
||||
void setupPositions();
|
||||
void buttonClicked(Button* button);
|
||||
void render(int xm, int ym, float a);
|
||||
void removed();
|
||||
void selectCategory(int index);
|
||||
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void charPressed(char inputChar);
|
||||
|
||||
virtual void tick();
|
||||
|
||||
private:
|
||||
Touch::THeader* bHeader;
|
||||
ImageButton* btnClose;
|
||||
|
||||
Button* btnCredits; // <-- ADD THIS
|
||||
|
||||
std::vector<Touch::TButton*> categoryButtons;
|
||||
std::vector<OptionsGroup*> optionPanes;
|
||||
|
||||
OptionsGroup* currentOptionsGroup;
|
||||
|
||||
int selectedCategory;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__OptionsScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/OptionsGroup.h"
|
||||
|
||||
class ImageButton;
|
||||
class OptionsPane;
|
||||
|
||||
class OptionsScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
|
||||
void init();
|
||||
void generateOptionScreens();
|
||||
|
||||
public:
|
||||
OptionsScreen();
|
||||
~OptionsScreen();
|
||||
|
||||
void setupPositions();
|
||||
void buttonClicked(Button* button);
|
||||
void render(int xm, int ym, float a);
|
||||
void removed();
|
||||
void selectCategory(int index);
|
||||
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void charPressed(char inputChar);
|
||||
|
||||
virtual void tick();
|
||||
|
||||
private:
|
||||
Touch::THeader* bHeader;
|
||||
ImageButton* btnClose;
|
||||
|
||||
Button* btnCredits; // <-- ADD THIS
|
||||
|
||||
std::vector<Touch::TButton*> categoryButtons;
|
||||
std::vector<OptionsGroup*> optionPanes;
|
||||
|
||||
OptionsGroup* currentOptionsGroup;
|
||||
|
||||
int selectedCategory;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,45 +1,43 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI__PauseScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI__PauseScreen_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/ImageButton.h"
|
||||
|
||||
class Button;
|
||||
|
||||
class PauseScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
PauseScreen(bool wasBackPaused);
|
||||
~PauseScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
protected:
|
||||
void buttonClicked(Button* button);
|
||||
private:
|
||||
void updateServerVisibilityText();
|
||||
|
||||
int saveStep;
|
||||
int visibleTime;
|
||||
bool wasBackPaused;
|
||||
|
||||
Button* bContinue;
|
||||
Button* bQuit;
|
||||
Button* bQuitAndSaveLocally;
|
||||
Button* bServerVisibility;
|
||||
Button* bOptions;
|
||||
|
||||
// Button* bThirdPerson;
|
||||
|
||||
// OptionButton bSound;
|
||||
OptionButton bThirdPerson;
|
||||
OptionButton bHideGui;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI__PauseScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/ImageButton.h"
|
||||
|
||||
class Button;
|
||||
|
||||
class PauseScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
PauseScreen(bool wasBackPaused);
|
||||
~PauseScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
protected:
|
||||
void buttonClicked(Button* button);
|
||||
private:
|
||||
void updateServerVisibilityText();
|
||||
|
||||
int saveStep;
|
||||
int visibleTime;
|
||||
bool wasBackPaused;
|
||||
|
||||
Button* bContinue;
|
||||
Button* bQuit;
|
||||
Button* bQuitAndSaveLocally;
|
||||
Button* bServerVisibility;
|
||||
Button* bOptions;
|
||||
|
||||
// Button* bThirdPerson;
|
||||
|
||||
// OptionButton bSound;
|
||||
OptionButton bThirdPerson;
|
||||
OptionButton bHideGui;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,162 +1,160 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__PrerenderTilesScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__PrerenderTilesScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
|
||||
#include "../../renderer/GameRenderer.h"
|
||||
#include "../../renderer/entity/ItemRenderer.h"
|
||||
#include "../../../world/item/ItemInstance.h"
|
||||
#include "../../../world/level/tile/Tile.h"
|
||||
|
||||
#include "../../../world/entity/player/Inventory.h"
|
||||
#include "../../renderer/Tesselator.h"
|
||||
#include "../../../world/item/crafting/Recipes.h"
|
||||
#include "../../../world/item/crafting/FurnaceRecipes.h"
|
||||
#include "../../../world/level/tile/LeafTile.h"
|
||||
#include "../../renderer/TileRenderer.h"
|
||||
|
||||
class PrerenderTilesScreen: public Screen
|
||||
{
|
||||
public:
|
||||
void init() {
|
||||
Player p(minecraft->level, true);
|
||||
Inventory _inventory(&p, true);
|
||||
Inventory* inventory = &_inventory;
|
||||
|
||||
// Copy over the inventory items
|
||||
for (int i = Inventory::MAX_SELECTION_SIZE; i < inventory->getContainerSize(); ++i)
|
||||
addItem(inventory->getItem(i));
|
||||
|
||||
// Fill the inventory with all the recipe items we don't already have: furnace
|
||||
const FurnaceRecipes::Map& furnaceRecipes = FurnaceRecipes::getInstance()->getRecipes();
|
||||
for (FurnaceRecipes::Map::const_iterator cit = furnaceRecipes.begin(); cit != furnaceRecipes.end(); ++cit) {
|
||||
ItemInstance ingredient(cit->first, 1, 0);
|
||||
addItem(&ingredient);
|
||||
ItemInstance result = cit->second;
|
||||
addItem(&result);
|
||||
}
|
||||
|
||||
// Fill the inventory with all the recipe items we don't already have: crafting
|
||||
const RecipeList& recipes = Recipes::getInstance()->getRecipes();
|
||||
for (unsigned int i = 0; i < recipes.size(); ++i) {
|
||||
|
||||
std::vector<ItemInstance> items;
|
||||
std::vector<ItemInstance> required = recipes[i]->getItemPack().getItemInstances();
|
||||
items.push_back(recipes[i]->getResultItem());
|
||||
items.insert(items.end(), required.begin(), required.end());
|
||||
|
||||
for (unsigned int i = 0; i < items.size(); ++i) {
|
||||
ItemInstance& item = items[i];
|
||||
addItem(&item);
|
||||
}
|
||||
}
|
||||
|
||||
// Manually added stuff
|
||||
// Example: the one that's spawned from tiles when destroyed
|
||||
int items[] = {
|
||||
Tile::sapling->id, LeafTile::BIRCH_LEAF,
|
||||
Tile::sapling->id, LeafTile::EVERGREEN_LEAF,
|
||||
Tile::sapling->id, LeafTile::NORMAL_LEAF,
|
||||
Tile::dirt->id, 0,
|
||||
Tile::reeds->id, 0,
|
||||
Tile::gravel->id, 0,
|
||||
Item::apple->id, 0,
|
||||
Tile::grass_carried->id, 0,
|
||||
Tile::web->id, 0,
|
||||
Item::sign->id, 0,
|
||||
};
|
||||
for (int i = 0; i < sizeof(items)/sizeof(int); i += 2) {
|
||||
ItemInstance item(items[i], 1, items[i+1]);
|
||||
addItem(&item);
|
||||
}
|
||||
}
|
||||
|
||||
void render( int xm, int ym, float a ) {
|
||||
static Stopwatch w;
|
||||
w.start();
|
||||
|
||||
glDisable2(GL_DEPTH_TEST);
|
||||
fill(0, 0, width, height, 0xffff00ff);
|
||||
//fill(0, 0, width, height, 0xff333333);
|
||||
glColor4f2(1, 1, 1, 1);
|
||||
glEnable2(GL_BLEND);
|
||||
|
||||
LOGI("--------------------\n");
|
||||
/*int j = 0;
|
||||
for (int i = Inventory::MAX_SELECTION_SIZE; i < inventory->getContainerSize(); ++i) {
|
||||
|
||||
ItemInstance* item = inventory->getItem(i);
|
||||
if (!item) continue;
|
||||
|
||||
//LOGI("desc: %d - %s. %d\n", i, item->toString().c_str());
|
||||
|
||||
int x = j%16 * 16;
|
||||
int y = j/16 * 16;
|
||||
|
||||
//Tesselator::instance.color(0xffffffff);
|
||||
//minecraft->textures->loadAndBindTexture("gui/gui2.png");
|
||||
//glColor4f2(0.2f, 0.5f, 0.2f, 1);
|
||||
//blit(x, y, 4 + 20 * (i%9), 4, 16, 16, 15, 15);
|
||||
//glColor4f2(1, 1, 1, 1);
|
||||
|
||||
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
||||
LOGI("0, %d, %d, %d, 0\n", j, item->id, item->getAuxValue());
|
||||
ItemRenderer::renderGuiItemCorrect(minecraft->font, minecraft->textures, item, x, y);
|
||||
} else if (item->getIcon() >= 0) {
|
||||
LOGI("1, %d, %d, %d, %d\n", j, item->id, item->getAuxValue(), item->getIcon());
|
||||
}
|
||||
++j;
|
||||
}*/
|
||||
int j = 0;
|
||||
for(std::vector<ItemInstance>::iterator i = mItems.begin(); i != mItems.end(); ++i) {
|
||||
ItemInstance* item = &(*i);
|
||||
|
||||
//LOGI("desc: %d - %s. %d\n", i, item->toString().c_str());
|
||||
|
||||
int x = j%16 * 16;
|
||||
int y = j/16 * 16;
|
||||
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
||||
LOGI("0, %d, %d, %d, 0\n", j, item->id, item->getAuxValue());
|
||||
ItemRenderer::renderGuiItemCorrect(minecraft->font, minecraft->textures, item, x, y);
|
||||
} else if (item->getIcon() >= 0) {
|
||||
LOGI("1, %d, %d, %d, %d\n", j, item->id, item->getAuxValue(), item->getIcon());
|
||||
}
|
||||
j++;
|
||||
}
|
||||
//@todo: blit out something famous here
|
||||
|
||||
//glRotatef2(-180, 1, 0, 0);
|
||||
glEnable2(GL_DEPTH_TEST);
|
||||
glDisable2(GL_BLEND);
|
||||
|
||||
w.stop();
|
||||
w.printEvery(100, "render-blocksel");
|
||||
}
|
||||
void removed(){}
|
||||
|
||||
void addItem(ItemInstance* item) {
|
||||
if(item == NULL)
|
||||
return;
|
||||
if (item->getAuxValue() < 0) return;
|
||||
|
||||
bool found = false;
|
||||
for(std::vector<ItemInstance>::iterator i = mItems.begin(); i != mItems.end(); ++i) {
|
||||
ItemInstance *jitem = &*i;
|
||||
if(jitem->id != item->id) continue;
|
||||
if(jitem->isStackedByData() && jitem->getAuxValue() != item->getAuxValue()) continue;
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
LOGI("Adding item: %s\n", item->getDescriptionId().c_str());
|
||||
mItems.push_back(*item);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<ItemInstance> mItems;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__PrerenderTilesScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
|
||||
#include "../../renderer/GameRenderer.h"
|
||||
#include "../../renderer/entity/ItemRenderer.h"
|
||||
#include "../../../world/item/ItemInstance.h"
|
||||
#include "../../../world/level/tile/Tile.h"
|
||||
|
||||
#include "../../../world/entity/player/Inventory.h"
|
||||
#include "../../renderer/Tesselator.h"
|
||||
#include "../../../world/item/crafting/Recipes.h"
|
||||
#include "../../../world/item/crafting/FurnaceRecipes.h"
|
||||
#include "../../../world/level/tile/LeafTile.h"
|
||||
#include "../../renderer/TileRenderer.h"
|
||||
|
||||
class PrerenderTilesScreen: public Screen
|
||||
{
|
||||
public:
|
||||
void init() {
|
||||
Player p(minecraft->level, true);
|
||||
Inventory _inventory(&p, true);
|
||||
Inventory* inventory = &_inventory;
|
||||
|
||||
// Copy over the inventory items
|
||||
for (int i = Inventory::MAX_SELECTION_SIZE; i < inventory->getContainerSize(); ++i)
|
||||
addItem(inventory->getItem(i));
|
||||
|
||||
// Fill the inventory with all the recipe items we don't already have: furnace
|
||||
const FurnaceRecipes::Map& furnaceRecipes = FurnaceRecipes::getInstance()->getRecipes();
|
||||
for (FurnaceRecipes::Map::const_iterator cit = furnaceRecipes.begin(); cit != furnaceRecipes.end(); ++cit) {
|
||||
ItemInstance ingredient(cit->first, 1, 0);
|
||||
addItem(&ingredient);
|
||||
ItemInstance result = cit->second;
|
||||
addItem(&result);
|
||||
}
|
||||
|
||||
// Fill the inventory with all the recipe items we don't already have: crafting
|
||||
const RecipeList& recipes = Recipes::getInstance()->getRecipes();
|
||||
for (unsigned int i = 0; i < recipes.size(); ++i) {
|
||||
|
||||
std::vector<ItemInstance> items;
|
||||
std::vector<ItemInstance> required = recipes[i]->getItemPack().getItemInstances();
|
||||
items.push_back(recipes[i]->getResultItem());
|
||||
items.insert(items.end(), required.begin(), required.end());
|
||||
|
||||
for (unsigned int i = 0; i < items.size(); ++i) {
|
||||
ItemInstance& item = items[i];
|
||||
addItem(&item);
|
||||
}
|
||||
}
|
||||
|
||||
// Manually added stuff
|
||||
// Example: the one that's spawned from tiles when destroyed
|
||||
int items[] = {
|
||||
Tile::sapling->id, LeafTile::BIRCH_LEAF,
|
||||
Tile::sapling->id, LeafTile::EVERGREEN_LEAF,
|
||||
Tile::sapling->id, LeafTile::NORMAL_LEAF,
|
||||
Tile::dirt->id, 0,
|
||||
Tile::reeds->id, 0,
|
||||
Tile::gravel->id, 0,
|
||||
Item::apple->id, 0,
|
||||
Tile::grass_carried->id, 0,
|
||||
Tile::web->id, 0,
|
||||
Item::sign->id, 0,
|
||||
};
|
||||
for (int i = 0; i < sizeof(items)/sizeof(int); i += 2) {
|
||||
ItemInstance item(items[i], 1, items[i+1]);
|
||||
addItem(&item);
|
||||
}
|
||||
}
|
||||
|
||||
void render( int xm, int ym, float a ) {
|
||||
static Stopwatch w;
|
||||
w.start();
|
||||
|
||||
glDisable2(GL_DEPTH_TEST);
|
||||
fill(0, 0, width, height, 0xffff00ff);
|
||||
//fill(0, 0, width, height, 0xff333333);
|
||||
glColor4f2(1, 1, 1, 1);
|
||||
glEnable2(GL_BLEND);
|
||||
|
||||
LOGI("--------------------\n");
|
||||
/*int j = 0;
|
||||
for (int i = Inventory::MAX_SELECTION_SIZE; i < inventory->getContainerSize(); ++i) {
|
||||
|
||||
ItemInstance* item = inventory->getItem(i);
|
||||
if (!item) continue;
|
||||
|
||||
//LOGI("desc: %d - %s. %d\n", i, item->toString().c_str());
|
||||
|
||||
int x = j%16 * 16;
|
||||
int y = j/16 * 16;
|
||||
|
||||
//Tesselator::instance.color(0xffffffff);
|
||||
//minecraft->textures->loadAndBindTexture("gui/gui2.png");
|
||||
//glColor4f2(0.2f, 0.5f, 0.2f, 1);
|
||||
//blit(x, y, 4 + 20 * (i%9), 4, 16, 16, 15, 15);
|
||||
//glColor4f2(1, 1, 1, 1);
|
||||
|
||||
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
||||
LOGI("0, %d, %d, %d, 0\n", j, item->id, item->getAuxValue());
|
||||
ItemRenderer::renderGuiItemCorrect(minecraft->font, minecraft->textures, item, x, y);
|
||||
} else if (item->getIcon() >= 0) {
|
||||
LOGI("1, %d, %d, %d, %d\n", j, item->id, item->getAuxValue(), item->getIcon());
|
||||
}
|
||||
++j;
|
||||
}*/
|
||||
int j = 0;
|
||||
for(std::vector<ItemInstance>::iterator i = mItems.begin(); i != mItems.end(); ++i) {
|
||||
ItemInstance* item = &(*i);
|
||||
|
||||
//LOGI("desc: %d - %s. %d\n", i, item->toString().c_str());
|
||||
|
||||
int x = j%16 * 16;
|
||||
int y = j/16 * 16;
|
||||
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
||||
LOGI("0, %d, %d, %d, 0\n", j, item->id, item->getAuxValue());
|
||||
ItemRenderer::renderGuiItemCorrect(minecraft->font, minecraft->textures, item, x, y);
|
||||
} else if (item->getIcon() >= 0) {
|
||||
LOGI("1, %d, %d, %d, %d\n", j, item->id, item->getAuxValue(), item->getIcon());
|
||||
}
|
||||
j++;
|
||||
}
|
||||
//@todo: blit out something famous here
|
||||
|
||||
//glRotatef2(-180, 1, 0, 0);
|
||||
glEnable2(GL_DEPTH_TEST);
|
||||
glDisable2(GL_BLEND);
|
||||
|
||||
w.stop();
|
||||
w.printEvery(100, "render-blocksel");
|
||||
}
|
||||
void removed(){}
|
||||
|
||||
void addItem(ItemInstance* item) {
|
||||
if(item == NULL)
|
||||
return;
|
||||
if (item->getAuxValue() < 0) return;
|
||||
|
||||
bool found = false;
|
||||
for(std::vector<ItemInstance>::iterator i = mItems.begin(); i != mItems.end(); ++i) {
|
||||
ItemInstance *jitem = &*i;
|
||||
if(jitem->id != item->id) continue;
|
||||
if(jitem->isStackedByData() && jitem->getAuxValue() != item->getAuxValue()) continue;
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
LOGI("Adding item: %s\n", item->getDescriptionId().c_str());
|
||||
mItems.push_back(*item);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<ItemInstance> mItems;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ProgressScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ProgressScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
|
||||
class ProgressScreen: public Screen
|
||||
{
|
||||
public:
|
||||
ProgressScreen();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
bool isInGameScreen();
|
||||
|
||||
virtual void keyPressed(int eventKey) {}
|
||||
|
||||
void tick();
|
||||
private:
|
||||
int ticks;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ProgressScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
|
||||
class ProgressScreen: public Screen
|
||||
{
|
||||
public:
|
||||
ProgressScreen();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
bool isInGameScreen();
|
||||
|
||||
virtual void keyPressed(int eventKey) {}
|
||||
|
||||
void tick();
|
||||
private:
|
||||
int ticks;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ScreenChooser_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ScreenChooser_H__
|
||||
|
||||
enum ScreenId {
|
||||
SCREEN_NONE,
|
||||
SCREEN_STARTMENU,
|
||||
SCREEN_JOINGAME,
|
||||
SCREEN_PAUSE,
|
||||
SCREEN_PAUSEPREV,
|
||||
SCREEN_SELECTWORLD,
|
||||
SCREEN_BLOCKSELECTION,
|
||||
SCREEN_JOINBYIP,
|
||||
SCREEN_CONSOLE
|
||||
};
|
||||
|
||||
class Screen;
|
||||
class MinecraftClient;
|
||||
|
||||
class ScreenChooser
|
||||
{
|
||||
public:
|
||||
ScreenChooser(MinecraftClient& mc) : _mc(mc) {}
|
||||
|
||||
Screen* createScreen(ScreenId id);
|
||||
Screen* setScreen(ScreenId id);
|
||||
private:
|
||||
MinecraftClient& _mc;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ScreenChooser_H__*/
|
||||
#pragma once
|
||||
|
||||
enum ScreenId {
|
||||
SCREEN_NONE,
|
||||
SCREEN_STARTMENU,
|
||||
SCREEN_JOINGAME,
|
||||
SCREEN_PAUSE,
|
||||
SCREEN_PAUSEPREV,
|
||||
SCREEN_SELECTWORLD,
|
||||
SCREEN_BLOCKSELECTION,
|
||||
SCREEN_JOINBYIP,
|
||||
SCREEN_CONSOLE
|
||||
};
|
||||
|
||||
class Screen;
|
||||
class MinecraftClient;
|
||||
|
||||
class ScreenChooser
|
||||
{
|
||||
public:
|
||||
ScreenChooser(MinecraftClient& mc) : _mc(mc) {}
|
||||
|
||||
Screen* createScreen(ScreenId id);
|
||||
Screen* setScreen(ScreenId id);
|
||||
private:
|
||||
MinecraftClient& _mc;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,112 +1,110 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__SelectWorldScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__SelectWorldScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../TweenData.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/RolledSelectionListH.h"
|
||||
#include "../../../world/level/storage/LevelStorageSource.h"
|
||||
|
||||
|
||||
class SelectWorldScreen;
|
||||
class MinecraftClient;
|
||||
|
||||
//
|
||||
// Scrolling World selection list
|
||||
//
|
||||
class WorldSelectionList : public RolledSelectionListH
|
||||
{
|
||||
public:
|
||||
WorldSelectionList(MinecraftClient& _minecraft, int _width, int _height);
|
||||
virtual void tick();
|
||||
void stepLeft();
|
||||
void stepRight();
|
||||
|
||||
void commit();
|
||||
protected:
|
||||
virtual int getNumberOfItems();
|
||||
virtual void selectItem(int item, bool doubleClick);
|
||||
virtual bool isSelectedItem(int item);
|
||||
|
||||
virtual void renderBackground() {}
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t);
|
||||
virtual float getPos(float alpha);
|
||||
virtual void touched() { mode = 0; }
|
||||
virtual bool capXPosition();
|
||||
private:
|
||||
TweenData td;
|
||||
void tweenInited();
|
||||
|
||||
int selectedItem;
|
||||
int _height;
|
||||
LevelSummaryList levels;
|
||||
std::vector<StringVector> _descriptions;
|
||||
StringVector _imageNames;
|
||||
|
||||
bool hasPickedLevel;
|
||||
LevelSummary pickedLevel;
|
||||
|
||||
int stoppedTick;
|
||||
int currentTick;
|
||||
float accRatio;
|
||||
int mode;
|
||||
|
||||
friend class SelectWorldScreen;
|
||||
};
|
||||
|
||||
//
|
||||
// Delete World screen
|
||||
//
|
||||
#include "ConfirmScreen.h"
|
||||
class DeleteWorldScreen: public ConfirmScreen
|
||||
{
|
||||
public:
|
||||
DeleteWorldScreen(const LevelSummary& levelId);
|
||||
protected:
|
||||
virtual void postResult(bool isOk);
|
||||
private:
|
||||
LevelSummary _level;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Select world screen
|
||||
//
|
||||
class SelectWorldScreen: public Screen
|
||||
{
|
||||
public:
|
||||
SelectWorldScreen();
|
||||
virtual ~SelectWorldScreen();
|
||||
|
||||
virtual void init();
|
||||
virtual void setupPositions();
|
||||
virtual void tick();
|
||||
|
||||
virtual bool isIndexValid(int index);
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
virtual void buttonClicked(Button* button);
|
||||
virtual void keyPressed(int eventKey);
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
// mouse wheel scroll (new in desktop implementation)
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym);
|
||||
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
void loadLevelSource();
|
||||
std::string getUniqueLevelName(const std::string& level);
|
||||
|
||||
Button bDelete;
|
||||
Button bCreate;
|
||||
Button bBack;
|
||||
Button bWorldView;
|
||||
WorldSelectionList* worldsList;
|
||||
LevelSummaryList levels;
|
||||
|
||||
bool _mouseHasBeenUp;
|
||||
bool _hasStartedLevel;
|
||||
//LevelStorageSource* levels;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__SelectWorldScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../TweenData.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/RolledSelectionListH.h"
|
||||
#include "../../../world/level/storage/LevelStorageSource.h"
|
||||
|
||||
|
||||
class SelectWorldScreen;
|
||||
class MinecraftClient;
|
||||
|
||||
//
|
||||
// Scrolling World selection list
|
||||
//
|
||||
class WorldSelectionList : public RolledSelectionListH
|
||||
{
|
||||
public:
|
||||
WorldSelectionList(MinecraftClient& _minecraft, int _width, int _height);
|
||||
virtual void tick();
|
||||
void stepLeft();
|
||||
void stepRight();
|
||||
|
||||
void commit();
|
||||
protected:
|
||||
virtual int getNumberOfItems();
|
||||
virtual void selectItem(int item, bool doubleClick);
|
||||
virtual bool isSelectedItem(int item);
|
||||
|
||||
virtual void renderBackground() {}
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t);
|
||||
virtual float getPos(float alpha);
|
||||
virtual void touched() { mode = 0; }
|
||||
virtual bool capXPosition();
|
||||
private:
|
||||
TweenData td;
|
||||
void tweenInited();
|
||||
|
||||
int selectedItem;
|
||||
int _height;
|
||||
LevelSummaryList levels;
|
||||
std::vector<StringVector> _descriptions;
|
||||
StringVector _imageNames;
|
||||
|
||||
bool hasPickedLevel;
|
||||
LevelSummary pickedLevel;
|
||||
|
||||
int stoppedTick;
|
||||
int currentTick;
|
||||
float accRatio;
|
||||
int mode;
|
||||
|
||||
friend class SelectWorldScreen;
|
||||
};
|
||||
|
||||
//
|
||||
// Delete World screen
|
||||
//
|
||||
#include "ConfirmScreen.h"
|
||||
class DeleteWorldScreen: public ConfirmScreen
|
||||
{
|
||||
public:
|
||||
DeleteWorldScreen(const LevelSummary& levelId);
|
||||
protected:
|
||||
virtual void postResult(bool isOk);
|
||||
private:
|
||||
LevelSummary _level;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Select world screen
|
||||
//
|
||||
class SelectWorldScreen: public Screen
|
||||
{
|
||||
public:
|
||||
SelectWorldScreen();
|
||||
virtual ~SelectWorldScreen();
|
||||
|
||||
virtual void init();
|
||||
virtual void setupPositions();
|
||||
virtual void tick();
|
||||
|
||||
virtual bool isIndexValid(int index);
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
virtual void buttonClicked(Button* button);
|
||||
virtual void keyPressed(int eventKey);
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
// mouse wheel scroll (new in desktop implementation)
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym);
|
||||
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
void loadLevelSource();
|
||||
std::string getUniqueLevelName(const std::string& level);
|
||||
|
||||
Button bDelete;
|
||||
Button bCreate;
|
||||
Button bBack;
|
||||
Button bWorldView;
|
||||
WorldSelectionList* worldsList;
|
||||
LevelSummaryList levels;
|
||||
|
||||
bool _mouseHasBeenUp;
|
||||
bool _hasStartedLevel;
|
||||
//LevelStorageSource* levels;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,44 +1,42 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__DemoChooseLevelScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__DemoChooseLevelScreen_H__
|
||||
|
||||
#include "ChooseLevelScreen.h"
|
||||
#include "../components/TextBox.h"
|
||||
#include "../components/Button.h" // for Touch::THeader
|
||||
class Button;
|
||||
class ImageButton;
|
||||
|
||||
class SimpleChooseLevelScreen: public ChooseLevelScreen
|
||||
{
|
||||
public:
|
||||
SimpleChooseLevelScreen(const std::string& levelName);
|
||||
|
||||
virtual ~SimpleChooseLevelScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
void tick();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
bool handleBackEvent(bool isDown);
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
|
||||
private:
|
||||
Touch::THeader* bHeader;
|
||||
Button* bGamemode;
|
||||
Button* bCheats;
|
||||
ImageButton* bBack;
|
||||
Button* bCreate;
|
||||
bool hasChosen;
|
||||
|
||||
std::string levelName;
|
||||
int gamemode;
|
||||
bool cheatsEnabled;
|
||||
|
||||
TextBox tLevelName;
|
||||
TextBox tSeed;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__DemoChooseLevelScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "ChooseLevelScreen.h"
|
||||
#include "../components/TextBox.h"
|
||||
#include "../components/Button.h" // for Touch::THeader
|
||||
class Button;
|
||||
class ImageButton;
|
||||
|
||||
class SimpleChooseLevelScreen: public ChooseLevelScreen
|
||||
{
|
||||
public:
|
||||
SimpleChooseLevelScreen(const std::string& levelName);
|
||||
|
||||
virtual ~SimpleChooseLevelScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
void tick();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
bool handleBackEvent(bool isDown);
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
|
||||
private:
|
||||
Touch::THeader* bHeader;
|
||||
Button* bGamemode;
|
||||
Button* bCheats;
|
||||
ImageButton* bBack;
|
||||
Button* bCreate;
|
||||
bool hasChosen;
|
||||
|
||||
std::string levelName;
|
||||
int gamemode;
|
||||
bool cheatsEnabled;
|
||||
|
||||
TextBox tLevelName;
|
||||
TextBox tSeed;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,40 +1,38 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__StartMenuScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__StartMenuScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/ImageButton.h"
|
||||
|
||||
class StartMenuScreen: public Screen
|
||||
{
|
||||
public:
|
||||
StartMenuScreen();
|
||||
virtual ~StartMenuScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
bool handleBackEvent(bool isDown);
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
|
||||
Button bHost;
|
||||
Button bJoin;
|
||||
Button bOptions;
|
||||
ImageButton bQuit; // X button in top-right corner
|
||||
|
||||
std::string copyright;
|
||||
int copyrightPosX;
|
||||
|
||||
std::string version;
|
||||
int versionPosX;
|
||||
|
||||
std::string username;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__StartMenuScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/ImageButton.h"
|
||||
|
||||
class StartMenuScreen: public Screen
|
||||
{
|
||||
public:
|
||||
StartMenuScreen();
|
||||
virtual ~StartMenuScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
bool handleBackEvent(bool isDown);
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
|
||||
Button bHost;
|
||||
Button bJoin;
|
||||
Button bOptions;
|
||||
ImageButton bQuit; // X button in top-right corner
|
||||
|
||||
std::string copyright;
|
||||
int copyrightPosX;
|
||||
|
||||
std::string version;
|
||||
int versionPosX;
|
||||
|
||||
std::string username;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,35 +1,33 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__TextEditScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__TextEditScreen_H__
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include "../Screen.h"
|
||||
#include <string>
|
||||
#include "../components/ImageButton.h"
|
||||
class SignTileEntity;
|
||||
class Button;
|
||||
class TextEditScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
TextEditScreen(SignTileEntity* signEntity);
|
||||
~TextEditScreen();
|
||||
void init();
|
||||
void tick();
|
||||
bool handleBackEvent(bool isDown);
|
||||
void render(int xm, int ym, float a);
|
||||
virtual void lostFocus();
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void charPressed(char inputChar);
|
||||
void setupPositions();
|
||||
void buttonClicked(Button* button);
|
||||
protected:
|
||||
bool isShowingKeyboard;
|
||||
SignTileEntity* sign;
|
||||
int frame;
|
||||
int line;
|
||||
private:
|
||||
ImageButton btnClose;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__TextEditScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
//package net.minecraft.client.gui;
|
||||
|
||||
#include "../Screen.h"
|
||||
#include <string>
|
||||
#include "../components/ImageButton.h"
|
||||
class SignTileEntity;
|
||||
class Button;
|
||||
class TextEditScreen: public Screen
|
||||
{
|
||||
typedef Screen super;
|
||||
public:
|
||||
TextEditScreen(SignTileEntity* signEntity);
|
||||
~TextEditScreen();
|
||||
void init();
|
||||
void tick();
|
||||
bool handleBackEvent(bool isDown);
|
||||
void render(int xm, int ym, float a);
|
||||
virtual void lostFocus();
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void charPressed(char inputChar);
|
||||
void setupPositions();
|
||||
void buttonClicked(Button* button);
|
||||
protected:
|
||||
bool isShowingKeyboard;
|
||||
SignTileEntity* sign;
|
||||
int frame;
|
||||
int line;
|
||||
private:
|
||||
ImageButton btnClose;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,36 +1,34 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__
|
||||
|
||||
#include "Screen.h"
|
||||
|
||||
class UploadPhotoScreen : public Screen
|
||||
{
|
||||
public:
|
||||
|
||||
UploadPhotoScreen();
|
||||
virtual ~UploadPhotoScreen() {}
|
||||
|
||||
virtual void init();
|
||||
|
||||
void render(int xm, int ym, float a) {
|
||||
Screen::render(xm, ym, a);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
virtual void keyPressed(int eventKey);
|
||||
|
||||
private:
|
||||
|
||||
int selectedItem;
|
||||
|
||||
void renderSlots();
|
||||
void renderSlot(int slot, int x, int y, float a);
|
||||
|
||||
int getSelectedSlot(int x, int y);
|
||||
void selectSlotAndClose();
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
|
||||
class UploadPhotoScreen : public Screen
|
||||
{
|
||||
public:
|
||||
|
||||
UploadPhotoScreen();
|
||||
virtual ~UploadPhotoScreen() {}
|
||||
|
||||
virtual void init();
|
||||
|
||||
void render(int xm, int ym, float a) {
|
||||
Screen::render(xm, ym, a);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
virtual void keyPressed(int eventKey);
|
||||
|
||||
private:
|
||||
|
||||
int selectedItem;
|
||||
|
||||
void renderSlots();
|
||||
void renderSlot(int slot, int x, int y, float a);
|
||||
|
||||
int getSelectedSlot(int x, int y);
|
||||
void selectSlotAndClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__UsernameScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__UsernameScreen_H__
|
||||
#pragma once
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
@@ -34,4 +33,3 @@ private:
|
||||
int _cursorBlink;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__UsernameScreen_H__*/
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_CraftingFilters_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_CraftingFilters_H__
|
||||
|
||||
class ItemInstance;
|
||||
|
||||
namespace CraftingFilters {
|
||||
bool isStonecutterItem(const ItemInstance& item);
|
||||
}
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_CraftingFilters_H__*/
|
||||
#pragma once
|
||||
|
||||
class ItemInstance;
|
||||
|
||||
namespace CraftingFilters {
|
||||
bool isStonecutterItem(const ItemInstance& item);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,106 +1,104 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_PaneCraftingScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_PaneCraftingScreen_H__
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../../../world/item/crafting/Recipes.h"
|
||||
#include "../../../../world/item/ItemInstance.h"
|
||||
|
||||
#include "../../components/ScrollingPane.h"
|
||||
#include "../../components/ImageButton.h"
|
||||
#include "../../components/ItemPane.h"
|
||||
|
||||
class Font;
|
||||
class CItem;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
|
||||
class CraftButton: public ImageButton
|
||||
{
|
||||
typedef ImageButton super;
|
||||
public:
|
||||
CraftButton(int id);
|
||||
~CraftButton();
|
||||
|
||||
void init(Textures*);
|
||||
void setSize(float w, float h);
|
||||
|
||||
void setNumItems(int i) { numItems = i; }
|
||||
IntRectangle getItemPos(int i);
|
||||
void renderBg(Minecraft* minecraft, int xm, int ym);
|
||||
private:
|
||||
NinePatchLayer* bg;
|
||||
NinePatchLayer* bgSelected;
|
||||
int numItems;
|
||||
};
|
||||
|
||||
class PaneCraftingScreen: public Screen,
|
||||
public IItemPaneCallback
|
||||
{
|
||||
typedef Screen super;
|
||||
typedef std::vector<CItem*> ItemList;
|
||||
public:
|
||||
PaneCraftingScreen(int craftingSize);
|
||||
~PaneCraftingScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
bool renderGameBehind();
|
||||
bool closeOnPlayerHurt();
|
||||
void buttonClicked(Button* button);
|
||||
void keyPressed( int eventKey );
|
||||
|
||||
// IItemPaneCallback
|
||||
void onItemSelected(const ItemPane* forPane, int itemIndexInCurrentCategory);
|
||||
const std::vector<CItem*>& getItems(const ItemPane* forPane);
|
||||
protected:
|
||||
void setSingleCategoryAndIcon(int categoryBitmask, int categoryIcon);
|
||||
private:
|
||||
/// Filter out non craftable recipes.
|
||||
/// The default implementation calls bool filterRecipe(r) for every
|
||||
/// Recipe r and keeps the ones that returned true.
|
||||
/// A crafting size filter has already been applied.
|
||||
virtual void filterRecipes(RecipeList& recipes);
|
||||
virtual bool filterRecipe(const Recipe& recipe) = 0;
|
||||
|
||||
void initCategories();
|
||||
|
||||
void addItem(Recipe* recipe);
|
||||
void recheckRecipes();
|
||||
void onItemSelected(int buttonIndex, CItem* item);
|
||||
void clearCategoryItems();
|
||||
|
||||
void craftSelectedItem();
|
||||
std::vector<ImageButton*> _categoryButtons;
|
||||
|
||||
ItemList _items;
|
||||
std::vector<ItemList> _categories;
|
||||
|
||||
int currentCategory;
|
||||
CItem* currentItem;
|
||||
std::string currentItemDesc;
|
||||
std::vector<Button*> currentCategoryButtons;
|
||||
ImageButton btnClose;
|
||||
CraftButton btnCraft;
|
||||
|
||||
int craftingSize;
|
||||
|
||||
ItemPane* pane;
|
||||
IntRectangle paneRect;
|
||||
//int paneX;
|
||||
//int paneW;
|
||||
|
||||
int numCategories;
|
||||
std::vector<int> categoryBitmasks;
|
||||
std::vector<int> categoryIcons;
|
||||
ImageButton* selectedCategoryButton;
|
||||
|
||||
// GUI elements such as 9-Patches
|
||||
NinePatchLayer* guiBackground;
|
||||
NinePatchLayer* guiSlotCategory;
|
||||
NinePatchLayer* guiSlotCategorySelected;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_PaneCraftingScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../../../world/item/crafting/Recipes.h"
|
||||
#include "../../../../world/item/ItemInstance.h"
|
||||
|
||||
#include "../../components/ScrollingPane.h"
|
||||
#include "../../components/ImageButton.h"
|
||||
#include "../../components/ItemPane.h"
|
||||
|
||||
class Font;
|
||||
class CItem;
|
||||
class Textures;
|
||||
class NinePatchLayer;
|
||||
|
||||
class CraftButton: public ImageButton
|
||||
{
|
||||
typedef ImageButton super;
|
||||
public:
|
||||
CraftButton(int id);
|
||||
~CraftButton();
|
||||
|
||||
void init(Textures*);
|
||||
void setSize(float w, float h);
|
||||
|
||||
void setNumItems(int i) { numItems = i; }
|
||||
IntRectangle getItemPos(int i);
|
||||
void renderBg(Minecraft* minecraft, int xm, int ym);
|
||||
private:
|
||||
NinePatchLayer* bg;
|
||||
NinePatchLayer* bgSelected;
|
||||
int numItems;
|
||||
};
|
||||
|
||||
class PaneCraftingScreen: public Screen,
|
||||
public IItemPaneCallback
|
||||
{
|
||||
typedef Screen super;
|
||||
typedef std::vector<CItem*> ItemList;
|
||||
public:
|
||||
PaneCraftingScreen(int craftingSize);
|
||||
~PaneCraftingScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
bool renderGameBehind();
|
||||
bool closeOnPlayerHurt();
|
||||
void buttonClicked(Button* button);
|
||||
void keyPressed( int eventKey );
|
||||
|
||||
// IItemPaneCallback
|
||||
void onItemSelected(const ItemPane* forPane, int itemIndexInCurrentCategory);
|
||||
const std::vector<CItem*>& getItems(const ItemPane* forPane);
|
||||
protected:
|
||||
void setSingleCategoryAndIcon(int categoryBitmask, int categoryIcon);
|
||||
private:
|
||||
/// Filter out non craftable recipes.
|
||||
/// The default implementation calls bool filterRecipe(r) for every
|
||||
/// Recipe r and keeps the ones that returned true.
|
||||
/// A crafting size filter has already been applied.
|
||||
virtual void filterRecipes(RecipeList& recipes);
|
||||
virtual bool filterRecipe(const Recipe& recipe) = 0;
|
||||
|
||||
void initCategories();
|
||||
|
||||
void addItem(Recipe* recipe);
|
||||
void recheckRecipes();
|
||||
void onItemSelected(int buttonIndex, CItem* item);
|
||||
void clearCategoryItems();
|
||||
|
||||
void craftSelectedItem();
|
||||
std::vector<ImageButton*> _categoryButtons;
|
||||
|
||||
ItemList _items;
|
||||
std::vector<ItemList> _categories;
|
||||
|
||||
int currentCategory;
|
||||
CItem* currentItem;
|
||||
std::string currentItemDesc;
|
||||
std::vector<Button*> currentCategoryButtons;
|
||||
ImageButton btnClose;
|
||||
CraftButton btnCraft;
|
||||
|
||||
int craftingSize;
|
||||
|
||||
ItemPane* pane;
|
||||
IntRectangle paneRect;
|
||||
//int paneX;
|
||||
//int paneW;
|
||||
|
||||
int numCategories;
|
||||
std::vector<int> categoryBitmasks;
|
||||
std::vector<int> categoryIcons;
|
||||
ImageButton* selectedCategoryButton;
|
||||
|
||||
// GUI elements such as 9-Patches
|
||||
NinePatchLayer* guiBackground;
|
||||
NinePatchLayer* guiSlotCategory;
|
||||
NinePatchLayer* guiSlotCategorySelected;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_StonecutterScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_StonecutterScreen_H__
|
||||
|
||||
#include "PaneCraftingScreen.h"
|
||||
|
||||
class StonecutterScreen: public PaneCraftingScreen
|
||||
{
|
||||
typedef PaneCraftingScreen super;
|
||||
public:
|
||||
StonecutterScreen();
|
||||
~StonecutterScreen();
|
||||
|
||||
private:
|
||||
bool filterRecipe(const Recipe& r);
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_StonecutterScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "PaneCraftingScreen.h"
|
||||
|
||||
class StonecutterScreen: public PaneCraftingScreen
|
||||
{
|
||||
typedef PaneCraftingScreen super;
|
||||
public:
|
||||
StonecutterScreen();
|
||||
~StonecutterScreen();
|
||||
|
||||
private:
|
||||
bool filterRecipe(const Recipe& r);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_WorkbenchScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_WorkbenchScreen_H__
|
||||
|
||||
#include "PaneCraftingScreen.h"
|
||||
|
||||
class WorkbenchScreen: public PaneCraftingScreen
|
||||
{
|
||||
typedef PaneCraftingScreen super;
|
||||
public:
|
||||
WorkbenchScreen(int craftingSize);
|
||||
~WorkbenchScreen();
|
||||
|
||||
private:
|
||||
bool filterRecipe(const Recipe& r);
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS_CRAFT_WorkbenchScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "PaneCraftingScreen.h"
|
||||
|
||||
class WorkbenchScreen: public PaneCraftingScreen
|
||||
{
|
||||
typedef PaneCraftingScreen super;
|
||||
public:
|
||||
WorkbenchScreen(int craftingSize);
|
||||
~WorkbenchScreen();
|
||||
|
||||
private:
|
||||
bool filterRecipe(const Recipe& r);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,73 +1,71 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchIngameBlockSelectionScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchIngameBlockSelectionScreen_H__
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../components/InventoryPane.h"
|
||||
#include "../../components/Button.h"
|
||||
#include "../../components/ScrollingPane.h"
|
||||
#include "../../components/ItemPane.h"
|
||||
#include "../../TweenData.h"
|
||||
#include "../../../player/input/touchscreen/TouchAreaModel.h"
|
||||
#include "../../../../AppPlatform.h"
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class IngameBlockSelectionScreen : public Screen,
|
||||
public IInventoryPaneCallback
|
||||
{
|
||||
typedef Screen super;
|
||||
|
||||
public:
|
||||
IngameBlockSelectionScreen();
|
||||
virtual ~IngameBlockSelectionScreen();
|
||||
|
||||
virtual void init() override;
|
||||
virtual void setupPositions() override;
|
||||
virtual void removed() override;
|
||||
|
||||
void tick() override;
|
||||
void render(int xm, int ym, float a) override;
|
||||
|
||||
bool hasClippingArea(IntRectangle& out) override;
|
||||
|
||||
// IInventoryPaneCallback
|
||||
bool addItem(const InventoryPane* pane, int itemId) override;
|
||||
bool isAllowed(int slot) override;
|
||||
std::vector<const ItemInstance*> getItems(const InventoryPane* forPane) override;
|
||||
|
||||
void buttonClicked(Button* button) override;
|
||||
protected:
|
||||
virtual void mouseClicked(int x, int y, int buttonNum) override;
|
||||
virtual void mouseReleased(int x, int y, int buttonNum) override;
|
||||
|
||||
// also support wheel scrolling
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
private:
|
||||
void renderDemoOverlay();
|
||||
|
||||
//int getLinearSlotId(int x, int y);
|
||||
int getSlotPosX(int slotX);
|
||||
int getSlotPosY(int slotY);
|
||||
int getSlotHeight();
|
||||
|
||||
private:
|
||||
int selectedItem;
|
||||
bool _pendingClose;
|
||||
InventoryPane* _blockList;
|
||||
|
||||
THeader bHeader;
|
||||
ImageButton bDone;
|
||||
TButton bCraft;
|
||||
TButton bArmor;
|
||||
TButton bMenu;
|
||||
|
||||
IntRectangle clippingArea;
|
||||
|
||||
int InventoryRows;
|
||||
int InventorySize;
|
||||
int InventoryColumns;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchIngameBlockSelectionScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../components/InventoryPane.h"
|
||||
#include "../../components/Button.h"
|
||||
#include "../../components/ScrollingPane.h"
|
||||
#include "../../components/ItemPane.h"
|
||||
#include "../../TweenData.h"
|
||||
#include "../../../player/input/touchscreen/TouchAreaModel.h"
|
||||
#include "../../../../AppPlatform.h"
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class IngameBlockSelectionScreen : public Screen,
|
||||
public IInventoryPaneCallback
|
||||
{
|
||||
typedef Screen super;
|
||||
|
||||
public:
|
||||
IngameBlockSelectionScreen();
|
||||
virtual ~IngameBlockSelectionScreen();
|
||||
|
||||
virtual void init() override;
|
||||
virtual void setupPositions() override;
|
||||
virtual void removed() override;
|
||||
|
||||
void tick() override;
|
||||
void render(int xm, int ym, float a) override;
|
||||
|
||||
bool hasClippingArea(IntRectangle& out) override;
|
||||
|
||||
// IInventoryPaneCallback
|
||||
bool addItem(const InventoryPane* pane, int itemId) override;
|
||||
bool isAllowed(int slot) override;
|
||||
std::vector<const ItemInstance*> getItems(const InventoryPane* forPane) override;
|
||||
|
||||
void buttonClicked(Button* button) override;
|
||||
protected:
|
||||
virtual void mouseClicked(int x, int y, int buttonNum) override;
|
||||
virtual void mouseReleased(int x, int y, int buttonNum) override;
|
||||
|
||||
// also support wheel scrolling
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
private:
|
||||
void renderDemoOverlay();
|
||||
|
||||
//int getLinearSlotId(int x, int y);
|
||||
int getSlotPosX(int slotX);
|
||||
int getSlotPosY(int slotY);
|
||||
int getSlotHeight();
|
||||
|
||||
private:
|
||||
int selectedItem;
|
||||
bool _pendingClose;
|
||||
InventoryPane* _blockList;
|
||||
|
||||
THeader bHeader;
|
||||
ImageButton bDone;
|
||||
TButton bCraft;
|
||||
TButton bArmor;
|
||||
TButton bMenu;
|
||||
|
||||
IntRectangle clippingArea;
|
||||
|
||||
int InventoryRows;
|
||||
int InventorySize;
|
||||
int InventoryColumns;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,74 +1,72 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchJoinGameScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchJoinGameScreen_H__
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../components/Button.h"
|
||||
#include "../../components/RolledSelectionListV.h"
|
||||
#include "../../../Minecraft.h"
|
||||
#include "../../../../platform/input/Multitouch.h"
|
||||
#include "../../../../network/RakNetInstance.h"
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class JoinGameScreen;
|
||||
|
||||
class AvailableGamesList : public RolledSelectionListV
|
||||
{
|
||||
int startSelected;
|
||||
int selectedItem;
|
||||
ServerList copiedServerList;
|
||||
|
||||
friend class JoinGameScreen;
|
||||
|
||||
public:
|
||||
AvailableGamesList(Minecraft* _minecraft, int _width, int _height)
|
||||
: RolledSelectionListV(_minecraft, _width, _height, 0, _width, 24, _height, 34),
|
||||
selectedItem(-1),
|
||||
startSelected(-1)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual int getNumberOfItems() { return (int)copiedServerList.size(); }
|
||||
|
||||
virtual void selectCancel();
|
||||
virtual void selectStart(int item);
|
||||
virtual void selectItem(int item, bool doubleClick);
|
||||
|
||||
virtual bool isSelectedItem(int item) { return item == selectedItem; }
|
||||
|
||||
virtual void renderBackground() {}
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t);
|
||||
};
|
||||
|
||||
class JoinGameScreen: public Screen
|
||||
{
|
||||
public:
|
||||
JoinGameScreen();
|
||||
virtual ~JoinGameScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
|
||||
virtual bool isIndexValid(int index);
|
||||
|
||||
virtual void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
Button bJoin;
|
||||
TButton bBack;
|
||||
TButton bJoinByIp;
|
||||
THeader bHeader;
|
||||
AvailableGamesList* gamesList;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchJoinGameScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../components/Button.h"
|
||||
#include "../../components/RolledSelectionListV.h"
|
||||
#include "../../../Minecraft.h"
|
||||
#include "../../../../platform/input/Multitouch.h"
|
||||
#include "../../../../network/RakNetInstance.h"
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class JoinGameScreen;
|
||||
|
||||
class AvailableGamesList : public RolledSelectionListV
|
||||
{
|
||||
int startSelected;
|
||||
int selectedItem;
|
||||
ServerList copiedServerList;
|
||||
|
||||
friend class JoinGameScreen;
|
||||
|
||||
public:
|
||||
AvailableGamesList(Minecraft* _minecraft, int _width, int _height)
|
||||
: RolledSelectionListV(_minecraft, _width, _height, 0, _width, 24, _height, 34),
|
||||
selectedItem(-1),
|
||||
startSelected(-1)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual int getNumberOfItems() { return (int)copiedServerList.size(); }
|
||||
|
||||
virtual void selectCancel();
|
||||
virtual void selectStart(int item);
|
||||
virtual void selectItem(int item, bool doubleClick);
|
||||
|
||||
virtual bool isSelectedItem(int item) { return item == selectedItem; }
|
||||
|
||||
virtual void renderBackground() {}
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t);
|
||||
};
|
||||
|
||||
class JoinGameScreen: public Screen
|
||||
{
|
||||
public:
|
||||
JoinGameScreen();
|
||||
virtual ~JoinGameScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
|
||||
virtual bool isIndexValid(int index);
|
||||
|
||||
virtual void tick();
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
Button bJoin;
|
||||
TButton bBack;
|
||||
TButton bJoinByIp;
|
||||
THeader bHeader;
|
||||
AvailableGamesList* gamesList;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,122 +1,120 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchSelectWorldScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchSelectWorldScreen_H__
|
||||
|
||||
#include "../ConfirmScreen.h"
|
||||
#include "../../Screen.h"
|
||||
#include "../../TweenData.h"
|
||||
#include "../../components/ImageButton.h"
|
||||
#include "../../components/Button.h"
|
||||
#include "../../components/RolledSelectionListH.h"
|
||||
#include "../../../Minecraft.h"
|
||||
#include "../../../../world/level/storage/LevelStorageSource.h"
|
||||
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class SelectWorldScreen;
|
||||
|
||||
//
|
||||
// Scrolling World selection list
|
||||
//
|
||||
class TouchWorldSelectionList : public RolledSelectionListH
|
||||
{
|
||||
public:
|
||||
TouchWorldSelectionList(Minecraft* _minecraft, int _width, int _height);
|
||||
virtual void tick();
|
||||
void stepLeft();
|
||||
void stepRight();
|
||||
|
||||
void commit();
|
||||
protected:
|
||||
virtual int getNumberOfItems();
|
||||
virtual void selectItem(int item, bool doubleClick);
|
||||
virtual bool isSelectedItem(int item);
|
||||
|
||||
virtual void renderBackground() {}
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t);
|
||||
virtual float getPos(float alpha);
|
||||
virtual void touched() { mode = 0; }
|
||||
virtual bool capXPosition();
|
||||
|
||||
virtual void selectStart(int item, int localX, int localY);
|
||||
virtual void selectCancel();
|
||||
private:
|
||||
TweenData td;
|
||||
void tweenInited();
|
||||
|
||||
int selectedItem;
|
||||
bool _newWorldSelected; // Is the PLUS button pressed?
|
||||
int _height;
|
||||
LevelSummaryList levels;
|
||||
std::vector<StringVector> _descriptions;
|
||||
StringVector _imageNames;
|
||||
|
||||
bool hasPickedLevel;
|
||||
LevelSummary pickedLevel;
|
||||
int pickedIndex;
|
||||
|
||||
int stoppedTick;
|
||||
int currentTick;
|
||||
float accRatio;
|
||||
int mode;
|
||||
|
||||
friend class SelectWorldScreen;
|
||||
};
|
||||
|
||||
//
|
||||
// Delete World screen
|
||||
//
|
||||
class TouchDeleteWorldScreen: public ConfirmScreen
|
||||
{
|
||||
public:
|
||||
TouchDeleteWorldScreen(const LevelSummary& levelId);
|
||||
protected:
|
||||
virtual void postResult(bool isOk);
|
||||
private:
|
||||
LevelSummary _level;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Select world screen
|
||||
//
|
||||
class SelectWorldScreen: public Screen
|
||||
{
|
||||
public:
|
||||
SelectWorldScreen();
|
||||
virtual ~SelectWorldScreen();
|
||||
|
||||
virtual void init() override;
|
||||
virtual void setupPositions() override;
|
||||
|
||||
virtual void tick() override;
|
||||
virtual void render(int xm, int ym, float a) override;
|
||||
|
||||
virtual bool isIndexValid(int index);
|
||||
virtual bool handleBackEvent(bool isDown) override;
|
||||
virtual void buttonClicked(Button* button) override;
|
||||
virtual void keyPressed(int eventKey) override;
|
||||
|
||||
// support for mouse wheel when desktop code uses touch variant
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
|
||||
bool isInGameScreen() override;
|
||||
private:
|
||||
void loadLevelSource();
|
||||
std::string getUniqueLevelName(const std::string& level);
|
||||
|
||||
ImageButton bDelete;
|
||||
TButton bCreate;
|
||||
THeader bHeader;
|
||||
TButton bBack;
|
||||
Button bWorldView;
|
||||
TouchWorldSelectionList* worldsList;
|
||||
LevelSummaryList levels;
|
||||
|
||||
bool _mouseHasBeenUp;
|
||||
bool _hasStartedLevel;
|
||||
//LevelStorageSource* levels;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchSelectWorldScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../ConfirmScreen.h"
|
||||
#include "../../Screen.h"
|
||||
#include "../../TweenData.h"
|
||||
#include "../../components/ImageButton.h"
|
||||
#include "../../components/Button.h"
|
||||
#include "../../components/RolledSelectionListH.h"
|
||||
#include "../../../Minecraft.h"
|
||||
#include "../../../../world/level/storage/LevelStorageSource.h"
|
||||
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class SelectWorldScreen;
|
||||
|
||||
//
|
||||
// Scrolling World selection list
|
||||
//
|
||||
class TouchWorldSelectionList : public RolledSelectionListH
|
||||
{
|
||||
public:
|
||||
TouchWorldSelectionList(Minecraft* _minecraft, int _width, int _height);
|
||||
virtual void tick();
|
||||
void stepLeft();
|
||||
void stepRight();
|
||||
|
||||
void commit();
|
||||
protected:
|
||||
virtual int getNumberOfItems();
|
||||
virtual void selectItem(int item, bool doubleClick);
|
||||
virtual bool isSelectedItem(int item);
|
||||
|
||||
virtual void renderBackground() {}
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator& t);
|
||||
virtual float getPos(float alpha);
|
||||
virtual void touched() { mode = 0; }
|
||||
virtual bool capXPosition();
|
||||
|
||||
virtual void selectStart(int item, int localX, int localY);
|
||||
virtual void selectCancel();
|
||||
private:
|
||||
TweenData td;
|
||||
void tweenInited();
|
||||
|
||||
int selectedItem;
|
||||
bool _newWorldSelected; // Is the PLUS button pressed?
|
||||
int _height;
|
||||
LevelSummaryList levels;
|
||||
std::vector<StringVector> _descriptions;
|
||||
StringVector _imageNames;
|
||||
|
||||
bool hasPickedLevel;
|
||||
LevelSummary pickedLevel;
|
||||
int pickedIndex;
|
||||
|
||||
int stoppedTick;
|
||||
int currentTick;
|
||||
float accRatio;
|
||||
int mode;
|
||||
|
||||
friend class SelectWorldScreen;
|
||||
};
|
||||
|
||||
//
|
||||
// Delete World screen
|
||||
//
|
||||
class TouchDeleteWorldScreen: public ConfirmScreen
|
||||
{
|
||||
public:
|
||||
TouchDeleteWorldScreen(const LevelSummary& levelId);
|
||||
protected:
|
||||
virtual void postResult(bool isOk);
|
||||
private:
|
||||
LevelSummary _level;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Select world screen
|
||||
//
|
||||
class SelectWorldScreen: public Screen
|
||||
{
|
||||
public:
|
||||
SelectWorldScreen();
|
||||
virtual ~SelectWorldScreen();
|
||||
|
||||
virtual void init() override;
|
||||
virtual void setupPositions() override;
|
||||
|
||||
virtual void tick() override;
|
||||
virtual void render(int xm, int ym, float a) override;
|
||||
|
||||
virtual bool isIndexValid(int index);
|
||||
virtual bool handleBackEvent(bool isDown) override;
|
||||
virtual void buttonClicked(Button* button) override;
|
||||
virtual void keyPressed(int eventKey) override;
|
||||
|
||||
// support for mouse wheel when desktop code uses touch variant
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
|
||||
bool isInGameScreen() override;
|
||||
private:
|
||||
void loadLevelSource();
|
||||
std::string getUniqueLevelName(const std::string& level);
|
||||
|
||||
ImageButton bDelete;
|
||||
TButton bCreate;
|
||||
THeader bHeader;
|
||||
TButton bBack;
|
||||
Button bWorldView;
|
||||
TouchWorldSelectionList* worldsList;
|
||||
LevelSummaryList levels;
|
||||
|
||||
bool _mouseHasBeenUp;
|
||||
bool _hasStartedLevel;
|
||||
//LevelStorageSource* levels;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,43 +1,41 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchStartMenuScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchStartMenuScreen_H__
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../components/LargeImageButton.h"
|
||||
#include "../../components/ImageButton.h"
|
||||
#include "../../components/TextBox.h"
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class StartMenuScreen: public Screen
|
||||
{
|
||||
public:
|
||||
StartMenuScreen();
|
||||
virtual ~StartMenuScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
bool handleBackEvent(bool isDown);
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
|
||||
LargeImageButton bHost;
|
||||
LargeImageButton bJoin;
|
||||
LargeImageButton bOptions;
|
||||
ImageButton bQuit; // X close icon
|
||||
|
||||
std::string copyright;
|
||||
int copyrightPosX;
|
||||
|
||||
std::string version;
|
||||
int versionPosX;
|
||||
|
||||
std::string username;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS_TOUCH__TouchStartMenuScreen_H__*/
|
||||
#pragma once
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../components/LargeImageButton.h"
|
||||
#include "../../components/ImageButton.h"
|
||||
#include "../../components/TextBox.h"
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class StartMenuScreen: public Screen
|
||||
{
|
||||
public:
|
||||
StartMenuScreen();
|
||||
virtual ~StartMenuScreen();
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
bool handleBackEvent(bool isDown);
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
|
||||
LargeImageButton bHost;
|
||||
LargeImageButton bJoin;
|
||||
LargeImageButton bOptions;
|
||||
ImageButton bQuit; // X close icon
|
||||
|
||||
std::string copyright;
|
||||
int copyrightPosX;
|
||||
|
||||
std::string version;
|
||||
int versionPosX;
|
||||
|
||||
std::string username;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user