C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

learn more… | top users | synonyms

0
votes
0answers
68 views

Error while loading PNG file with SDL2

I have been building a small game using SDL2 and C++ and started getting a weird error when trying to load a PNG. The error reads: libpng warning: Out of memory libpng error: IDAT: insufficient ...
1
vote
0answers
65 views

How to rotate enemies on 2D radar and clip them to circle shape? [duplicate]

I've been working on implementing a 2D radar for a 3D game lately, it's working fine in a very basic version. This is what is looks like: It works by transforming the 3D coordinates of the enemies ...
0
votes
2answers
159 views

What does “~” in front of a function name inside a class mean? [closed]

I added a class using the 'add class' item in Visual Studio Express and it generated two functions in the .cpp file with the same names. But the second has the ~ character in front of it. What does ...
0
votes
1answer
113 views

Rendering multiple meshes in directx11

Recently I have tried adding rendering with multiple meshes in my program. This did not go too well. The attempt I currently have goes like this bd.Usage = D3D11_USAGE_DEFAULT; bd.ByteWidth = ...
-1
votes
1answer
91 views

How to encode game files or pack to one file like game_data.dat [duplicate]

I am a beginner C++ programmer. I am creating a custom Open Tibia Server and I use the alternative Tibia client (OTClient). I want encode game files (image, sound, lua, etc.) or pack all files into ...
0
votes
2answers
64 views

Disable lighting in DirectX10

I'm implementing a D3D10 version of my renderer (not porting to avoid losing Windows XP support). I didn't go straight to D3D11 because MSDN and other sources recommend upgrading to 10 and then to 11. ...
0
votes
1answer
68 views

Playing a sprite sheet animation in Cocos2D-x

I'm trying to create an animation using a sprite sheet in Cocos2D-x. I'm doing the following. The game doesn't crash but the screen is still blank. bool HelloWorld::init() { ...
0
votes
1answer
53 views

Computing Field-of-View from window dimensions

I'm looking into computing the vertical Field-of-View (FOVy) based on the projection parameters of my camera. From this source, I've found an equation that seems to work. float ...
3
votes
2answers
96 views

How to detect Lagoons and Lakes on a random Island Map

I have an engine which generates random Islands. At the moment it tends to generate quite a lot of lagoons and lakes. I would like to know of a feasible way of detecting them so that I can mark them ...
0
votes
0answers
14 views

How can I animate a sprite in cocos2d-x 2.2.1 c++? [duplicate]

Is there a way to do an animation without a .plist file? I'm having a hard time doing swap animation with sprites. For example, doing an animation while the user is not doing touches and the other ...
2
votes
1answer
73 views

Informing objects within a particular state of the world state

Following the State pattern, every state in my game is a derived object that reflects a particular segment of the game (MenuState, PlayingState, GameOverState, etc.) Each of those state objects holds ...
1
vote
2answers
254 views

Entity Component System Coupling

Lately I've been working on a small personal project which is basically an Entity Component System framework with autoupdated Systems. While I have a pretty good idea on the way the framework should ...
0
votes
2answers
239 views

Is it possible to use C++ with Unity instead of C#?

The title kind of says it all. Is it possible to replace C# with C++ on a game using Unity?
1
vote
1answer
58 views

Compute billboard rotation

I'm trying to compute a matrix to have object always facing the camera. For the moment, my result look pretty good, the problem is that my original billboard scale isn't preserved (Every billboard ...
2
votes
1answer
173 views

Anti-Aliasing in OpenGL [C++]

I'm trying to make anti-aliasing work inside of OpenGL, here's what I've tried: glEnable(GL_POINT_SMOOTH); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glEnable(GL_LINE_SMOOTH); ...
1
vote
1answer
120 views

C++: Checking if an object faces a point (within a certain range)

I have been working on a shooter game in C++, and am trying to add a feature whereby missiles shot must be within 90 degrees (PI/2 radians) of the direction the ship is facing. The missiles will be ...
0
votes
1answer
64 views

Proper way to encapsulate a Shader into different modules

I am planning to build a Shader system which can be accessed through different components/modules in C++. Each component has its own functionality like transform-relevated stuff (handle the MVP ...
0
votes
0answers
57 views

C++ OpenGL trouble trapping cursor in window

I am using OpenGL and I try to trap my cursor inside my game window (using both SetCursorPos and ClipCursor) But, these conflict with my camera rotation code as my camera is rotated with ...
0
votes
1answer
43 views

speed up the update of glutidle()

I have a client that sends data at 1KHz (i.e. 0.001 sec) to a master over Internet using UDP protocol. In Master, I need to draw an object, but the problem is that the update of GLUT is slower than ...
7
votes
2answers
224 views

How do I find the closest points(thereby forming a polygon) enclosing a particular point?(see image)

I am working with a game engine, and my task is to add code for simulating fracture of rigid meshes. Right now I'm only working on breaking a cube. I am using Voronoi's algorithm to make a ...
3
votes
1answer
152 views

How do I render from one render target to another?

I have two render targets: a fake backbuffer; a special render target where I do all my rendering. a light render target; where I render my light fx. I'm sure I'm rendering correctly on both. The ...
11
votes
1answer
415 views

How are entity systems cache-efficient?

Lately I've been doing a lot of reading on entity systems to implement in my game engine (C++/OpenGL). The two key benefits that I constantly hear lauded about entity systems are 1) the easy ...
1
vote
2answers
88 views

OOP Question for Team System

I'm not quite sure right how I should create my "Team System". Lets say I have 2 teams with 4 players in there. The teams are Team Blue and Team Red. A team knows the amount of its members, the amount ...
-1
votes
1answer
78 views

Smooth radial collision

I'm trying to make collisions smoother in my game. Currently, entities will stop completely when they collide with an obstacle. I saw the following article recently: ...
1
vote
2answers
197 views

How to detect graphics API at runtime with SDL2?

Using SDL2, is there a way to determine at runtime whether the application is using OpenGL, OpenGLES, or DirectX? EDIT: If there is a way to figure it out without using the SDL2 API, I'm willing to ...
2
votes
0answers
40 views

How to raycast against a physx cloth mesh?

I'm using the PhysX 3.3 SDK in a application and mostly everything is working fine. However, I'm trying to develop a feature that would allow users to click on various actors in the scene and modify ...
0
votes
0answers
39 views

How do I update a static mesh in Unreal 4 during movement?

I would like to use UE4 for rendering of a huge world. During the runtime, I would like to load a mesh from a custom source and adopt the mesh in the game. Could someone give me a hint how to do this ...
-3
votes
1answer
128 views

Rotate camera with mouse? [closed]

Once again, using tutorial 10 at NeHe. I want the code if (keys[VK_RIGHT]) // Is The Right Arrow Being Pressed? { yrot -= 1.5f; // Rotate The ...
1
vote
1answer
135 views

Game development for high-school with C++ and OpenGL [closed]

I've been teaching high-school students (12th grade) game programming in the last 2 years. The way I did this till now, was first to give them "half made" classes (for Point, Polygon, etc.) and ...
0
votes
2answers
75 views

Why can't I load an image with a relative path in SDL2 on Linux?

When loading a texture in SDL2 the general procedure is this: SDL_Texture* texture = IMG_LoadTexture(renderer, "resources/images/image.png); However this doesn't work and I have to supply the WHOLE ...
0
votes
1answer
66 views

Algorithm for texture blending modification

Im currently writing a terrain editor for my game (for the record: no commercial intentions) and after having implemented the terrain morphing to my liking im now working on the texturing of said ...
0
votes
1answer
94 views

C++ OpenGL / SDL2 VBO — Depth problem / Transparency

I got a problem with my VBO. When having textures. The far blocks overlay the near ones. I tried editing the alpha, depth buffer, the VBO byte allocation. Nothing works for me... The FAR plane is ...
0
votes
0answers
34 views

How to run C++ functions from other files [duplicate]

I want to set up my game engine I'm making to essentially load C++ code from another file, and to load initialization variables from those files also. I was thinking a system that has files that store ...
0
votes
0answers
47 views

How does character creation work in 2D games? [duplicate]

My question is how does character creation work in (multiplayer) 2D game? For example player wants to have long yellow hair, black armor and white leggings. What should I do? Already have all ...
1
vote
1answer
110 views

How to implement camera pan like in Maya?

I am trying to implement camera pan like the one in Maya. I've got it almost working. The problem is that the mouse cursor is moving faster than the 3d mesh (in fact I am moving the camera but I ...
1
vote
1answer
70 views

Geometry Shader only creates one primitive

I am currently trying to use the geometry shader. My input is a set of points, for which multiple triangle should be created This is the geometry shader #version 330 layout(points) in; ...
1
vote
0answers
112 views

implementing shadows into my 2D GLSL-based lighting system

I'm writing a lighting system in OPENGL using GLSL shaders, and I'm pretty happy with the light casting I have so far, but I'm totally stuck on casting shadows. Everything I've found online on this ...
0
votes
1answer
158 views

post on Facebook from cocos2d-x on windows phone

Is it possible to share/post on Facebook from cocos2d-x on windows phone. Is there any example/tutorial available.
0
votes
1answer
146 views

Surface creation algorithm using points cloud

I am looking for a realtime algorithm to create a 2D mesh using points. But I am quite confused. It seems that Delaunay triangulation can help me create mesh using point clouds, but Meta-balls seems ...
2
votes
1answer
194 views

Emscripten code and three.js

I would like, if it's possible, to use Emscripten code generated from C/C++ with the Javascript library three.js. For example, from emscripten code I want to pass rendering information to the three.js ...
1
vote
2answers
149 views

What torque should I apply in Bullet to maintain a vertical orientation?

I have a RigidBody in Bullet. Each frame, I want to apply torque to correct its orientation toward an upright position (i.e. near-zero pitch and roll). I know its angular velocity and orientation. ...
0
votes
1answer
84 views

What's the most efficient way to deal with in-game messages in Allegro 5?

I have a little 2D game made with Allegro, and I want to introduce strings during gameplay. For example, I've just made it so a key is needed to open a door, so I'd need some tutorial text to appear ...
1
vote
1answer
77 views

Henry Hatsworth kind of blocks minigame, std::vector sorting or alternative?

I'm not sure if this is the right place to post this, or if I'm doing it right. But I believe I've kept to the rules. If not, please let me know and I'll remove my post or edit it accordingly. I'm ...
0
votes
0answers
191 views

Procedural Tilemap generation

So i'm building a 2d game but i have never really done any procedural generation i followed the SFML tutorial for tilemaps and i have the maps loading what i know want to know is how can i convert the ...
0
votes
1answer
72 views

Mesa: Howto enable OpenGL 3.x functionality via extensions?

How can I enable OpenGL 3.x functionality via extensions? I'm new to OpenGL development under Linux. Currently I have: #define GL_GLEXT_PROTOTYPES #include <GL/osmesa.h> #include ...
1
vote
2answers
100 views

How do I create a sound manager? [closed]

I have a basic entity system in place. Now I want to add audio. I want to make a database class that watches over entities, pulls data out of them, and creates audio streams whenever necessary. I'm ...
0
votes
2answers
198 views

UDP Netcode Architecture for Fighting Game

I am programming a fighting game that uses a UDP client/server architecture for multiplayer. The server can handle multiple clients, two of which (or one being the server) are playing and the rest are ...
0
votes
1answer
101 views

How to prevent a circular dependency between an entity and its state? [closed]

I've read this question, and I think it has some good answers and discussion, but it appears to focus primarily on rendering. I have a different problem in the management of a game entity's state. ...
0
votes
1answer
99 views

Looking for a full featured C/C++ UV Mesh Unwrapper [closed]

My first question! Is there an open source C++/C piece of code easy to integrate to solve the UV Unwrapping of arbitrary meshes out there ? I would like to use it to build a light mapper or similar ...
0
votes
1answer
143 views

3D picking for mouse move event

I implemented color picking recently and I would like to use it as kind of highlight when mouse is over an object but I am concerned about performance. Color picking requires whole frame to be drawn, ...