Date2026-05-19T16:29:20+02:00
Committercu1017
Download
| // Copyright 2026, University of Freiburg
// Chair of Algorithms and Data Structures
// Author: Christoph Ullinger <ullingec@cs.uni-freiburg.de>
#pragma once
class UserInput {
public:
int keycode_;
bool isEscape();
bool isKeyUp();
bool isKeyDown();
bool isKeyLeft();
bool isKeyRight();
};
class TerminalManager {
private:
// The total number of logical pixels on the screen.
int numRows_;
int numCols_;
public:
// Getters for the screen dimensions.
int numRows() { return numRows_; }
int numCols() { return numCols_; }
// The colors supported by our terminal manager.
static int White;
static int Red;
static int Green;
// Initialize the terminal for use with ncurses commands.
TerminalManager();
// Reset the terminal.
~TerminalManager();
// Refresh the screen.
void refresh();
// Draw a pixel at the given logical position in the given color.
void drawPixel(int col, int row, int color);
// Read user keyboard or mouse input.
UserInput getUserInput();
};
|