PDA

View Full Version : Level Editor's (C++ with OpenGL)



06-12-2001, 09:39 PM
Hi,
I am now trying to create a level editor for my game so a txt file can be generatered and used to hold vertex data amonst other stuff. I have decided that inorder to remain cross platform independant, i will write the editor in C++ with OpenGL. My problem mainly lies with the lack of knowledge of graphics programming in C++.
What i would like to know is how to set up a window where the user can draw shapes but more so how to allow the user to resize the shapes with their mouse. I will be most grateful for any help.

Thanks, Paul

masonium
06-17-2001, 05:33 PM
I'm not sure about all the shapes and stuff, but here's some quick code for making a window.

#ifdef __FLAT__
#include <windows.h>
#endif
#include <gl/glut.h>

// The initialisation function
void init(void)
{
glClearColor(1.0, 1.0, 1.0, 0.0) ;
glShadeModel(GL_FLAT) ;
}

// The display function
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT) ;
glutSwapBuffers() ;
}

// The main function
int main(int argc, char** argv)
{
glutInit(&argc, argv) ;
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB) ;
glutInitWindowSize(400, 400) ;
glutInitWindowPosition(100, 100) ;
glutCreateWindow("Title goes here") ;
init() ;
glutDisplayFunc(display) ;
glutMainLoop() ;
return 0 ;
}