the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 71 lines 1.8 kB view raw
1#include "stdafx.h" 2#include "XUI_Chat.h" 3#include "..\..\Minecraft.h" 4#include "..\..\Gui.h" 5 6HRESULT CScene_Chat::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 7{ 8 m_iPad = *(int *)pInitData->pvInitData; 9 10 MapChildControls(); 11 12 this->SetTimer(0,100); 13 14 XuiElementGetPosition(m_hObj,&m_OriginalPosition); 15 16 return S_OK; 17} 18 19HRESULT CScene_Chat::OnTimer( XUIMessageTimer *pXUIMessageTimer, BOOL &bHandled) 20{ 21 Minecraft *pMinecraft = Minecraft::GetInstance(); 22 Gui *pGui = pMinecraft->gui; 23 24 //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); 25 for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i ) 26 { 27 float opacity = pGui->getOpacity(m_iPad, i); 28 if( opacity > 0 ) 29 { 30 m_Backgrounds[i].SetOpacity(opacity); 31 m_Labels[i].SetOpacity(opacity); 32 m_Labels[i].SetText( pGui->getMessage(m_iPad,i).c_str() ); 33 } 34 else 35 { 36 m_Backgrounds[i].SetOpacity(0); 37 m_Labels[i].SetOpacity(0); 38 } 39 } 40 if(pMinecraft->localplayers[m_iPad]!= NULL) 41 { 42 m_Jukebox.SetText( pGui->getJukeboxMessage(m_iPad).c_str() ); 43 m_Jukebox.SetOpacity( pGui->getJukeboxOpacity(m_iPad) ); 44 } 45 return S_OK; 46} 47 48HRESULT CScene_Chat::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled) 49{ 50 bHandled=true; 51 52 app.ReloadChatScene(m_iPad, bJoining); 53 54 return S_OK; 55} 56 57HRESULT CScene_Chat::OffsetTextPosition( float xOffset, float yOffset /*= 0.0f*/ ) 58{ 59 D3DXVECTOR3 vPos; 60 float fWidth, fHeight; 61 XuiElementGetBounds( m_Backgrounds[0], &fWidth, &fHeight ); 62 for(unsigned int i = 0; i < CHAT_LINES_COUNT; ++i) 63 { 64 XuiElementGetPosition( m_Labels[i], &vPos ); 65 vPos.x = xOffset; 66 vPos.y += yOffset; 67 XuiElementSetPosition( m_Labels[i], &vPos ); 68 XuiElementSetBounds( m_Labels[i], fWidth - xOffset, fHeight ); 69 } 70 return S_OK; 71}