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

learn more… | top users | synonyms

2
votes
3answers
68 views

Hero made of parts 2d rotation

I have a problem with rotation of my hero in 2D space. The hero is made of body parts such as: head, arms etc. Every part is a separate sprite. When I want to rotate the hero, I have to rotate all ...
2
votes
1answer
28 views

change animations when touch sprites

In the following function I want to change the animation when I touch on the button. But the game crash and exit. What's wrong with this code ? bool GameScene::onTouchBegan(cocos2d::Touch *touch ...
2
votes
1answer
68 views

Box2d C++ x velocity slowing for no apparent reason

I'm making a 2d platformer in C++, using Box2d for physics and sfml for rendering, I want the player character to move with a constant velocity in the x direction, and to jump when the spacebar is ...
1
vote
1answer
70 views

Space invaders implementation

I'm just wondering about the implementing of the collision response of bullets and the fours obstacles. https://www.youtube.com/watch?v=LCNTwG3MGEg When a bullet hit, a one black pixel is ...
1
vote
2answers
76 views

Collision detection between triangle and polygon

I have some difficulties to understand how to be sure if there is a collision between a space ship (black) and an asteroid (in blue). A space ship is placed on a case and an asteroid comes from the ...
1
vote
1answer
35 views

Getting a reference to an object/blueprint in the scene/game world

I'm coding a simple maze game in UE4 and I have everything I wanted to implement done except having an obstacle in the scene. What I have is a simple Obstacle class which is a child of an Actor class. ...
-1
votes
0answers
20 views

SFML draw throws exception [on hold]

Whenever I try to call the draw function (RenderWindow), I get an unhandled exception: Unhandled exception at 0x74A0C9F1 in Shard.exe: 0xC0000005: Access violation executing location 0x00000000. ...
0
votes
1answer
177 views

filling the empty spaces in a certain region in a grid using c++

Hi guys i am struggling to find the optimal way to fill the grid of a certain region. In the above example lets say my player is at (7,5) and traveled (2,0) and i have the information of all the ...
0
votes
1answer
100 views

Animation, Interpolation, & Structure

I have been working on animation in my small game engine recently and I am implementing some interpolation to be used with skeletal animations. I know how to do interpolation but I am not sure where ...
1
vote
1answer
52 views

Using GetTickCount (to shoot missiles) [on hold]

I have some difficulties to understand how to correctly use GetTickCount() as I have some problems in my little game. I have to place on a case a space ship. This one will shoot with a certain ...
0
votes
0answers
16 views

Naming problem with method that visualise the unrenderable objects (helpers) [on hold]

I'm creating some game engine in C++. I am stuck with the naming problem. I know that some of you think it's not so big deal, but badly named things = things that will mislead you in future (bad ...
3
votes
1answer
96 views

Why is my DX9 render target restricted to 512×512?

When I use a render target higher in resolution than 512×512, I receive an image with black borders, depending on how big this texture was. Why is this? How can I fix it? Here's how I create the ...
0
votes
1answer
62 views

c++ - collision detection/resolution clipping

I'm trying to implement a collision detection system, and it is working for the most part, no overlapping (or at most very little overlapping) of characters, and wall collisions. The problem is that i ...
1
vote
1answer
134 views

2D Collision Resolution getting stuck on walls

I've been writing this collision detection system using a tutorial from an article I read and I just cannot for the life of me get it to function 100% correctly. Here's the code for starters: ...
1
vote
1answer
144 views

Firing bullets with a time interval between them [duplicate]

How can I make my enemies shoot bullets in intervals? I already have the enemy shooting bullets, however my problem is that it shoots the next bullet instantly, making it look like a line instead of ...
4
votes
3answers
113 views

How to handle multiple events in SDL2 and C++?

I'm working on an entity component based game and I ran into this problem. I've got a component called PlayerControlComponent: void PlayerControlComponent::HandleInput() { SDL_Event event; ...
0
votes
1answer
109 views

DirectX9 Drawing Sprites out of place due to offset

This is my very first time into DirectX. Im trying to make a simple 2D game, just for learning the basics. And i've achieved that. The next step is to draw an animation using sprites. For that, i ...
6
votes
2answers
3k views

How do I load textures with SFML for OpenGL?

I'm looking at NeHe's texture mapping tutorial. It looks overly complicated for just loading a texture. Is there a way to load a texture in SFML and then use it in Open GL? I use SFML for my ...
3
votes
2answers
611 views

How can I keep a GUI on-screen without moving/resizing it according to camera motion?

I'm trying to make a GUI library with SFML, and everything's done except for one problem: making the interface stay still even when the camera moves or zooms in and out. This would be easy to fix if ...
4
votes
2answers
355 views

Is there an alternative to VBOs or deprecated functions to draw many small quads?

I was thinking about how to program a user interface in a 3D game. The problem is, immediate mode (glBegin and glEnd) is deprecated for a long time but I don't think vertex buffer objects (or arrays) ...
4
votes
2answers
92 views

Stroring components in arrays (entity component system)

I'm looking for ways to improve my ECS and I've seen many people suggest storing components in arrays. This seems great, considering fast access for a component using entity id and more importantly, ...
0
votes
0answers
26 views

Do i need any extra libraries apart from sdl and box2d? [closed]

I'm planning on creating a 2d game. I must say I have no experience with this apart from a few pygame tutorials(sdl binding for python). So, if I want to create a 2d sidescroller game with ...
2
votes
1answer
657 views

Improving Click and Drag with C++

I'm currently using SFML 2.0 to develop a game in C++. I have a game sprite class that has a click and drag method. The method works, but there is a slight problem. If the mouse moves too fast, the ...
2
votes
2answers
91 views

How to get a component from an Entity?

In my Entity class I've got a function that returns a specific component, that looks like this: template<typename ComponentType> ComponentType* GetComponent() { for(unsigned int i = 0; i ...
5
votes
2answers
299 views

Lua Implementation

I'm struggling to get Lua implemented into my game engine. I've read dozens of blogs and articles revolving around how to wrap C++ classes and I seem to have hit a wall. No matter how I structure the ...
1
vote
1answer
44 views

CopySubresourceRegion results in no-op

I'm having some trouble copying a subregion from a source texture (2D) to a destination texture. Both textures are mipmapped 2D textures, with dimensions (at mip 0) of 512 x 32. Rather than tell you ...
1
vote
1answer
267 views

Calculating shadowmap coordinates for cubemap in shading pass?

I'm trying to implement shadow mapping with cube maps. I believe I've done the first stage by filling the cube map, but for the final shading pass I am unsure how to exactly calculate the cubemap ...
0
votes
2answers
45 views

Undefined reference error when trying to access a component using ECS [closed]

I'm trying to access the x and y values from PositionComponent in my MovementComponent but I get this error and I just can't figure out why I get this. in my Entity class I've got a function ...
0
votes
0answers
8 views

Fill color in moving object without flickering [duplicate]

Here is my code in which moon is moving around earth but now i want to fill moon and earth with color and also want to remove flickering in the moon while moving. Please help me, i will be very ...
0
votes
1answer
185 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 = ...
3
votes
1answer
221 views

How do I handle rope physics with fixed ends and a sliding weight?

I've been interested in rope physics recently—I've successfully implemented a simple Verlet rope with moveable ends. Now I am trying something a little different: I want to start by recreating the ...
1
vote
1answer
59 views

How can I stop my collision detection from registering multiple times per frame?

I am working on a side-scroller shooter right now. Everything is working fine along with the collision detection however, my problem is that the collision triggers my health deduction code multiple ...
4
votes
1answer
259 views

C++ OpenGL ShadowMap Issue/Artifacts

I am currently implementing basic shadow mapping in my C++ Custom Engine using GLSL 4.10. It is currently working with basic PCF anti-aliasing and very minimal reduction for unwanted artifacts. Here ...
2
votes
2answers
109 views

Intersection between moving circle and some squares

I'm developing a 2D game made of squares. What I need to do is check if a circle collides with any of the squares as it moves. I have a raycast function to check the same idea, but using a point. I ...
13
votes
1answer
558 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 ...
3
votes
2answers
613 views

Decomposing a concave mesh into a set of convex meshes

I'd like to be able to decompose a concave mesh into a set of convex meshes for 2 reasons: Transparent rendering Physics shapes Is there an algorithm that takes a set of triangles (concave) as ...
0
votes
3answers
70 views

Logic level representation that distinguishes “<<under>> and <<above>> the bridge”

I have an logic level/map representation for a 3D game that uses vector<Area> where: class Area{ vector<Point2D> bounding; //determines the shape of the Area, its borders ...
0
votes
1answer
68 views

AABB swept collision response with voxel world

I followed this tutorial: link and I was able to make it work with 3d voxel world collisions. But the problem I have is with collision response. I want to make player slide against the wall if he is ...
3
votes
2answers
1k views

FBX Importer - Texture Name

I have a problem with the FBX SDK. I read in the data for the vertex position and the uv coordinates. It works fine, but now I want to read for each polygon to which texture it belongs, so that I can ...
0
votes
1answer
53 views

Rectangle collision in SDL2 partially allowing sliding C++ [closed]

I am working on a game in SDL2, in which the player needs to be able to slide along walls, but NOT go through them. I've read up on things like Quadtrees, and this stackoverflow question ...
1
vote
1answer
56 views

Where should I put the SDL_Renderer* using the ECS with SDL2 and C++?

So I'm still learning about ECS (Entity Component System) and whenever I'm thinking about the architecture and actual implementation, I just can't figure out where should I put the SDL_Renderer*. So ...
0
votes
1answer
69 views

accelerated curved bounce

I'm trying to make a simple pong clone and want the ball to curve when the racket was moving on hit. To test out curves I removed all the rackets and just have a ball bouncing around in a rectangle, ...
0
votes
1answer
106 views

How to render a vertex buffer in DirectX11 C++ (specifically with box2d's b2Draw)

I have all the DirectX11 devices etc setup and working with DirectXTK's SpriteBatch and currently attempting to implement a b2Draw class to draw my box2d physics worlds. I have little idea on how to ...
1
vote
4answers
94 views

How to order points on a 3D grid such that we can connect them in a line loop correctly

I want to recreate an effect as close as possible to X-Com: Enemy Unkown's movement range feedback: The blue line delimits the tiles which the soldier can reach using a single action. We also are ...
0
votes
1answer
60 views

Directx: HLSL Texture based height map. (Shader 5.0)

I'm trying to implement a GPU based height map the simplest (and fastest) way that I know how. I passed a (.png, D3DX11CreateShaderResourceViewFromFile()) texture into the shader, and I'm attempting ...
0
votes
1answer
278 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
104 views

Randomize and display sprites in a 4x6 grid - Cocos2d-x

I am creating a card matching game. I have a vector that stores 16 unique cards. I am trying to randomize the order and select only the first 12 cards, then setup in a 4x6 grid for a total of 24 ...
3
votes
2answers
551 views

Optimal OpenGL 2D Sprite Batching (Best Practice)

I am working on simple 2D engine using OpenGL (3.3+) for rendering and was wondering what the optimal method of sprite batching would be. I plan to put all sprites into one (or fewer) texture atlases. ...
3
votes
2answers
101 views

Sound Synthesis from object collision in Virtual Reality Environment

I have a project whose subject is "Sound Synthesis from object collision in Virtual Reality Environment" First of all, I have to define some objects with certain attributes (like shape, mass, ...
0
votes
0answers
41 views

OpenGL Occlusion Culling - flickering problems

I have implemented occlusion culling in my app and I think why the problem is happening but I am not sure how to solve it. My scene is divided in different chunks (voxels) and I am rendering each ...