-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial keyboard gui, disable cache to fix font rendering
- Loading branch information
Showing
5 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "Keyboard.hpp" | ||
|
||
Keyboard::Keyboard() | ||
{ | ||
|
||
} | ||
|
||
void Keyboard::render(Element* parent) | ||
{ | ||
SDL_Rect dimens = { 880, 0, 400, 150 }; | ||
|
||
this->window = parent->window; | ||
this->renderer = parent->renderer; | ||
|
||
SDL_SetRenderDrawColor(parent->renderer, 0xf9, 0xf9, 0xf9, 0xFF); | ||
SDL_RenderFillRect(parent->renderer, &dimens); | ||
|
||
// draw a qwerty keyboard | ||
std::string row1 = "Q W E R T Y U I O P"; | ||
std::string row2 = "A S D F G H J K L"; | ||
std::string row3 = "Z X C V B N M"; | ||
|
||
std::vector<std::string> rows = std::vector<std::string>(); | ||
rows.push_back(row1); | ||
rows.push_back(row2); | ||
rows.push_back(row3); | ||
SDL_Color gray = { 0x52, 0x52, 0x52, 0xff }; | ||
|
||
for (int x=0; x<rows.size(); x++) | ||
{ | ||
TextElement* rowText = new TextElement(rows[x].c_str(), 30, &gray, true); | ||
rowText->position(910+x*22, 14+x*33); | ||
this->elements.push_back(rowText); | ||
} | ||
|
||
super::render(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "Element.hpp" | ||
#include "TextElement.hpp" | ||
#include <SDL2/SDL_image.h> | ||
#pragma once | ||
|
||
class Keyboard : public Element | ||
{ | ||
public: | ||
Keyboard(); | ||
void render(Element* parent); | ||
// bool process(InputEvents* event); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters