Changeset f809ae6 in opengl-game for vulkan-game.cpp
- Timestamp:
- Jun 10, 2020, 9:44:02 PM (4 years ago)
- Branches:
- feature/imgui-sdl, master
- Children:
- 6bfd91c
- Parents:
- 699e83a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r699e83a rf809ae6 44 44 45 45 cout << "Vulkan Game" << endl; 46 47 this->score = 0; 46 48 47 49 if (initUI(width, height, guiFlags) == RTWO_ERROR) { … … 674 676 curTime = duration<float, seconds::period>(high_resolution_clock::now() - this->startTime).count(); 675 677 678 this->fpsStartTime = curTime; 679 this->frameCount = 0; 680 676 681 lastSpawn_asteroid = curTime; 677 682 … … 681 686 curTime = duration<float, seconds::period>(high_resolution_clock::now() - this->startTime).count(); 682 687 this->elapsedTime = curTime - this->prevTime; 688 689 if (curTime - this->fpsStartTime >= 1.0f) { 690 this->fps = (float)frameCount / (curTime - this->fpsStartTime); 691 692 this->frameCount = 0; 693 this->fpsStartTime = curTime; 694 } 695 696 this->frameCount++; 683 697 684 698 gui->processEvents(); … … 818 832 } 819 833 820 // renderUI();821 834 currentScreen->renderUI(); 822 835 … … 877 890 addExplosion(model_mat, 0.5f, curTime); 878 891 879 // TODO: Increment player's score here892 this->score++; 880 893 } else if ((objCenter.z - asteroid.radius) > -NEAR_CLIP) { 881 894 asteroid.ssbo.deleted = true; … … 1022 1035 1023 1036 VulkanUtils::copyDataToMemory(device, uniformBuffersMemory_explosionPipeline[currentImage], 0, explosion_UBO); 1024 }1025 1026 void VulkanGame::renderUI() {1027 SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);1028 SDL_RenderClear(renderer);1029 1030 SDL_Rect rect = {280, 220, 100, 100};1031 SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);1032 SDL_RenderFillRect(renderer, &rect);1033 1034 rect = {10, 10, 0, 0};1035 SDL_QueryTexture(fontSDLTexture, nullptr, nullptr, &(rect.w), &(rect.h));1036 SDL_RenderCopy(renderer, fontSDLTexture, nullptr, &rect);1037 1038 rect = {10, 80, 0, 0};1039 SDL_QueryTexture(imageSDLTexture, nullptr, nullptr, &(rect.w), &(rect.h));1040 SDL_RenderCopy(renderer, imageSDLTexture, nullptr, &rect);1041 1042 SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0xFF, 0xFF);1043 SDL_RenderDrawLine(renderer, 50, 5, 150, 500);1044 1045 VulkanUtils::populateVulkanImageFromSDLTexture(device, physicalDevice, commandPool, uiOverlay, renderer,1046 sdlOverlayImage, graphicsQueue);1047 1037 } 1048 1038
Note:
See TracChangeset
for help on using the changeset viewer.