the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 94 lines 2.6 kB view raw
1#include "stdafx.h" 2#include "..\..\Minecraft.h" 3#include "..\..\ScreenSizeCalculator.h" 4#include "..\..\Lighting.h" 5#include "XUI_Ctrl_SplashPulser.h" 6#include "..\..\Font.h" 7#include "..\..\..\Minecraft.World\Mth.h" 8#include "..\..\..\Minecraft.World\System.h" 9 10//----------------------------------------------------------------------------- 11// CXuiCtrlSplashPulser class 12//----------------------------------------------------------------------------- 13 14//----------------------------------------------------------------------------- 15CXuiCtrlSplashPulser::CXuiCtrlSplashPulser() : 16 m_bDirty(FALSE), 17 m_fScale(1.0f), 18 m_fAlpha(1.0f) 19{ 20 Minecraft *pMinecraft=Minecraft::GetInstance(); 21 22 ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); 23 m_fScreenWidth=(float)pMinecraft->width_phys; 24 m_fRawWidth=(float)ssc.rawWidth; 25 m_fScreenHeight=(float)pMinecraft->height_phys; 26 m_fRawHeight=(float)ssc.rawHeight; 27} 28 29//----------------------------------------------------------------------------- 30HRESULT CXuiCtrlSplashPulser::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled) 31{ 32 HRESULT hr=S_OK; 33 return hr; 34} 35 36HRESULT CXuiCtrlSplashPulser::OnRender(XUIMessageRender *pRenderData, BOOL &bHandled ) 37{ 38#ifdef _XBOX 39 HXUIDC hDC = pRenderData->hDC; 40 41 Minecraft *pMinecraft=Minecraft::GetInstance(); 42 Font *font = pMinecraft->font; 43 44 wstring splash( GetText() ); 45 46 // build and render with the game call 47 48 glDisable(GL_CULL_FACE); 49 glDisable(GL_DEPTH_TEST); 50 51 RenderManager.Set_matrixDirty(); 52 glMatrixMode(GL_PROJECTION); 53 glLoadIdentity(); 54 glOrtho(0, 1280.0f, 720.0f, 0, 1000, 3000); 55 glMatrixMode(GL_MODELVIEW); 56 glLoadIdentity(); 57 glTranslatef(0, 0, -2000); 58 glColor4f(1.0f,1.0f,1.0f,1.0f); 59 60 glPushMatrix(); 61 62 D3DXMATRIX matrix; 63 CXuiControl xuiControl(m_hObj); 64 xuiControl.GetFullXForm(&matrix); 65 float bwidth,bheight; 66 xuiControl.GetBounds(&bwidth,&bheight); 67 68 float xo = (matrix._41 + (bwidth*matrix._11)/2 ); 69 float yo = (matrix._42 + (bheight*matrix._22) ); 70 glTranslatef(xo, yo, 0); 71 72 glRotatef(-17, 0, 0, 1); 73 float sss = 1.8f - Mth::abs(Mth::sin(System::currentTimeMillis() % 1000 / 1000.0f * PI * 2) * 0.1f); 74 sss*=(m_fScreenWidth/m_fRawWidth); 75 76 sss = sss * 100 / (font->width(splash) + 8 * 4); 77 glScalef(sss, sss, sss); 78 //drawCenteredString(font, splash, 0, -8, 0xffff00); 79 font->drawShadow(splash, 0 - (font->width(splash)) / 2, -8, 0xffff00); 80 glPopMatrix(); 81 82 glDisable(GL_RESCALE_NORMAL); 83 84 glEnable(GL_DEPTH_TEST); 85 86 XuiRenderRestoreState(hDC); 87 88 bHandled = TRUE; 89#endif 90 return S_OK; 91} 92 93 94