Changeset 1f25a71 in opengl-game for vulkan-ref.cpp


Ignore:
Timestamp:
Nov 10, 2019, 5:40:12 PM (4 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
0ae182f
Parents:
cc4a8b5
git-author:
Dmitry Portnoy <dmitry.portnoy@…> (11/10/19 17:39:32)
git-committer:
Dmitry Portnoy <dmitry.portnoy@…> (11/10/19 17:40:12)
Message:

In vulkangame, print the SDL version and finish implementing renderUI() to show some test images and text using SDL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-ref.cpp

    rcc4a8b5 r1f25a71  
    152152      SDL_Renderer* gRenderer = nullptr;
    153153      SDL_Texture* uiOverlay = nullptr;
    154 /*** END OF REFACTORED CODE ***/
    155154
    156155      TTF_Font* gFont = nullptr;
     
    158157      SDL_Texture* uiImage = nullptr;
    159158
    160 /*** START OF REFACTORED CODE ***/
    161159      VkInstance instance;
    162160      VkDebugUtilsMessengerEXT debugMessenger;
     
    264262            cout << "Unable to set texture blend mode! SDL Error: " << SDL_GetError() << endl;
    265263         }
    266 /*** END OF REFACTORED CODE ***/
    267 
    268          gFont = TTF_OpenFont("fonts/lazy.ttf", 28);
     264
     265         gFont = TTF_OpenFont("assets/fonts/lazy.ttf", 28);
    269266         if (gFont == nullptr) {
    270267            cout << "Failed to load lazy font! SDL_ttf Error: " << TTF_GetError() << endl;
     
    272269         }
    273270
    274          SDL_Color textColor = { 0, 0, 0 };
    275 
    276          SDL_Surface* textSurface = TTF_RenderText_Solid(gFont, "Great sucess!", textColor);
     271         SDL_Surface* textSurface = TTF_RenderText_Solid(gFont, "Great success!", { 255, 255, 255 });
    277272         if (textSurface == nullptr) {
    278273            cout << "Unable to render text surface! SDL_ttf Error: " << TTF_GetError() << endl;
     
    308303      }
    309304
    310 /*** START OF REFACTORED CODE ***/
    311305      void initVulkan() {
    312306         createInstance();
     
    18511845         SDL_SetRenderDrawColor(gRenderer, 0x00, 0x00, 0x00, 0x00);
    18521846         SDL_RenderClear(gRenderer);
    1853 /*** END OF REFACTORED CODE ***/
    18541847
    18551848         SDL_Rect rect;
     
    18581851         SDL_SetRenderDrawColor(gRenderer, 0x00, 0xFF, 0x00, 0xFF);
    18591852         SDL_RenderFillRect(gRenderer, &rect);
    1860          SDL_SetRenderDrawColor(gRenderer, 0x00, 0x9F, 0x9F, 0xFF);
    18611853
    18621854         rect = {10, 10, 0, 0};
     
    18681860         SDL_RenderCopy(gRenderer, uiImage, nullptr, &rect);
    18691861
    1870 /*** START OF REFACTORED CODE ***/
    18711862         SDL_SetRenderDrawColor(gRenderer, 0x00, 0x00, 0xFF, 0xFF);
    18721863         SDL_RenderDrawLine(gRenderer, 50, 5, 150, 500);
     
    19701961            uiOverlay = nullptr;
    19711962         }
    1972 /*** END OF REFACTORED CODE ***/
    19731963
    19741964         TTF_CloseFont(gFont);
    1975               gFont = nullptr;
     1965         gFont = nullptr;
    19761966
    19771967         if (uiText != nullptr) {
     
    19851975         }
    19861976
    1987 /*** START OF REFACTORED CODE ***/
    19881977         SDL_DestroyRenderer(gRenderer);
    19891978         gRenderer = nullptr;
Note: See TracChangeset for help on using the changeset viewer.