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

learn more… | top users | synonyms

1
vote
1answer
33 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
57 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
31 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. ...
0
votes
0answers
17 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 ...
0
votes
0answers
12 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. ...
1
vote
1answer
50 views

Using GetTickCount (to shoot missiles)

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
15 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 ...
0
votes
1answer
60 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 ...
4
votes
3answers
108 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; ...
3
votes
1answer
95 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 ...
3
votes
2answers
352 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) ...
0
votes
0answers
24 views

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

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 ...
3
votes
2answers
83 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, ...
2
votes
2answers
89 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 ...
-1
votes
0answers
34 views

A program in OpenGl [closed]

I wrote a program in C++ OpenGl which to insert a special character to the display window display for entering characters ... for example by enter 'A' character the open windows shows A . but i don't ...
-1
votes
0answers
32 views

Having an issue with generating chunks in a voxel engine [closed]

I am working on a voxel engine and I started doing some worldgen. I generate chunks on a different thread, because it causes too much lag to put on the main thread. When I start playing the chunks ...
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 ...
-2
votes
0answers
58 views

Guessing game - 3 Levels [closed]

I have a problem while making a guessing game which should contain 3 levels - every level should have a different range. For instance: For level 1 range [1-20] For level 2 range [1-50] For level 3 ...
-1
votes
0answers
41 views

how to color moving shape without flickering [closed]

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 ...
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 ...
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 ...
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
66 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 ...
0
votes
1answer
49 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
55 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 ...
-2
votes
0answers
19 views

Incorporating Rastek light issue [closed]

Hello i have a few issues with Directx, i am trying to make diffuse light work whithin my code. But the book i have doesn't really work for me and i'm now trying incorporate the light from Rastertek ...
4
votes
1answer
256 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 ...
1
vote
4answers
93 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
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 ...
0
votes
1answer
57 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 ...
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 ...
0
votes
1answer
79 views

Triangle-Triangle Intersection Code

Does anyone have experience implementing this triangle-triangle intersection code that I found online? I don't understand it. I made a post on Stack Overflow about this and got the advice that: ...
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
1answer
55 views

How to compute matrix transform local/world on OpenGL

I'm developing an OpenGL program where each object / entity contains m_WorldPosition, m_WorldOrientation, m_WorldScale and m_WorldTransform (Vector3, Quaternion, Vector3 and Matrix4f). The problem is ...
1
vote
2answers
107 views

How to avoid checking the same triangle twice in collision detection with spatial hashing

I'm implementing a spatial hashing system to speed up my collision detection, but I've run into a problem. Since a triangle can be hashed into multiple buckets, how do I ensure that I don't check the ...
3
votes
1answer
133 views

Is std::deque the best option for storing my graphics objects?

I am currently implementing an object buffer, which stores all the objects used in the game at one place. All other components of the game, like the user interface, the level loader, etc, add objects ...
1
vote
1answer
106 views

2D graphic over 3D perspective projection

To draw a 2D HUD (just a simple trianlge, for now) over 3D graphics in OpenGL I : draw all 3D objects, then call glDisable(GL_DEPTH_TEST) before drawing 2D HUD draw 2D triangle call ...
1
vote
0answers
14 views

Are custom data types a possible and viable option for variable size efficency? [migrated]

Instead of storing a single boolean into a byte block, why not store 8 booleans in that same block. Example: 01010101 = 8 booleans, 1 3 5 7 = false, 2 4 6 8 = true. Would this work? is there a ...
0
votes
0answers
36 views

C++: vector<Foo*> with reserve(), push_back() destroying values [migrated]

The title is a tad confusing. Here is a greatly compressed version of my current predicament: Classes.h: class Foo { int x; Foo(): x(0) { } Foo(int y): x(y) { } }; class B { ...
-1
votes
0answers
74 views

How can I generate passive 3D using a consumer level graphics card?

I would like to how to generate packed frames and sent them by HDMI to a 3DTV for passive stereo visualization, using any consumer-grade graphics card. I am working on Linux, and programming in C++. ...
1
vote
1answer
76 views

c++ RPG - Handling buffs / equipment stats [duplicate]

I'm trying to develop a character calculator for a RPG, and it could evolve into a turn based combat / text based RPG. One of my concerns is how to handle the equipment stats / buff system. ...
1
vote
2answers
81 views

DirectX Quaternion SLERP Wrong Answer?

I have some code that looks like this: DirectX::XMVECTOR a, b, c; a = DirectX::XMQuaternionIdentity(); b = DirectX::XMQuaternionRotationAxis(DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f), 3.1415f); c ...
-1
votes
1answer
90 views

How to move object along circumference of another object? [closed]

I have following piece of code, now i want to move the "moon" object in the orbit around "earth". please help!! #include <stdio.h> #include <conio.h> #include <graphics.h> #include ...
0
votes
2answers
48 views

Overload how an object instance of a class is treated when used

So I've made this struct that encapsulates a glm::vec4. This is because vec3s are treated as 16-byte in GLSL, but I don't want to assign a vec4 if I only really need 3 components. Anyway, my question ...
1
vote
0answers
22 views

SDL_Mixer .xm file loop not working correctly

I am working on a little game in my spare time using C++ and SDL and I have encountered a problem with a .xm file playback. The music is supposed to have an intro of a couple patterns and then ...
0
votes
0answers
56 views

Trying to bounce a box with a plane using bullet physics

I'm trying to simulate a box that bounces with a plane and I'm beginner with bullet physics. I created a plane (box) and and a box that is falling. The problem is the ball is stalled while colliding ...
0
votes
0answers
44 views

Update DirectX 11 Texture Created in Unity Asynchronously in the Native (c++) Plugin

Sorry for the long question :D tl;dr version :) Is it possible to update DirectX 11 textures created in Unity asynchronously in a native plugin (C++)? I've written a plugin that retrieves data from ...
1
vote
1answer
51 views

How can I fix user input for this pong paddle?

I have been having trouble with my pong paddle - It responds to user input as if it was typing. Sometimes, people try to react to KeyPressed events directly to implement smooth movement. Doing so ...
1
vote
2answers
40 views

Dynamic Flow Control in HLSL with Array References

I'm trying to do lighting calculations for an array of point lights in HLSL. I simply want to pass light direction vectors from the vertex shader to the pixel shader. Here is sample code: static ...