Visual studio 2005 thinks that long long int is 64 bit. The difference between
[dasher.git] / Src / Win32 / GameModeHelper.cpp
blob6ece558b2cbebe4b6897b70e6eb2ca56b57b092e
1 #include "GameModeHelper.h"
2 #include "../DasherCore/GameMessages.h"
4 CGameModeHelper::CGameModeHelper(Dasher::CDasherInterfaceBase *pInterface) {
5 m_pInterface = pInterface;
7 m_strTarget = "this is a test";
9 m_pInterface->AddGameModeString(m_strTarget);
10 m_strOutput = "";
13 void CGameModeHelper::Message(int message, const void *messagedata) {
14 using namespace Dasher::GameMode;
15 const std::string* pStr;
16 std::string strText ="<span background=\"purple\" foreground=\"white\">";
17 switch(message) {
18 case GAME_MESSAGE_SET_TARGET_STRING:
19 pStr = reinterpret_cast<const std::string *>(messagedata);
20 m_strTarget = (*pStr);
22 gtk_misc_set_alignment(GTK_MISC(pPrivate->pGameInfoLabel), 0.0, 0.0);
23 gtk_label_set_justify(pPrivate->pGameInfoLabel, GTK_JUSTIFY_CENTER);
24 gtk_label_set_text(pPrivate->pGameInfoLabel, pPrivate->pstrTarget->c_str());
26 break;
27 case GAME_MESSAGE_DISPLAY_TEXT:
29 gtk_misc_set_alignment(GTK_MISC(pPrivate->pGameInfoLabel), 0.5, 0.0);
30 gtk_label_set_use_markup(pPrivate->pGameInfoLabel, true);
31 gtk_label_set_justify(pPrivate->pGameInfoLabel, GTK_JUSTIFY_CENTER);
34 strText+=(reinterpret_cast<const char*>(messagedata));
35 strText+="</span>";
37 gtk_label_set_markup(pPrivate->pGameInfoLabel, strText.c_str());
39 break;
40 case GAME_MESSAGE_EDIT:
41 pStr = reinterpret_cast<const std::string *>(messagedata);
42 m_strOutput += (*pStr);
43 UpdateTargetLabel();
44 break;
45 case GAME_MESSAGE_EDIT_DELETE:
46 m_strOutput = m_strOutput.substr( 0, m_strOutput.size() -
47 *reinterpret_cast<const int *>(messagedata));
48 UpdateTargetLabel();
49 break;
50 case GAME_MESSAGE_SET_SCORE:
52 SetScore(pPrivate->pScore, reinterpret_cast<const char*>(messagedata));
54 break;
55 case GAME_MESSAGE_SET_LEVEL:
57 gtk_entry_set_text(pPrivate->pLevel, reinterpret_cast<const char*>(messagedata));
59 break;
60 case GAME_MESSAGE_CLEAR_BUFFER:
62 dasher_editor_internal_cleartext(pPrivate->pEditor);
64 m_strOutput.clear();
65 break;
66 case GAME_MESSAGE_HELP_MESSAGE:
67 pStr = reinterpret_cast<const std::string *>(messagedata);
69 game_mode_helper_dialog_box(pSelf, pStr->c_str());
71 break;
75 void CGameModeHelper::Output(std::string strText) {
76 m_strOutput.append(strText);
78 if(m_strOutput == m_strTarget) {
79 int iDummy;
80 iDummy = 0;
84 void CGameModeHelper::Delete(int iCount) {
85 m_strOutput = m_strOutput.substr(0, m_strOutput.size() - iCount);
88 void CGameModeHelper::UpdateTargetLabel()