Add CMakeLists.txt
Fix warnings related to -Weffc++. Format with clang-format.
This commit is contained in:
parent
c4f9a01b7f
commit
a43f83d7d5
5 changed files with 309 additions and 218 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
/objects/
|
/objects/
|
||||||
/.cache/
|
/.cache/
|
||||||
/compile_commands.json
|
/compile_commands.json
|
||||||
|
/build*/
|
||||||
|
|
39
CMakeLists.txt
Normal file
39
CMakeLists.txt
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
cmake_minimum_required(VERSION 3.22.1)
|
||||||
|
project(DvorakTypingPractice)
|
||||||
|
|
||||||
|
set(DvorakTypingPractice_SOURCES
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/main.cc"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/screen.cc"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(DvorakTypingPractice_HEADERS
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/screen.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(DvorakTypingPractice ${DvorakTypingPractice_SOURCES})
|
||||||
|
|
||||||
|
find_package(raylib REQUIRED)
|
||||||
|
|
||||||
|
target_include_directories(DvorakTypingPractice PUBLIC ${raylib_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(DvorakTypingPractice PUBLIC ${raylib_LIBRARIES})
|
||||||
|
|
||||||
|
target_compile_options(DvorakTypingPractice PUBLIC
|
||||||
|
-Wall -Wextra -Wpedantic
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:-Weffc++>
|
||||||
|
$<$<CONFIG:DEBUG>:-Og>
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
message(STATUS "Setting build type to 'Debug', none was specified.")
|
||||||
|
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EXISTS /usr/bin/clang-format)
|
||||||
|
add_custom_target(
|
||||||
|
ClangFormatTarget
|
||||||
|
COMMAND clang-format -i --style=google ${DvorakTypingPractice_SOURCES} ${DvorakTypingPractice_HEADERS}
|
||||||
|
)
|
||||||
|
add_dependencies(DvorakTypingPractice ClangFormatTarget)
|
||||||
|
message(STATUS "Enabled clang-format formatting.")
|
||||||
|
endif()
|
|
@ -1,7 +1,7 @@
|
||||||
// Standard library includes
|
// Standard library includes
|
||||||
#include <string>
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
// Third party includes
|
// Third party includes
|
||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
|
@ -13,9 +13,10 @@ std::string get_next_word(std::istream *i) {
|
||||||
std::string word;
|
std::string word;
|
||||||
while (i->good()) {
|
while (i->good()) {
|
||||||
int in = i->get();
|
int in = i->get();
|
||||||
if (in != std::char_traits<char>::eof() && in != ' ' && in != '\n' && in != '\r') {
|
if (in != std::char_traits<char>::eof() && in != ' ' && in != '\n' &&
|
||||||
|
in != '\r') {
|
||||||
word.push_back((char)in);
|
word.push_back((char)in);
|
||||||
} else if (in == ' '|| in == '\n' || in == '\r' || in == '\t') {
|
} else if (in == ' ' || in == '\n' || in == '\r' || in == '\t') {
|
||||||
if (!word.empty()) {
|
if (!word.empty()) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
171
src/screen.cc
171
src/screen.cc
|
@ -1,19 +1,20 @@
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
|
|
||||||
Screen::Screen() :
|
Screen::Screen()
|
||||||
prev(),
|
: prev(),
|
||||||
word(),
|
word(),
|
||||||
word_center{0, 0},
|
word_pre(),
|
||||||
keyboard(LoadTexture("dvorak_keyboard.png")),
|
word_post(),
|
||||||
idx(0)
|
word_center{0, 0},
|
||||||
{
|
keyboard(LoadTexture("dvorak_keyboard.png")),
|
||||||
|
idx(0),
|
||||||
|
flags() {
|
||||||
flags.set(0);
|
flags.set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Screen::~Screen() {
|
Screen::~Screen() { UnloadTexture(keyboard); }
|
||||||
UnloadTexture(keyboard);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Screen::set_word(std::string s) {
|
void Screen::set_word(std::string s) {
|
||||||
prev = word;
|
prev = word;
|
||||||
|
@ -65,15 +66,18 @@ void Screen::draw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!word_pre.empty()) {
|
if (!word_pre.empty()) {
|
||||||
DrawText(word_pre.c_str(), LEFT_OFFSET + offset, TOP_OFFSET, FONT_SIZE, WHITE);
|
DrawText(word_pre.c_str(), LEFT_OFFSET + offset, TOP_OFFSET, FONT_SIZE,
|
||||||
|
WHITE);
|
||||||
offset += MeasureText(word_pre.c_str(), FONT_SIZE) + CENTER_X_OFFSET;
|
offset += MeasureText(word_pre.c_str(), FONT_SIZE) + CENTER_X_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText(word_center.data(), LEFT_OFFSET + offset, TOP_OFFSET, FONT_SIZE, GREEN);
|
DrawText(word_center.data(), LEFT_OFFSET + offset, TOP_OFFSET, FONT_SIZE,
|
||||||
|
GREEN);
|
||||||
offset += MeasureText(word_center.data(), FONT_SIZE) + CENTER_X_OFFSET;
|
offset += MeasureText(word_center.data(), FONT_SIZE) + CENTER_X_OFFSET;
|
||||||
|
|
||||||
if (!word_post.empty()) {
|
if (!word_post.empty()) {
|
||||||
DrawText(word_post.c_str(), LEFT_OFFSET + offset, TOP_OFFSET, FONT_SIZE, WHITE);
|
DrawText(word_post.c_str(), LEFT_OFFSET + offset, TOP_OFFSET, FONT_SIZE,
|
||||||
|
WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_overlay(word_center[0]);
|
draw_overlay(word_center[0]);
|
||||||
|
@ -83,191 +87,238 @@ void Screen::draw_overlay(char c) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '`':
|
case '`':
|
||||||
case '~':
|
case '~':
|
||||||
DrawCircle(1 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(1 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
case '!':
|
case '!':
|
||||||
DrawCircle(61 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(61 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
case '@':
|
case '@':
|
||||||
DrawCircle(121 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(121 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
case '#':
|
case '#':
|
||||||
DrawCircle(181 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(181 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
case '$':
|
case '$':
|
||||||
DrawCircle(241 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(241 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '5':
|
case '5':
|
||||||
case '%':
|
case '%':
|
||||||
DrawCircle(301 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(301 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
case '^':
|
case '^':
|
||||||
DrawCircle(361 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(361 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '7':
|
case '7':
|
||||||
case '&':
|
case '&':
|
||||||
DrawCircle(421 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(421 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '8':
|
case '8':
|
||||||
case '*':
|
case '*':
|
||||||
DrawCircle(481 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(481 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '9':
|
case '9':
|
||||||
case '(':
|
case '(':
|
||||||
DrawCircle(541 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(541 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '0':
|
case '0':
|
||||||
case ')':
|
case ')':
|
||||||
DrawCircle(601 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(601 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '{':
|
case '{':
|
||||||
case '[':
|
case '[':
|
||||||
DrawCircle(661 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(661 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '}':
|
case '}':
|
||||||
case ']':
|
case ']':
|
||||||
DrawCircle(721 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(721 + KEY_HALF_SIZE, 1 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
case '"':
|
case '"':
|
||||||
DrawCircle(91 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(91 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
case ',':
|
case ',':
|
||||||
DrawCircle(151 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(151 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '>':
|
case '>':
|
||||||
case '.':
|
case '.':
|
||||||
DrawCircle(211 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(211 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
case 'p':
|
case 'p':
|
||||||
DrawCircle(271 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(271 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'Y':
|
case 'Y':
|
||||||
case 'y':
|
case 'y':
|
||||||
DrawCircle(331 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(331 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
case 'f':
|
case 'f':
|
||||||
DrawCircle(391 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(391 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
case 'g':
|
case 'g':
|
||||||
DrawCircle(451 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(451 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
case 'c':
|
case 'c':
|
||||||
DrawCircle(511 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(511 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
case 'r':
|
case 'r':
|
||||||
DrawCircle(571 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(571 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
case 'l':
|
case 'l':
|
||||||
DrawCircle(631 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(631 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
case '/':
|
case '/':
|
||||||
DrawCircle(691 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(691 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '+':
|
case '+':
|
||||||
case '=':
|
case '=':
|
||||||
DrawCircle(751 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(751 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '|':
|
case '|':
|
||||||
case '\\':
|
case '\\':
|
||||||
DrawCircle(811 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(811 + KEY_HALF_SIZE, 61 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
case 'a':
|
case 'a':
|
||||||
DrawCircle(106 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(106 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
case 'o':
|
case 'o':
|
||||||
DrawCircle(166 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(166 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'e':
|
case 'e':
|
||||||
DrawCircle(226 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(226 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
case 'u':
|
case 'u':
|
||||||
DrawCircle(286 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(286 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
case 'i':
|
case 'i':
|
||||||
DrawCircle(346 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(346 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'd':
|
case 'd':
|
||||||
DrawCircle(406 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(406 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
case 'h':
|
case 'h':
|
||||||
DrawCircle(466 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(466 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
case 't':
|
case 't':
|
||||||
DrawCircle(526 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(526 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
case 'n':
|
case 'n':
|
||||||
DrawCircle(586 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(586 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
case 's':
|
case 's':
|
||||||
DrawCircle(646 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(646 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case '_':
|
case '_':
|
||||||
case '-':
|
case '-':
|
||||||
DrawCircle(706 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(706 + KEY_HALF_SIZE, 121 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case ':':
|
case ':':
|
||||||
case ';':
|
case ';':
|
||||||
DrawCircle(136 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(136 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
case 'Q':
|
||||||
case 'q':
|
case 'q':
|
||||||
DrawCircle(196 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(196 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'J':
|
case 'J':
|
||||||
case 'j':
|
case 'j':
|
||||||
DrawCircle(256 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(256 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
case 'k':
|
case 'k':
|
||||||
DrawCircle(316 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(316 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
case 'x':
|
case 'x':
|
||||||
DrawCircle(376 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(376 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
case 'b':
|
case 'b':
|
||||||
DrawCircle(436 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(436 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
case 'm':
|
case 'm':
|
||||||
DrawCircle(496 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(496 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
case 'w':
|
case 'w':
|
||||||
DrawCircle(556 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(556 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
case 'v':
|
case 'v':
|
||||||
DrawCircle(616 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(616 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
case 'Z':
|
case 'Z':
|
||||||
case 'z':
|
case 'z':
|
||||||
DrawCircle(676 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE, KEY_HIGHLIGHT_COLOR);
|
DrawCircle(676 + KEY_HALF_SIZE, 181 + KEY_HALF_SIZE, KEY_HALF_SIZE,
|
||||||
|
KEY_HIGHLIGHT_COLOR);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -20,7 +20,7 @@ constexpr int KEY_HALF_SIZE = 29;
|
||||||
constexpr Color KEY_HIGHLIGHT_COLOR = Color{255, 255, 0, 127};
|
constexpr Color KEY_HIGHLIGHT_COLOR = Color{255, 255, 0, 127};
|
||||||
|
|
||||||
class Screen {
|
class Screen {
|
||||||
public:
|
public:
|
||||||
Screen();
|
Screen();
|
||||||
~Screen();
|
~Screen();
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public:
|
||||||
bool update();
|
bool update();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string prev;
|
std::string prev;
|
||||||
std::string word;
|
std::string word;
|
||||||
std::string word_pre;
|
std::string word_pre;
|
||||||
|
@ -44,7 +44,6 @@ private:
|
||||||
std::bitset<32> flags;
|
std::bitset<32> flags;
|
||||||
|
|
||||||
void draw_overlay(char c);
|
void draw_overlay(char c);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue