Tag Info

Hot answers tagged

12

The two key benefits that I constantly hear lauded about entity systems are 1) the easy construction of new kinds of entities due to not having to tangle with complex inheritance hierarchies, and 2) cache efficiency. Note that (1) is a benefit of component-based design, not just ES/ECS. You can use components in many ways that do not have the "systems" ...


4

"My goal was to teach them the fundamentals of C++ using OOP", following this, I think you're making the right choice. I find the OpenGL API doesn't lend itself to OOP( in the programming sense, anyway ) very well. I'm surprised you're even exposing 12th grades to C++ and OpenGL. Most university courses I've seen avoid both of these like the plague. So, ...


3

Take the following relations into account A team has players Team Red is a team A player is associated with a team So, the following approach should give you a good hint. Team Red and Team Blue are instances of a team, with the same attributes but they just differ in values. Unless you need to implement different behaviors (member functions) for each ...


2

You should not mix the view which defines how things look, like the teams' HUDs with the teams' model, their data structure or class instance. Like @pctroll said, the teams could be instances of a Team class. In my opinion, the Team class should simply be a glorified array of players and some methods that tally up score. The player class should have a ...


2

Following the half-plane method, you'll have found the line segments to every other point and the perpendicular bisectors of each of those which you then intersected to find potential vertices of the Voronoi cell. Now, you want to exclude the ones that intersect any of the "distant" half-planes formed by the bisectors. I coloured the "distant" ...


2

You may simply iterate over edges and filter out all vertices that are not in same half-plane with point of interest. As optimisation, iterate from nearest edges to farthest. I think you may even filter vertices while generating slices. It is like slicing pie with endless knife, until only small piece left with cherry on it. If you like analogies. Just cut ...


2

With anything more than trivial rendering, you cannot realistically aim at having 1000+ fps framerate. Besides, that does not makes sense if you think about it - your display refresh rate is probably only 60Hz. Instead you need to rethink your approach. So data can be displayed at 60fps max. The rest just needs to be discarded. Can you do that before ...


2

Once upon a time there was Google. Now this seems to be what you are looking for: const char* SDL_GetCurrentVideoDriver(void) Returns the name of the current video driver or NULL if no driver has been initialized.


1

If you want to do it using Win32 API then here's code : // the Windows Procedure event handler LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { case WM_MOUSEMOVE: // save old mouse coordinates oldMouseX = mouseX; oldMouseY = mouseY; // get mouse coordinates from Windows mouseX = ...


1

In SDL2 the creation of the window is separate from the rendering environment used to draw into that window. So, while you might pass "SDL_WINDOW_OPENGL" to SDL_CreateWindow(), this simply states that the window should support rendering from an OpenGL context later down the line and doesn't actually create an OpenGL context at that point. So, from ...


1

I think your playerRadius is twice as big as it should be. Your vectorToCentre is measured from targetCentrePos, but you use the full width() or height() of playerBoundingRect to determine radius. I suggest this change: const qreal playerRadius = qMax( playerBoundingRect.width() / 2, playerBoundingRect.height() / 2);



Only top voted, non community-wiki answers of a minimum length are eligible