Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
![]() |
Quellcode |
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
// Projekt: SwapSnake // Datei: Logo.cpp // Begin: 12.11.2003 14:24 // Ende: //*********************include************************************* #include "SwapSnake.h" // Bindet alles nötige für das Spiel ein //***************************************************************** tbResult CLogo::Init() { if(Load()) TB_ERROR("Fehler beim Initialisieren von Logo", TB_ERROR); return TB_OK; }; tbResult CLogo::Exit() { if(Unload()) TB_ERROR("Fehler beim Deinitialisieren von Logo", TB_ERROR); return TB_OK; }; tbResult CLogo::Load() { // Logo Texture laden und überprüfen ob diese Existiert m_pLogo = tbTextureManager::GetTexture("Texture//Logo.bmp"); if(m_pLogo == NULL) { TB_ERROR("Fehler beim Laden der Logo Texture", TB_ERROR); } // Titel Texture laden und überprüfen ob diese Existiert m_pTitle = tbTextureManager::GetTexture(g_acBackgroundTexture); if(m_pTitle == NULL) { TB_ERROR("Fehler beim Laden Der Titel Texture", TB_ERROR); }; return TB_OK; }; tbResult CLogo::Unload() { g_pSwapSnake->m_pTextureManager->ReleaseTexture(m_pLogo); g_pSwapSnake->m_pTextureManager->ReleaseTexture(m_pTitle); return TB_OK; }; tbResult CLogo::Move(float fTime) { if(g_pbButtons[TB_MOUSE_BUTTON(1)]) g_pSwapSnake->Exit(); return TB_OK; }; tbResult CLogo::Render(float fTime) { SLogoVertex aVertex[4]; tbDirect3D::Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,tbColor(1.0f,0.0f,0.0f),1.0f,0); tbDirect3D::BeginScene(); tbDirect3D::SetFVF(LOGO_FVF); tbDirect3D::SetTexture(0, m_pTitle); tbDirect3D::SetRS(D3DRS_ZENABLE, D3DZB_FALSE); // Die vier Vertizes des Titelbilds erstellen (Rechteck) // Links unten aVertex[0].vPosition = tbVector3(0.0f, tbDirect3D::GetScreenSize().y, 0.5f); aVertex[0].fRHW = 1.0f; aVertex[0].Color = tbColor(1.0f, 0.8f, 0.8f); aVertex[0].vTex0 = tbVector2(0.0f, 1.0f); // Links oben aVertex[1].vPosition = tbVector3(0.0f, 0.0f, 0.0f); aVertex[1].fRHW = 1.0f; aVertex[1].Color = tbColor(0.8f, 1.0f, 0.8f); aVertex[1].vTex0 = tbVector2(0.0f, 0.0f); // Rechts unten aVertex[2].vPosition = tbVector3(tbDirect3D::GetScreenSize().x, tbDirect3D::GetScreenSize().y, 0.5f); aVertex[2].fRHW = 1.0f; aVertex[2].Color = tbColor(0.8f, 0.8f, 1.0f); aVertex[2].vTex0 = tbVector2(1.0f, 1.0f); // Rechts oben aVertex[3].vPosition = tbVector3(tbDirect3D::GetScreenSize().x, 0.0f, 0.5f); aVertex[3].fRHW = 1.0f; aVertex[3].Color = tbColor(1.0f, 1.0f, 0.8f); aVertex[3].vTex0 = tbVector2(1.0f, 0.0f); // Als Dreiecksfolge zeichnen tbDirect3D::GetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, aVertex, sizeof(SLogoVertex)); tbDirect3D::EndScene(); return TB_OK; }; |
![]() |
Quellcode |
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 |
tbResult CSwapSnake::SetGameState(EGameState NewGameState) { tbResult r = TB_OK; // Variable für tbResult // Allten Spielstand löschen switch(m_GameState) { case GS_LOGO: r=m_pLogo->Exit(); break; // case GS_GAME: r=m_pGame->Exit(); break; // case GS_MAIN_MENU: r=m_pMainMenu->Exit(); break; // case GS_OPTION_MENU: r=m_pOptionMenu->Exit();break; }; if(r==TB_ERROR) return r; // Neuen Spielstand laden m_GameState = NewGameState; // Stopuhr zurücksetzen m_fTime = 0.0f; switch(m_GameState) { case GS_LOGO: r=m_pLogo->Init(); break; // case GS_GAME: r=m_pGame->Init(); break; // case GS_MAIN_MENU: r=m_pMainMenu->Init(); break; // case GS_OPTION_MENU: r=m_pOptionMenu->Init();break; }; return r; }; |
Werbeanzeige