Reputation: 79
What libraries does Windows provide to draw lines? I am only interested in 2D libraries, not OpenGL or DirectX. I am working in C++.
Upvotes: 1
Views: 7453
Reputation: 12566
cout << ".------------------------------------------------------------." << endl;
cout << ".\n\
|\n\
|\n\
|\n\
|\n\
|\n\
|\n\
|\n\
|\n\
|\n\
|\n\
." << endl;
EDIT: Forgot the dots.
EDIT 2: Diagonal:
for( int i=0; i<10; i++ )
{
for( int j=0; j<10; j++ )
{
if( i == j )
{
for( int k=0; k<i; k++ )
{
cout << " ";
}
if( i == 0 || i == 9 )
{
cout << ".\n";
}
else
{
cout << "\\\n";
}
}
}
}
Upvotes: 9
Reputation: 1772
Depends on your platform.
In Windows you could use GDI or GDI+.
For Mac OS I'm sure both Carbon and Cocoa provide this feature - though I confess to having little knowledge of either API.
Qt provides cross-platform drawing libraries that will work on any of Linux, Windows or Mac.
EDIT:
Direct2D is another C++ option for Windows. It's fully hardware accelerated too which is cool. As for drawing on a fullscreen window, it's no different than drawing in a regular window. You'll just need some extra code to maximize the window and set it to fullscreen mode.
Upvotes: 3
Reputation: 964
It depends. What system are you on? How would you like to draw it? In 3D or 2D? Do you want fullscreen?
Honestly, OpenGL is pretty easy to use with a library like GLUT. After you set it up, all it takes is
glBegin(GL_LINES);
//Vertex pair
glVertex2f(...);
glVertex2f(...);
glEnd();
(Purists will yell at me for using a form of OpenGL that isn't around in the 3.0 standard, but I assume this isn't a major project needing forward-compatibility for a long time).
Two other quick libraries that come to mind:
Upvotes: 0