Jump to content
  • Advertisement

SomeoneX

Member
  • Content Count

    43
  • Joined

  • Last visited

Community Reputation

120 Neutral

About SomeoneX

  • Rank
    Member
  1. SomeoneX

    Windows vs. Ubuntu

    Just going to step in and provide my point of view. I used both Windows and Linux, although since Linux is on my laptop and I don't want to bring my desktop to college for security and size reasons, I end up using Linux a bit more. Anyways, to my actual point, what operating system you write a bunch of words on doesn't matter. You can also cross-compile from either, so I would worry more about what text editor, IDE, compiler, etc. you will use. If you want advice, I would say try Linux while starting your game on Windows. Later, if you're comfortable with Linux, you can decide if you want to switch.
  2. SomeoneX

    C++ inheritance

    I know that. I just tried protected and.... it worked? I clearly remember it failing when I used it in another project. Looks like I should double-attempt some things before asking... Let me just confirm with you guys: protected allows sub-classes access, but only them, right?
  3. SomeoneX

    C++ inheritance

    I don't have the code for the original private variable inheritance problem, but I was able to duplicate it. Here is the code class ObjectA { private: int a; public: ObjectA() {a = 10;} virtual ~ObjectA() {}; }; class ObjectB: public ObjectA { private: int b; public: ObjectB() {b = 10; a = 5}; virtual ~ObjectB() {}; }; int main() { ObjectA oa; ObjectB ob; } I am using g++ 4.3.3, and the errors I received are: test.cpp: In constructor ‘ObjectB::ObjectB()’: test.cpp:4: error: ‘int ObjectA::a’ is private test.cpp:16: error: within this context test.cpp:16: error: expected `;' before ‘}’ token
  4. SomeoneX

    C++ inheritance

    Well I've been doing C++ for a while, but I keep getting hung up on inheritance. I can do the basic things, but there is some I don't know, and some I'm sure I've learned wrong. First off, inheriting variables. I have tried using all three settings (public, private, protected), but I can only use public ones in the sub-classes. I thought protected could be inherited as well? The problem is that I want most variables to stay private, however if I plan on having them inherited I have to make them public. I know there is a way to get around this, but google couldn't help. Secondly are virtual destructors. Before I go about using them I just want to ask, does it only execute the one destructor or does it go up the classes executing them? For instance (incomplete code) class ObjectA { private: int* A; public: virtual ~ObjectA() { delete A; } }; class ObjectB: public ObjectA { private: int* B; public: virtual ~ObjectB() { delete B; } }; When ObjectB is destroyed, is the base ObjectA (and therefore A) destroyed as well?
  5. SomeoneX

    Collision Detection with Different Shapes

    Woops, double post. Ignore this one.
  6. SomeoneX

    Collision Detection with Different Shapes

    Quote:GJK is pretty involved (and can be a little non-intuitive as well). There are some good references on the subject, though. Gino van den Bergen's book in particular is good, although it's pretty math- and theory-heavy. I'm fine with something being math and theory intensive, I was just wondering if there was a reference that just taught the specific parts of the various maths needed for the algorithm. Quote:Perhaps you could tell us what shapes you're interested in supporting, whether you need to perform continuous (swept) tests, and what information you need the test to return (e.g. time of intersection, contact manifold, etc.). Based on that, we can recommend some other algorithms to look into. Well it's 2D collision detection for a shoot 'em up. The shapes would be polygons and circles (or an approximation of them) such as squares, triangles, stars, etc. The test needs to be done every frame, and it just needs to return that a collision happened. I was originally thinking of doing collision detection by putting the hitboxes onto a different image or plane, and checking for pixel overlaps, but since they can be moved at any direction, pixel by pixel detection wouldn't work as well as I want it... I think.
  7. Well the title says it all. I know how to do collision detection with circles and squares (that aren't at an angle), but I want to be able to do more than that. I've done some google searching and found the Gilbert-Johnson-Keerthi algorithm, and while it seems to be what I need... I think some important maths were looked over in my high school curriculum... namely Vector math. Now my two specific questions: 1 - Is there a simpler definition (or one that explains more on the assumed knowledge) of the GJK algorithm? 2 - Is the GJK algorithm the only algorithm that can do this? Am I even right in assuming that it can?
  8. SomeoneX

    OpenGL - problem drawing both 2D and 3D

    Quote:Original post by Badgerr The only problem I can see is this: *** Source Snippet Removed *** Woops. Figures I'd pull something like that. Sadly, it didn't fix the problem.
  9. SomeoneX

    OpenGL - problem drawing both 2D and 3D

    deadstar - Neither of those worked. Only other code I can think of that could help is the initializing. Window::Window(int w, int h, int b): WIDTH(w), HEIGHT(h), BPP(b) { SDL_Init(SDL_INIT_VIDEO); flags = 0; const SDL_VideoInfo* v_info = SDL_GetVideoInfo(); if(v_info != NULL) { if(v_info->hw_available) { flags |= SDL_HWSURFACE; } else { flags |= SDL_SWSURFACE; } if(v_info->blit_hw) { flags |= SDL_HWACCEL; } } flags |= SDL_OPENGL; flags |= SDL_GL_DOUBLEBUFFER; flags |= SDL_HWPALETTE; SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); screen = SDL_SetVideoMode(WIDTH, HEIGHT, BPP, flags); glShadeModel(GL_SMOOTH); glClearColor(0.0, 0.0, 0.0, 1.0); glClearDepth(1.0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, double(WIDTH) / double(HEIGHT), 1.0, 100.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }
  10. SomeoneX

    OpenGL - problem drawing both 2D and 3D

    void Begin_2d() { glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0, 800, 0, 600, -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); } void End_2d() { glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } They were the ones that were posted on GameDev before. Everyone has been saying they work, so I don't think they're the problem, unless I put them in a bad spot.
  11. Before you ask, yes I read the thread about doing 2D in OpenGL. Right now I'm just trying to get this working, from there I'm 99% sure I can finish it. I'm trying to draw a 3D background with a 2D section on top. I'm not quite sure what's wrong, but the 2D part won't draw. I can't really explain, so here's the drawing code: void Draw() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslated(0.0, 0.0, -5.0); glBegin(GL_LINE_LOOP); glColor3d(1.0, 0.0, 0.0); glVertex3d(-1, -1, 0); glColor3d(0.0, 1.0, 0.0); glVertex3d(-1, 1, 0); glColor3d(1.0, 0.0, 0.0); glVertex3d(1,1, 0); glColor3d(0.0, 0.0, 1.0); glVertex3d(1, -1, 0); glEnd(); Begin_2D(); glTranslated(400, 300, 0); glColor4d(1.0, 1.0, 1.0, 1.0); glEnable(GL_TEXTURE_2D); //glBindTexture(GL_TEXTURE_2D, texture); glBegin(GL_QUADS); /*glTexCoord2d(1.0, 0.0);*/ glVertex2d(32, -32); /*glTexCoord2d(1.0, 1.0);*/ glVertex2d(32, 32); /*glTexCoord2d(0.0, 1.0);*/ glVertex2d(-32, 32); /*glTexCoord2d(0.0, 0.0);*/ glVertex2d(32, 32); glEnd(); glDisable(GL_TEXTURE_2D); End_2D(); SDL_GL_SwapBuffers(); }
  12. SomeoneX

    Overkill?

    I haven't used Allegro, so I'm going to say you could check out SDL too. It's fairly simple and is able to do graphics, sound, input, etc. After a quick Google run, SDL and Allegro look fairly similar, so you could check out both and see which you like.
  13. SomeoneX

    Managing Inventories

    Well an array is definitely one approach. As for drawing it in a certain position... I can't think of just one way. You might make it a 2d array and draw based on their literal positions, or do a 1d array and draw them as actual items appear (could have blank spots, unless you make functions to organize and such). Hell you could make a 3d array and split the inventory up by categories, going with the 2d array but adding different pages for the 3rd dimension. That's all fine and dandy if you want a cap on the number of items. You could also use vectors, although depending on how comfortable you are with them it could be hell. I'm stopping myself before this turns into a long rant. Essentially, if it works like you want it to, stick with it.
  14. I put in my vote for Code::Blocks. Haven't used Visual Studio much until recently, and it's... not as spectacular as I was hoping. Besides, Code::Blocks is completely free of charge, since it uses GCC and GDB. Haven't used the VS debugger yet, but I've fixed all of my problems with the GDB. Both have similar GUIs (in my opinion). Code on the right, project tree on the left, various information below. Personally, I don't like some of the wording in VS. "Solution" is one used throughout the whole program that sounds like they picked it out of a hat. Just find what works for you, you can use both for free (Express for VS, Code::Blocks comes free).
  15. Well for books Thinking in C++ (1 and 2) are great once you have a basic knowledge. I personally used Sams Learn C++ in 21 Days. It was alright for learning it, but I'm sure there are better books to learn from. www.cplusplus.com is a great reference for the standard library and such. Again, this is probably better for when you at least have the basics down.
  • 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!