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
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
bool CMenue::CheckMousePosition() { pRect.x1 = 8; // The X-Axis of the Quad. (left top) pRect.y1 = 2; // The Y-Axis of the Quad. (left top) pRect.x2 = 6; // The X-Axis of the Quad. (right bottom) pRect.y2 = -2; // The Y-Axis of the Quad. (right bottom) GetCursorPos(&point); if(point.x >= pRect.x1 && point.x <= pRect.x2 && point.y >= pRect.y1 && point.y <= pRect.y2) { return true; } return false; } // the calling of the function case GS_MENUE: if (KEY_DOWN(VK_LBUTTON) && pMenue->CheckMousePosition()){SetNewGameState(GS_GAME);} break; |
Administrator
C-/C++-Quelltext |
|
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 |
// Lock the vertexbuffer // vertex_buffer->Lock(0, 0, (VOID**)pVertices, 0); // Left top pVertices[0].position = D3DXVECTOR3(2.0f, 8.0f, 0.0f); pVertices[0].color = D3DCOLOR_XRGB(255, 255, 255); pVertices[0].tu = 0.0f; pVertices[0].tv = 0.0f; // Left bottom // pVertices[1].position = D3DXVECTOR3(2.0f, 6.0f, 0.0f); pVertices[1].color = D3DCOLOR_XRGB(255, 255, 255); pVertices[1].tu = 0.0f; pVertices[1].tv = 1.0f; // Right top pVertices[2].position = D3DXVECTOR3(-2.0f, 8.0f, 0.0f); pVertices[2].color = D3DCOLOR_XRGB(255, 255, 255); pVertices[2].tu = 1.0f; pVertices[2].tv = 0.0f; // Right bottom pVertices[3].position = D3DXVECTOR3(-2.0f, 6.0f, 0.0f); pVertices[3].color = D3DCOLOR_XRGB(255, 255, 255); pVertices[3].tu = 1.0f; pVertices[3].tv = 1.0f; // Unlock the vertexbuffer // vertex_buffer->Unlock(); bool CMenue::CheckMousePosition() { pRect.x1 = -2; pRect.y1 = 6; pRect.x2 = 2; pRect.y2 = 8; GetCursorPos(&point); if(point.x >= pRect.x1 && point.x <= pRect.x2 && point.y >= pRect.y1 && point.y <= pRect.y2) { return true; } return false; } |
Community-Fossil
C-/C++-Quelltext |
|
1 2 3 4 |
pRect.x1 = 6; // The X-Axis of the Quad. (left) pRect.y1 = -2; // The Y-Axis of the Quad. (top) pRect.x2 = 8; // The X-Axis of the Quad. (right) pRect.y2 = 2; // The Y-Axis of the Quad. (bottom) |
C-/C++-Quelltext |
|
1 |
pVertices[3].position = D3DXVECTOR3(-2.0f, 6.0f, 0.0f);// Right bottom |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »NachoMan« (12.08.2010, 13:16)
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
bool CMenue::CheckMousePosition() { pRect.x1 = 6; // The X-Axis of the Quad. (left) pRect.y1 = -2; // The Y-Axis of the Quad. (top) pRect.x2 = 8; // The X-Axis of the Quad. (right) pRect.y2 = 2; // The Y-Axis of the Quad. (bottom) GetCursorPos(&point); if(point.x >= pRect.x1 && point.x <= pRect.x2 && point.y >= pRect.y1 && point.y <= pRect.y2) { return true; } return false; } |
C-/C++-Quelltext |
|
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 |
VERTEX vertices[] = { { -2.0f, 6.0f, 0.0f, D3DCOLOR_XRGB(255, 255, 255), 1.0f, 0.0f, },// right top { 2.0f, 6.0f, 0.0f, D3DCOLOR_XRGB(255, 255, 255), 0.0f, 0.0f, },// left top { -2.0f, 5.0f, 0.0f, D3DCOLOR_XRGB(255, 255, 255), 1.0f, 1.0f, },// right bottom { 2.0f, 5.0f, 0.0f, D3DCOLOR_XRGB(255, 255, 255), }, 0.0f, 1.0f,// left bottom }; bool CMenue::CheckMousePosition() { pRect.x1 = 5; // The X-Axis of the Quad. (left) pRect.y1 = -2; // The Y-Axis of the Quad. (top) pRect.x2 = 6; // The X-Axis of the Quad. (right) pRect.y2 = 2; // The Y-Axis of the Quad. (bottom) GetCursorPos(&point); if(point.x >= pRect.x1 && point.x <= pRect.x2 && point.y >= pRect.y1 && point.y <= pRect.y2) { return true; } return false; } void CMenue::Render() { g_pD3D->d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); // Set the renderstates for the menuestate // g_pD3D->d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); g_pD3D->d3ddev->SetRenderState(D3DRS_ZENABLE, FALSE); g_pD3D->d3ddev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); vCameraPosition = D3DXVECTOR3(0.0f, 0.0f, 20.0f); vCameraAt = D3DXVECTOR3(0.0f, 0.0f, 0.0f); pCamera->AdjustCamera(&vCameraPosition, &vCameraAt); g_pD3D->d3ddev->BeginScene(); g_pD3D->d3ddev->SetFVF(FVF); g_pD3D->d3ddev->SetStreamSource(0, vertex_buffer, 0, sizeof(VERTEX)); g_pD3D->d3ddev->SetTexture(0, pTexture); g_pD3D->d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); g_pD3D->d3ddev->SetTexture(0, NULL); FontPosition.top = 50; FontPosition.left = 0; FontPosition.right = SCREEN_WIDTH; FontPosition.bottom = SCREEN_HEIGHT; pFont->DrawText(NULL, TEXT("GalaxyShooter"), -1, &FontPosition, DT_CENTER, D3DCOLOR_XRGB(255, 255, 255)); g_pD3D->d3ddev->EndScene(); g_pD3D->d3ddev->Present(NULL, NULL, NULL, NULL); } |
Werbeanzeige