Difference between revisions of "Complete roguelike tutorial using modern C++ and libtcod - Part 1: Setting Up"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
==Setup== | |||
===Windows=== | |||
Set up Visual Studio Community, optionally use Clang add-on | Set up Visual Studio Community, optionally use Clang add-on | ||
===Mac=== | |||
===Linux=== | |||
Visual Studio Code | Visual Studio Code | ||
Line 18: | Line 15: | ||
===tcod=== | |||
Clone tcod from source | Clone tcod from source | ||
Line 25: | Line 22: | ||
==Tutorial 1 - Basic @== | |||
Set up using CMake | Set up using CMake | ||
Line 31: | Line 28: | ||
Import tcod | Import tcod | ||
#include "libtcod.hpp" | |||
int main() | |||
{ | |||
TCODConsole::initRoot( | |||
80, | |||
50, | |||
"libtcod C++ tutorial 1", | |||
false, | |||
TCOD_RENDERER_SDL2); | |||
auto root = TCODConsole::root; | |||
root->flush(); | |||
while ( !TCODConsole::isWindowClosed() ) | |||
{ | |||
TCOD_key_t key; | |||
TCODSystem::waitForEvent(TCOD_EVENT_KEY_PRESS, &key, nullptr); | |||
root->clear(); | |||
root->putChar(40,25,'@'); | |||
root->flush(); | |||
} | |||
return 0; | |||
} |
Revision as of 04:51, 3 February 2020
Setup
Windows
Set up Visual Studio Community, optionally use Clang add-on
Mac
Linux
Visual Studio Code
Packages: GCC, Clang, SDL, OpenGL
tcod
Clone tcod from source
Build tcod
Tutorial 1 - Basic @
Set up using CMake
Import tcod
#include "libtcod.hpp" int main() { TCODConsole::initRoot( 80, 50, "libtcod C++ tutorial 1", false, TCOD_RENDERER_SDL2); auto root = TCODConsole::root; root->flush(); while ( !TCODConsole::isWindowClosed() ) { TCOD_key_t key; TCODSystem::waitForEvent(TCOD_EVENT_KEY_PRESS, &key, nullptr); root->clear(); root->putChar(40,25,'@'); root->flush(); } return 0; }