Solved

Creating a map editor in C++ Builder 4.0

Posted on 2000-03-01
8
238 Views
Last Modified: 2008-03-06
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.

0
Comment
Question by:nfcdrummer
  • 4
  • 4
8 Comments
 
LVL 1

Expert Comment

by:ntdragon
ID: 2576128
i didn't try to do it in c++Builder i mean i don't know if there is any component that will help you but you can do it in C++Builder using OpenGL in OpenGL you can do any graphic thing
if you are interested there is a good book about OpenGL named superbible
0
 

Author Comment

by:nfcdrummer
ID: 2584481
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
0
 
LVL 1

Expert Comment

by:ntdragon
ID: 2585444
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

0
 

Author Comment

by:nfcdrummer
ID: 2629430
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
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 1

Expert Comment

by:ntdragon
ID: 2629640
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_BIT|GL_DEPTH_BUFFER_BIT);

      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,-10,10);

      else

        glOrtho(-2*(GLfloat)w/(GLfloat)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_DOUBLE|GLUT_RGBA|GLUT_DEPTH);

      glutInitWindowSize(800,600);

      glutCreateWindow("Figures");

      glutReshapeFunc(reshape);

      glutDisplayFunc(display);

      glutIdleFunc(spincube);

        Rotate_Menu=glutCreateMenu(RotateMenuFunc);

        glutAddMenuEntry("Rotate X",1);

        glutAddMenuEntry("Rotate Y",2);

        glutAddMenuEntry("Rotate Z",3);

        glutAttachMenu(GLUT_LEFT_BUTTON);

      glEnable(GL_DEPTH_TEST);

           glEnable(GL_NORMALIZE);

      glutMainLoop();

}

hope it will help you

0
 

Author Comment

by:nfcdrummer
ID: 2635396
Umm... well do you think you could describe some the commands, what they do, etc???  I need to learn about it, not just look
0
 
LVL 1

Accepted Solution

by:
ntdragon earned 100 total points
ID: 2635921
glutInit(&argc,argv); //init

glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH);//set// the display mode GLUT_DOUBLE set to
//screen buffers GLUT_RGBA set 16.7 m  
//colors GLUT_DEPTH enable you to use
//depth<3D>

glutInitWindowSize(800,600); //Set
//window

glutCreateWindow("Figures"); //create
//window

glutReshapeFunc(reshape); //function
//pointer like event that will run when
//you resize the window

glutDisplayFunc(display);//pointer to
//function that will display

glutIdleFunc(spincube); //pointer to
//func that move the objects

//here i make menus and attach them to
//the mouse buttons
Rotate_Menu=glutCreateMenu(RotateMenuFunc);

        glutAddMenuEntry("Rotate X",1);

        glutAddMenuEntry("Rotate Y",2);

        glutAddMenuEntry("Rotate Z",3);

        glutAttachMenu(GLUT_LEFT_BUTTON);

//very important it enables depth
//without it you won't see the objects
//proparely
glEnable(GL_DEPTH_TEST);

//aotumatic normal
glEnable(GL_NORMALIZE);

//very important a graphic prog must
//have a loop that never ends so this
//make the loop and it run the pointer
//to the funcs i showed you when it
//have to
glutMainLoop();

there are a lot of func's in open gl ask me about anyone that you wan't from my prog and i"ll tell you
i recomend you torun my prog try to undersand the meaning of each func if you can't ask me

or you can go to the site :
http://tc1.chemie.uni-bielefeld.de/doc/OpenGL/hp/Index.html
there are all the commands with full explaination
0
 

Author Comment

by:nfcdrummer
ID: 2663242
Hey I figured I'd just accept your comment as answer... since the question is irrelevent now.

Thanks for all of your help
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now