nfcdrummer
asked on
Creating a map editor in C++ Builder 4.0
Well I'm making a role-playing game, similar to a game called Demise, and I would like to make a map editor, where you have a grid of squares, and you move between each square.
I would like to know how to create a map editor for this, and load the maps into the game. I would also like to be able to customize the amount of levels, x and y sizes seperately and different types of surfaces.
I would like to know how to create a map editor for this, and load the maps into the game. I would also like to be able to customize the amount of levels, x and y sizes seperately and different types of surfaces.
ASKER
Hey I'm sorry, but I can't accept your answer YET.
Whenever I try to run the examples to get an idea of what to do so I can see what the source code does in them, it gives me this error:
The OPENGL32.DLL file is
linked to missing export GDI32.DLL:GdiSwapBuffers
I have no idea of what to do... so if you could help me out for a bit, and if I can work a way out of making the map editor, then you can post an answer or somethign and I'll reward the points
Whenever I try to run the examples to get an idea of what to do so I can see what the source code does in them, it gives me this error:
The OPENGL32.DLL file is
linked to missing export GDI32.DLL:GdiSwapBuffers
I have no idea of what to do... so if you could help me out for a bit, and if I can work a way out of making the map editor, then you can post an answer or somethign and I'll reward the points
you ask for a help and here i am
about OpenGL and and C++Builder
first is you don't have openGL on your comp you have to find it on the net and istall it(if you have win98 the openGL is included)
now you have to find your self the glut part of opengl you can download it for free or if you want i can try to find mine and to send it to your e-mail
then you should copy the file glut.h to the gl folder in the include folder in the c++builder folder
then you have to make a lib of opengl for c++builder that u do from the glut32.dll that come with glut and a prog that is in the bin floder in c++builder
you use the prog implib.exe that in the bin floder and you execute the follow line:implib.exe glut.lib glut32.dll
(don't forget to copy the dll to the same folder as the implib.exe)
it will make a lib file for c++builder
you copy this file to the lib folder in the c++builder folder
(very important you make a lib file from glut32.dll <not glut.dll> and you name it glut.lib <not glut32.lib>)
then in your project you go to view makefile there you add to ALLIB at the end :glut.lib
that all
if you want here is some sites about openGL:
samples:
http://trant.sgi.com/opengl/examples/samples/samples.html
and
command documentaion
http://tc1.chemie.uni-bielefeld.de/doc/OpenGL/hp/Index.html
sory for any english mistake it known to all that i don't know how to write
and when i do it very fast it is even worse
about OpenGL and and C++Builder
first is you don't have openGL on your comp you have to find it on the net and istall it(if you have win98 the openGL is included)
now you have to find your self the glut part of opengl you can download it for free or if you want i can try to find mine and to send it to your e-mail
then you should copy the file glut.h to the gl folder in the include folder in the c++builder folder
then you have to make a lib of opengl for c++builder that u do from the glut32.dll that come with glut and a prog that is in the bin floder in c++builder
you use the prog implib.exe that in the bin floder and you execute the follow line:implib.exe glut.lib glut32.dll
(don't forget to copy the dll to the same folder as the implib.exe)
it will make a lib file for c++builder
you copy this file to the lib folder in the c++builder folder
(very important you make a lib file from glut32.dll <not glut.dll> and you name it glut.lib <not glut32.lib>)
then in your project you go to view makefile there you add to ALLIB at the end :glut.lib
that all
if you want here is some sites about openGL:
samples:
http://trant.sgi.com/opengl/examples/samples/samples.html
and
command documentaion
http://tc1.chemie.uni-bielefeld.de/doc/OpenGL/hp/Index.html
sory for any english mistake it known to all that i don't know how to write
and when i do it very fast it is even worse
ASKER
alright, I've done all that
Sorry it took me so long to reply I've been pre-occupied.
Now, do you think you could run me through how I work using opengl?
I am probably getting some C++ books soon, one of which is Secrets of the programming gurus: Game Programming in 2d and 3d
the others are C++ Builder4 in 24hours and Using C++.
anyway, I will still need help from someone with prior experience. One thing I should tell you is, rather than this question being for how to make a map editor, I'd like to make it 'how do I use opengl effectivly', since I have found someone who is making me a map editor right now.
cheers
Sorry it took me so long to reply I've been pre-occupied.
Now, do you think you could run me through how I work using opengl?
I am probably getting some C++ books soon, one of which is Secrets of the programming gurus: Game Programming in 2d and 3d
the others are C++ Builder4 in 24hours and Using C++.
anyway, I will still need help from someone with prior experience. One thing I should tell you is, rather than this question being for how to make a map editor, I'd like to make it 'how do I use opengl effectivly', since I have found someone who is making me a map editor right now.
cheers
i"ll give you all the help i can
just ask
about books there is a great book in openGL named supperbible OpenGL or something like this
i'm sending you an all example of a cube in opengl you"ll learn from it the basic of opengl the programs structure using openGL for any questions about it ask me <in c++builder by the way>
#pragma hdrstop
#include <condefs.h>
#pragma argsused
#include <iostream.h>
#include <gl/glut.h>
GLfloat Cube[][3]={{-1,-1,-1},{1,- 1,-1},
{1,1,-1},{-1,1,-1},{-1,-1, 1},
{1,-1,1},{1,1,1},{-1,1,1}} ;
GLfloat Octa[][3]={{-1,0,-1},{1,0, -1},
{1,0,1},{-1,0,1},{0,2,0},{ 0,-2,0}};
GLfloat Tetra[][3]={{-1,-0.64,-1}, {1,-0.64,- 1},
{0,-0.64,1.23},{0,1.29,0}} ;
GLfloat colors[][3]={{0,0,0},{1,0, 0},
{1,1,0},{0,1,0},{0,0,1},
{1,0,1},{1,1,1},{0,1,1}};
void Polygon(int a,int b,int c,int d)
{
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(Cube[a]);
glColor3fv(colors[b]);
glVertex3fv(Cube[b]);
glColor3fv(colors[c]);
glVertex3fv(Cube[c]);
glColor3fv(colors[d]);
glVertex3fv(Cube[d]);
glEnd();
}
void Cubemsgeret(int a,int b,int c,int d)
{
glBegin(GL_LINE_LOOP);
glColor3f(0,0,0);
glVertex3fv(Cube[a]);
glVertex3fv(Cube[b]);
glVertex3fv(Cube[c]);
glVertex3fv(Cube[d]);
glEnd();
}
void Triangle(int a,int b,int c)
{
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(Octa[a]);
glColor3fv(colors[b]);
glVertex3fv(Octa[b]);
glColor3fv(colors[c]);
glVertex3fv(Octa[c]);
glEnd();
}
void Octamsgeret(int a,int b,int c)
{
glBegin(GL_LINE_LOOP);
glColor3f(0,0,0);
glVertex3fv(Octa[a]);
glVertex3fv(Octa[b]);
glVertex3fv(Octa[c]);
glEnd();
}
void TriangleTetra(int a,int b,int c)
{
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(Tetra[a]);
glColor3fv(colors[b]);
glVertex3fv(Tetra[b]);
glColor3fv(colors[c]);
glVertex3fv(Tetra[c]);
glEnd();
}
void Tetramsgeret(int a,int b,int c)
{
glBegin(GL_LINE_LOOP);
glColor3f(0,0,0);
glVertex3fv(Tetra[a]);
glVertex3fv(Tetra[b]);
glVertex3fv(Tetra[c]);
glEnd();
}
void ColorCube()
{
Polygon(0,3,2,1);
Polygon(2,3,7,6);
Polygon(0,4,7,3);
Polygon(1,2,6,5);
Polygon(4,5,6,7);
Polygon(0,1,5,4);
Cubemsgeret(0,3,2,1);
Cubemsgeret(2,3,7,6);
Cubemsgeret(0,4,7,3);
Cubemsgeret(1,2,6,5);
Cubemsgeret(4,5,6,7);
Cubemsgeret(0,1,5,4);
}
void ColorOcta()
{
Triangle(0,3,4);
Triangle(0,1,4);
Triangle(1,2,4);
Triangle(2,3,4);
Triangle(0,3,5);
Triangle(0,1,5);
Triangle(1,2,5);
Triangle(2,3,5);
Octamsgeret(0,3,4);
Octamsgeret(0,1,4);
Octamsgeret(1,2,4);
Octamsgeret(2,3,4);
Octamsgeret(0,3,5);
Octamsgeret(0,1,5);
Octamsgeret(1,2,5);
Octamsgeret(2,3,5);
}
void ColorTetra()
{
TriangleTetra(0,1,2);
TriangleTetra(1,2,3);
TriangleTetra(2,0,3);
TriangleTetra(0,1,3);
Tetramsgeret(0,1,2);
Tetramsgeret(1,2,3);
Tetramsgeret(2,0,3);
Tetramsgeret(0,1,3);
}
static GLfloat theta[]={0,0,0};
static GLint axis=2;
void display()
{
glClear(GL_COLOR_BUFFER_BI T|GL_DEPTH _BUFFER_BI T);
glLoadIdentity();
glRotatef(theta[0],1,0,0);
glRotatef(theta[1],0,1,0);
glRotatef(theta[2],0,0,1);
ColorCube();
glFlush();
glutSwapBuffers();
}
void spincube()
{
theta[axis]+=2;
if (theta[axis]>360) theta[axis]-=360;
glutPostRedisplay();
}
void RotateMenuFunc(int id)
{
if (id==1) axis=0;
if (id==2) axis=1;
if (id==3) axis=2;
}
void reshape(int w,int h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION );
glLoadIdentity();
if (w<=h)
glOrtho(-2,2,-2*(GLfloat)h /(GLfloat) w,
2*(GLfloat)h/(GLfloat)w,-1 0,10);
else
glOrtho(-2*(GLfloat)w/(GLf loat)h,
2*(GLfloat)w/(GLfloat)h,-2 ,2,-20,10) ;
glMatrixMode(GL_MODELVIEW) ;
}
void main(int argc,char **argv)
{
int Rotate_Menu;
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_D OUBLE|GLUT _RGBA|GLUT _DEPTH);
glutInitWindowSize(800,600 );
glutCreateWindow("Figures" );
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutIdleFunc(spincube);
Rotate_Menu=glutCreateMenu (RotateMen uFunc);
glutAddMenuEntry("Rotate X",1);
glutAddMenuEntry("Rotate Y",2);
glutAddMenuEntry("Rotate Z",3);
glutAttachMenu(GLUT_LEFT_B UTTON);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glutMainLoop();
}
hope it will help you
just ask
about books there is a great book in openGL named supperbible OpenGL or something like this
i'm sending you an all example of a cube in opengl you"ll learn from it the basic of opengl the programs structure using openGL for any questions about it ask me <in c++builder by the way>
#pragma hdrstop
#include <condefs.h>
#pragma argsused
#include <iostream.h>
#include <gl/glut.h>
GLfloat Cube[][3]={{-1,-1,-1},{1,-
{1,1,-1},{-1,1,-1},{-1,-1,
{1,-1,1},{1,1,1},{-1,1,1}}
GLfloat Octa[][3]={{-1,0,-1},{1,0,
{1,0,1},{-1,0,1},{0,2,0},{
GLfloat Tetra[][3]={{-1,-0.64,-1},
{0,-0.64,1.23},{0,1.29,0}}
GLfloat colors[][3]={{0,0,0},{1,0,
{1,1,0},{0,1,0},{0,0,1},
{1,0,1},{1,1,1},{0,1,1}};
void Polygon(int a,int b,int c,int d)
{
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(Cube[a]);
glColor3fv(colors[b]);
glVertex3fv(Cube[b]);
glColor3fv(colors[c]);
glVertex3fv(Cube[c]);
glColor3fv(colors[d]);
glVertex3fv(Cube[d]);
glEnd();
}
void Cubemsgeret(int a,int b,int c,int d)
{
glBegin(GL_LINE_LOOP);
glColor3f(0,0,0);
glVertex3fv(Cube[a]);
glVertex3fv(Cube[b]);
glVertex3fv(Cube[c]);
glVertex3fv(Cube[d]);
glEnd();
}
void Triangle(int a,int b,int c)
{
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(Octa[a]);
glColor3fv(colors[b]);
glVertex3fv(Octa[b]);
glColor3fv(colors[c]);
glVertex3fv(Octa[c]);
glEnd();
}
void Octamsgeret(int a,int b,int c)
{
glBegin(GL_LINE_LOOP);
glColor3f(0,0,0);
glVertex3fv(Octa[a]);
glVertex3fv(Octa[b]);
glVertex3fv(Octa[c]);
glEnd();
}
void TriangleTetra(int a,int b,int c)
{
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(Tetra[a]);
glColor3fv(colors[b]);
glVertex3fv(Tetra[b]);
glColor3fv(colors[c]);
glVertex3fv(Tetra[c]);
glEnd();
}
void Tetramsgeret(int a,int b,int c)
{
glBegin(GL_LINE_LOOP);
glColor3f(0,0,0);
glVertex3fv(Tetra[a]);
glVertex3fv(Tetra[b]);
glVertex3fv(Tetra[c]);
glEnd();
}
void ColorCube()
{
Polygon(0,3,2,1);
Polygon(2,3,7,6);
Polygon(0,4,7,3);
Polygon(1,2,6,5);
Polygon(4,5,6,7);
Polygon(0,1,5,4);
Cubemsgeret(0,3,2,1);
Cubemsgeret(2,3,7,6);
Cubemsgeret(0,4,7,3);
Cubemsgeret(1,2,6,5);
Cubemsgeret(4,5,6,7);
Cubemsgeret(0,1,5,4);
}
void ColorOcta()
{
Triangle(0,3,4);
Triangle(0,1,4);
Triangle(1,2,4);
Triangle(2,3,4);
Triangle(0,3,5);
Triangle(0,1,5);
Triangle(1,2,5);
Triangle(2,3,5);
Octamsgeret(0,3,4);
Octamsgeret(0,1,4);
Octamsgeret(1,2,4);
Octamsgeret(2,3,4);
Octamsgeret(0,3,5);
Octamsgeret(0,1,5);
Octamsgeret(1,2,5);
Octamsgeret(2,3,5);
}
void ColorTetra()
{
TriangleTetra(0,1,2);
TriangleTetra(1,2,3);
TriangleTetra(2,0,3);
TriangleTetra(0,1,3);
Tetramsgeret(0,1,2);
Tetramsgeret(1,2,3);
Tetramsgeret(2,0,3);
Tetramsgeret(0,1,3);
}
static GLfloat theta[]={0,0,0};
static GLint axis=2;
void display()
{
glClear(GL_COLOR_BUFFER_BI
glLoadIdentity();
glRotatef(theta[0],1,0,0);
glRotatef(theta[1],0,1,0);
glRotatef(theta[2],0,0,1);
ColorCube();
glFlush();
glutSwapBuffers();
}
void spincube()
{
theta[axis]+=2;
if (theta[axis]>360) theta[axis]-=360;
glutPostRedisplay();
}
void RotateMenuFunc(int id)
{
if (id==1) axis=0;
if (id==2) axis=1;
if (id==3) axis=2;
}
void reshape(int w,int h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION
glLoadIdentity();
if (w<=h)
glOrtho(-2,2,-2*(GLfloat)h
2*(GLfloat)h/(GLfloat)w,-1
else
glOrtho(-2*(GLfloat)w/(GLf
2*(GLfloat)w/(GLfloat)h,-2
glMatrixMode(GL_MODELVIEW)
}
void main(int argc,char **argv)
{
int Rotate_Menu;
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_D
glutInitWindowSize(800,600
glutCreateWindow("Figures"
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutIdleFunc(spincube);
Rotate_Menu=glutCreateMenu
glutAddMenuEntry("Rotate X",1);
glutAddMenuEntry("Rotate Y",2);
glutAddMenuEntry("Rotate Z",3);
glutAttachMenu(GLUT_LEFT_B
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glutMainLoop();
}
hope it will help you
ASKER
Umm... well do you think you could describe some the commands, what they do, etc??? I need to learn about it, not just look
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey I figured I'd just accept your comment as answer... since the question is irrelevent now.
Thanks for all of your help
Thanks for all of your help
if you are interested there is a good book about OpenGL named superbible