MCPcopy Create free account
hub / github.com/InkboxSoftware/all-screen-keyboard / drawText

Method drawText

keyboard/src/graphics.cpp:714–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712}
713
714int window::drawText(const char* text, int z, int x, int y, int width, int height, int r, int g, int b, int a, int keyID, int modifier, int customShader){
715 rectangle rect = createRectangle(x, y, width, height);
716 color col = createColor(r, g, b, a);
717
718 //create font texture:
719 SDL_Color c = {static_cast<unsigned char>(r), static_cast<unsigned char>(g), static_cast<unsigned char>(b)};
720 GLuint textureTextGL = textureLoadFromFont(currentFont, text, 200, c);
721 vectorTextures.push_back(textureTextGL);
722
723 //create verticies
724 Vertex verticiesSquare[] = {
725 {{rect.x, rect.y}, {0.0f, 0.0f, col.a}},
726 {{rect.x2, rect.y}, {1.0f, 0.0f, col.a}},
727 {{rect.x, rect.y2}, {0.0f, 1.0f, col.a}},
728 {{rect.x2, rect.y2}, {1.0f, 1.0f, col.a}}
729 };
730
731 GLuint squareVAO = vaoTextureCreate(verticiesSquare, sizeof(verticiesSquare));
732 if(!squareVAO){
733 return -1;
734 }
735 //set order
736 order zorder = { z, DEFAULTTEXTIMAGESHADER, static_cast<unsigned int>(vectorTextGLuint.size()), keyID, modifier, customShader };
737 graphicsList.push_back(zorder);
738 //add to text list
739 vectorTextGLuint.push_back(squareVAO);
740 return 0;
741}
742
743int window::drawImage(const char* src, int z, int x, int y, int width, int height, int a, int keyID, int modifier, int customShader){
744 rectangle rect = createRectangle(x, y, width, height);

Callers 2

textureKeyMethod · 0.45
freeTextureMethod · 0.45

Calls 3

textureLoadFromFontFunction · 0.85
sizeMethod · 0.80
vaoTextureCreateFunction · 0.70

Tested by

no test coverage detected