aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/InBedChatScreen.cpp
blob: fca3d02281825bc25d29ae826275c509d16612db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "stdafx.h"
#include "InBedChatScreen.h"
#include "Button.h"
#include "MultiplayerLocalPlayer.h"
#include "..\Minecraft.World\net.minecraft.locale.h"
#include "..\Minecraft.World\StringHelpers.h"

void InBedChatScreen::init()
{
    Keyboard::enableRepeatEvents(true);

    Language *language = Language::getInstance();

    buttons.push_back(new Button(WAKE_UP_BUTTON, width / 2 - 100, height - 40, language->getElement(L"multiplayer.stopSleeping")));

}

void InBedChatScreen::removed()
{
	Keyboard::enableRepeatEvents(false);
}

void InBedChatScreen::keyPressed(wchar_t ch, int eventKey)
{
    if (eventKey == Keyboard::KEY_ESCAPE)
	{
        sendWakeUp();
    }
	else if (eventKey == Keyboard::KEY_RETURN)
	{
        wstring msg = trimString(message);
        if (msg.length() > 0)
		{
            minecraft->player->chat(trimString(message));
        }
        message = L"";
    }
	else
	{
        ChatScreen::keyPressed(ch, eventKey);
    }
}

void InBedChatScreen::render(int xm, int ym, float a)
{
	ChatScreen::render(xm, ym, a);
}

void InBedChatScreen::buttonClicked(Button *button)
{
    if (button->id == WAKE_UP_BUTTON)
	{
        sendWakeUp();
    }
	else
	{
        ChatScreen::buttonClicked(button);
    }
}

void InBedChatScreen::sendWakeUp()
{
	/* 4J - TODO
    if (minecraft.player instanceof MultiplayerLocalPlayer)
	{
        ClientConnection connection = ((MultiplayerLocalPlayer) minecraft.player).connection;
        connection.send(new PlayerCommandPacket(minecraft.player, PlayerCommandPacket.STOP_SLEEPING));
    }
	*/
}