Jump to content
  • Advertisement

mc30900

Member
  • Content Count

    184
  • Joined

  • Last visited

Community Reputation

100 Neutral

About mc30900

  • Rank
    Member
  1. hello all. assuming i want to create the next code: class a{ b *hello; }; class b{ a *hel; }; what should i do? becuase always the top class wont be able to link to the lower one. any ideas? thanks in advance
  2. thank you all it works now
  3. hello all. i'm trying to delete somthing from a vector. (the vector holds missiles and after they hit somthing they need to be destroyed) after the first missile exploade everything is still ok but when another ones exploade i get the next error msg: An Access Violation (Segmentation Fault) raised in your program. i have no idea why this is happening. here is my code in the new_missile class function: vector <new_missile *>::iterator dmis; int flag=0; dmis = missile.begin(); while ((dmis !=missile.end()) && (flag==0)) { if ((*dmis)==this) { missile.erase(dmis); delete this; flag=1; } dmis++; } if anyone has any idea why this is happening and how can i fix it please tell me. thanks in advance.
  4. i have already done that... thats not my problem. i already used the same 'for' structure and same iterator for accessing those objects in another function.
  5. here is the definition: vector <new_object *> objects; vector <new_object *>::iterator objiterator;
  6. hello all. for some reason my game crashes (its in C++) i have found the place where it crashes but i have no real idea what is causing this. here is the function that makes it crash: int collision(int to, float placex, float placey,float wid,float hei) { if (to==0) { for (objiterator = objects.begin(); objiterator !=objects.end(); objiterator++) { if ((*objiterator)->collisionn == 1) { if (((*objiterator)->placey > (placey+0.1)) && ((placey+0.1)> ((*objiterator)->placey-((*objiterator)->height)))) { if ((((*objiterator)->placex) < (placex)) && ((placex) < ((*objiterator)->placex+(*objiterator)->width))) return 0; if ((((*objiterator)->placex) < (placex+wid) )&& ((placex+wid) < ((*objiterator)->placex+((*objiterator)->width)))) return 0; } } } } return -1; } when i tried to run the debugger i got the next warning: An Access Violation (Segmentation Fault) raised in your program if anyone has any idea what can cause this please tell me. thanks in advance
  7. mc30900

    problem with iterators

    well, as ppl suggested i changed end to rbegin. now i have an error when i'm trying to compile this. here is the code: vector <objectsinfo *>::iterator da; da = objinfo.rbegin(); the error is on the second line: 327 C:\main.cpp no match for 'operator=' in 'da = std::vector<_Tp, _Alloc>::rbegin() [with _Tp = objectsinfo*, _Alloc = std::allocator<objectsinfo*>]()' anyone has any idea what can cause this? thanks in advance
  8. hello all i'm trying to run a function of a class on every elemt in a vector. for some reason the program just crashes (i dont get any erros while compiling it) and i have no idea what is the problem. anyways here is the code: vector<objectsinfo *>::iterator da; da = (objinfo.end()); vector<int>::iterator z; for (z = tempthing.begin(); z !=tempthing.end(); z++) { (*da)->addoption((*z)); } anyone has any idea what can cause this and how to fix this? thanks in advance
  9. hello all. in my program, i want to create a list of a class. but for some reason, i get the error: 102 C:\main.cpp expected constructor, destructor, or type conversion before '.' token anyways here is my code: class new_fire { public: float placex; float placey; float widt; float heigh; int frame; int lasttick; int place; new_fire (float, float, float ,float ,int ); int drawit() { glLoadIdentity(); glTranslatef(xx,yy,-6) ; float ex = ((frame/4)%4)/4.0; float ey = ((frame/4)/4)/4.0; glBindTexture(GL_TEXTURE_2D, textures[7]); glBegin(GL_QUADS); glTexCoord2f(ex,1.0-(ey)); glVertex3f(placex,(placey-heigh),0.0); glTexCoord2f(ex+0.25,1.0-(ey )); glVertex3f( (placex+widt),(placey-heigh),0.0); glTexCoord2f(ex+0.25,1.0-(ey+0.25)); glVertex3f((placex+widt), (placey),0.0); glTexCoord2f(ex ,1.0-(ey+0.25)); glVertex3f(placex, (placey),0.0); glEnd(); if ((SDL_GetTicks()-lasttick)>100) frame=frame+1; return 1; } }; new_fire::new_fire (float placex2, float placey2, float widt2,float heigh2, int place2) { placex=placex2; placey=placey2; widt=widt2; heigh=heigh2; place=place2; frame=0; lasttick=SDL_GetTicks(); } std::list<new_fire> allfire; new_fire a(3.2f, 3.2f, 3.2f ,3.2f ,3); allfire.push_front(a); the problem is in the last line (allfire.push_front(a)) if anyone has any idea why this isnt working, please tell me. thanks in advance
  10. hello all. i'm working on a strategy game. the map is Quad-Based which means there are quads and sand texture on them. anyways when i try to create a minimap (i draw the whole map again but every quad takes less place) my fps is decreasing big time. are there any algoritmes for this? i dont want it to take that much memory. thanks in advance
  11. mc30900

    Blending texture edges

    umm i'm not sure i have understanded what you want to do but... Tga and PNG format got an option to add a channel and so they wont show anything in that channel take a look at nehe lesson 32 hope i helped mc
  12. hello all. i'm using opengl & sdl & python. i'm putting a text on the screen (which works fine in LINUX) but when i put the code and run it in windows it give me some error about unsigned int (that the function glListBase gets -31 or somthing like that) here is the code: def glPrint(x, y, texttodisplay): glBindTexture(GL_TEXTURE_2D, textures[4]) glPushMatrix() glLoadIdentity() glTranslated(x,y,0) glListBase(base-31) listt = texttodisplay.split() glCallLists(texttodisplay) glPopMatrix() def BuildFont(): base=glGenLists(95) glBindTexture(GL_TEXTURE_2D, textures[4]) for loop in range(0,95): cx=float(loop%16)/16.0 cy=float(loop/16)/8.0 glNewList(base+loop,GL_COMPILE) glBegin(GL_QUADS) glTexCoord2f(cx, 1.0-cy-0.120) glVertex2i(0,0) glTexCoord2f(cx+0.0625, 1.0-cy-0.120) glVertex2i(16,0) glTexCoord2f(cx+0.0625, 1.0-cy) glVertex2i(16,16) glTexCoord2f(cx, 1.0-cy) glVertex2i(0,16) glEnd() glTranslated(10,0,0) glEndList() the problem is in the function glprint. i can see the text and it works really fine in linux but just as i said before when i run this python code in windows.. it crashes and give me that error msg about unsigned int. anyone knows how can i fix this? thanks in advance
  13. hello all. i'm using PyOpenGL in python and i'm trying to find a nice printing text tutorial but i cant seem to find any. and finally when i found that i need to use opengl.wgl (and thats all i found) it doesnt work.. i cant import it for some reason and i already downloaded Pygame and PyOpenGL any idea why this isnt working? any good tutorial for PyOpenGL for it? thanks in advance Edit: here is the error from OpenGL.WGL import * File "/usr/lib/python2.4/site-packages/OpenGL/WGL/__init__.py", line 2, in ? from WGL__init__ import * ImportError: No module named WGL__init__
  14. nvm i found the problem :D [Edited by - mc30900 on October 1, 2006 8:28:09 AM]
  15. hello all. i'm currently using KDevelop in linux. i'm trying to compile a program which uses sdl and opengl but i get some errors and i have no idea why (mybe i forgot to link somthing?) here are the errors: ad.o: In function `LoadGLTextures()':/home/yhonatan/ad/src/ad.cpp:161: undefined reference to `gluBuild2DMipmaps' ad.o: In function `resizeWindow(int, int)':/home/yhonatan/ad/src/ad.cpp:191: undefined reference to `gluPerspective' and here are my includes: #include <stdio.h> #include <stdlib.h> #include <GL/gl.h> #include <GL/glu.h> #include "SDL.h" and this is what i give to the linker: -lSDL -L/usr/lib -lGL -L/usr/include/GL what am i doing wrong? or what should i add? thanks in advance.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!