Welcome to SWTI Docs 1.4

Simple Windows Text Interface is made out of 4 static objects.

These four objects have in total about 40 methods to interact with console.

Installation

The installation of SWTI library is easy. Download repository and copy the folder SWTI/swti to your project folder. It contains header and source code for the library. In your application, include a header "#include swti/swti.hpp".

Hello world

You can use this simple example to ensure that SWTI library is installed correctly. Following code writes colorful Hello world on a specified position. It uses the Cursor object and methods setColor and setPosition.

#include <iostream>
#include "swti/swti.hpp"

int main()
{
  Cursor.setColor(YELLOW);
  Cursor.setPosition(5, 2);
  std::cout << "Hello world!" << std::endl;
}

Troubleshooting

If something doesn't work, try to create a new project without any additional libraries other than SWTI. If you succeed, the problem is collision with function names in the library. In C++ functions or objects with same names cannot be used and namespace should be used. To solve this issue, you can create one for swti, in which you include a header and the source file.

#include <iostream>
namespace swti
{
  #include "swti/swti.hpp"
  #include "swti/swti.cpp" // source is needed
}

int main()
{
  swti::Color color = swti::LIGHTGREEN;
  swti::Cursor.setColor(color);
  std::cout << "SWTI Works!\n";
}

You need to use swti:: prefix for every function and object. If something still doesn't work, please add issue.