Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 15 Mar 2013
Offline Last Active Apr 12 2015 01:50 PM

#5051318 Add Object to Array from Constructor

Posted by on 08 April 2013 - 04:20 PM

Alright. That's great. Thank you. You've been a great help. 

#5051299 Add Object to Array from Constructor

Posted by on 08 April 2013 - 03:02 PM

Thanks for the help. I was actually considered using std::vector, and now that you mention it, it would be very useful when deleting objects. The array I created wasn't part of the object, I just needed it to be modified from within the Object class. I assume that if the vector is of actual objects and not pointers, it wouldn't make sense to add objects to the array in the constructors and end up having duplicates of all objects (those created normally and those then added to the array), but simply create the objects in the array, is that correct? 


And thanks again for the help

#5043687 how to use glVertex with screen coordinates

Posted by on 16 March 2013 - 08:54 AM

You can use gluOrtho2D() (if you want it to be 2D) to set the window coordinates to whatever you like. 


gluOrtho2D (0, 600, 0, 300); for example would set the window coordinates to 0,0 at the bottom left, and 600,300 at the top right. 


Could do something like this.
int width = 600;
int height = 300;
glutInit(&argc, argv);
glutInitWindowSize(width, height);
gluOrtho2D(0, width, 0, height);
(void)glutCreateWindow("GLUT Program");


The first parameter in gluOrtho2D is the value of the x-axis at the left, the second at the right. The third is the value of the y-axis at the bottom, the fourth at the top.


Hope that helped.

#5043427 Advice on 2D games

Posted by on 15 March 2013 - 10:22 AM

Well I haven't been this for very long, but I'm currently making 2D games in C++ using OpenGL as the graphics server. OpenGL is fairly easy to use and cross-platform, and there are loads of tutorials out there to help wrap your head around how it works and libraries to download if you need them. 


The OpenGL library I'm currently using can be found here. But whether you'd want to use that or not would also depend on what language you'd prefer to code in. 


Hope that was some help.