Skip to content

Instantly share code, notes, and snippets.

@Makman2
Created January 10, 2016 01:02
Show Gist options
  • Save Makman2/71f2b91b7b3801cbd55c to your computer and use it in GitHub Desktop.
Save Makman2/71f2b91b7b3801cbd55c to your computer and use it in GitHub Desktop.
First test program for CE3D2!
#include <CE3D2/render/TextSurface.h>
#include <iostream>
#include <string>
using TextSurface = CE3D2::Render::TextSurface;
void print_surface(TextSurface const& surf)
{
std::string border = "--";
for (TextSurface::size_type x = 0; x < surf.width(); x++)
{
border += '-';
}
border += '\n';
std::string s = border;
for (TextSurface::size_type y = 0; y < surf.height(); y++)
{
s += '|';
for (TextSurface::size_type x = 0; x < surf.width(); x++)
{
s += surf(x, y);
}
s += "|\n";
}
s += border;
std::cout << s;
}
int main()
{
TextSurface surf(20, 10);
surf.fill('#', 7, 4, 8, 4);
print_surface(surf);
return 0;
}
// g++ -std=c++11 -Wall -lCE3D2 main.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment