Questions tagged [c++]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

C++ SDL2: How to join two windows in one: top_Window + bottom_Window?

I have a code where the camera scroll left, right, up, down, and I would like to add a progress bar similar to the one below at the bottom of my window Is it possible to create the progress bar in a ...
1
vote
1answer
26 views

What's causing this stutter when framerate fluctuates?

I'm working on a class responsible for arm sway in an fps engine, and am having an issue with a stutter that appears to be related to fluctuating framerate. However I have also noticed it when locking ...
-1
votes
0answers
35 views

is there any different solution for different buildings different behaviours [closed]

I'm trying to make different behaviours of worker for diffferent buildings let's say as agricultural he would seed and collect wheet when it's grown let's say Behaviour0 for carpentry he would get ...
1
vote
2answers
77 views

Parts of 3D model disappear during animation

I'm trying to properly play an animation done in Blender 2.8 inside my OpenGL application. When the animation is running, it happens that at some particular frames, some parts of the 3D model "...
0
votes
0answers
27 views

Does anyone know a good C++ 2D DirectX 11 video tutorial series? [closed]

I have been learning 3D DirectX 11 for a while now, but now I would like to know a good video tutorial series that focuses directly on 2D graphics. Does anyone know where to find one (preferably on ...
0
votes
1answer
126 views

How to implement an tooltip item cache?

I'm building a tooltip item like that I would like to keep this information cached on the client side, avoiding that whenever the information is displayed it's necessary to make a request to the ...
0
votes
0answers
13 views

Pathfinding algorithm isn't finding correct route [closed]

I am attempting an online coding challenge wherein I am to implement a pathfinding algorithm that finds the shortest path between two points on a 2D grid. The code that is submitted is tested against ...
1
vote
1answer
881 views

Rotate camera around its center in 2D

I'm currently trying to develop my own little game engine (trying to understand maths in games). I have implemented 4x4 matrices and 2d vectors (I don't need 3d since I'm aiming at orthographic ...
0
votes
0answers
19 views

SDL_Init segfault on linux

I am using Manjaro linux and SDL 2. However, when I build the application in debug mode and use gdb or something like qtcreator with gdb, to debug it, it gives me a segfault, when the function ...
5
votes
1answer
222 views

How do I detect image clicks in Dark GDK?

I am trying to determine if an image has been clicked, using the Dark GDK game engine. I've found no methods in the engine that do this. I would rather not brute force this with a large nested if/...
0
votes
1answer
106 views

How is tile offsetting accomplished in 2d side scrollers?

The idea is to work with tiles that together make up a larger image, or world so to speak. but im confused as to what the methods used are to offset the tiles, and whether is a good idea to draw ...
0
votes
0answers
24 views

JoyStick::GetInfo(JoyStick::id1).dwButtonNumber always returns 0x1

I am using an XBox 360 gamepad for Windows. I am having an issue with the following legacy code base, which relies on JOYINFOEX, ...
6
votes
2answers
317 views

How to generate a multiplier map for radiosity

I am following this tutorial: here I am at the part where you are creating a hemicube. I have got the code to render the scene into a texture and therfore an array. Now how can I generate a so-called ...
0
votes
0answers
46 views

Frustum culling issue at oblique angles

I am using the following algorithm to test if my camera frustum contains an axis-aligned bounding box: ...
1
vote
2answers
617 views

Proper way to update pixel array data

For a game that updates a board every frame I am calculating the next arrangement of board, updating pixel array data and render board as 2D texture to quad the size of the screen using OpenGL. I use:...
1
vote
2answers
190 views

Are closing window and destroying DirectX11.1 independent?

I have a project with DirectX support. In this program uses two threads. One is a dedicated message loop and the second is executing DirectX API's. The question is about ending such program. The ...
1
vote
2answers
162 views

How to keep same aspect ratio in different devices with cocos2dx?

I have been making a board game and I am using cocos2dx. There are two scenes for now, One is main menu and the other is gameplay scene. When I run the apk on tablet with EXACT_FIT resolution policy ...
0
votes
0answers
18 views

Unreal4, C++: Spawned actors visible after stopping, not during play

I've created a class with a function InitializeModel, that is exposed to blueprint. In this function some AStaticMeshActors should be spawned, but I cannot see them during play, I need to stop the ...
0
votes
0answers
48 views

Using quaternions to rotate an object

I started to learn quaternions and got very weak idea of how they work. So I blindly followed some tutorials on you tube on how to rotate object with glm. I had problem with weird rotations when I ...
0
votes
1answer
48 views

What is the best way to approach a multi pass rendering system?

I am trying to code a new feature in my engine but I can't find a way to implement my idea, which is the next one. I am trying to get multi pass rendering with more than two passes. I know how to do a ...
0
votes
1answer
51 views

Texture blends into one single color

It looks like that it's being sampled from the least detailed MIP level, at least RenderDoc sees the texture as it should be, and what the actual texture looks like is the same as MIP 9th. I'm using ...
3
votes
0answers
2k views

Radiosity lightmap generation [closed]

Is there any working C++ source code for a lightmap generation algorithm using Radiosity or any other GI system? I've found technical papers only, but I can't really find any implementation.
0
votes
1answer
51 views

OpenGL/C++ Rotate relative to shooting gun

I'm trying to make a 2D game where I have a gun that i use to shot things in the direction of the mouse resulting in an angle that I can get. I have some problems with the trajectory of the bullet ...
1
vote
1answer
111 views

How to allow infinite custom inputs?

Summary: What approach should I take to allow custom inputs saved in a file be interpreted in the engine? So I am making a game engine similar to Mugen where I want characters to have their own ...
2
votes
2answers
63 views

Getting data from the backbuffer D3D11 using Map [duplicate]

I'm having some trouble using ID3D11DeviceContext::Map() correctly. Here's the whole function so far: ...
10
votes
4answers
4k views

Switch statement efficiency in game code

Recently, I was digging into VVVVVVV's source code that was released on GitHub by Terry Cavanagh. I went into the Game.cpp file, and found that it contains an ...
2
votes
1answer
600 views

Moving a sprite along a circle given by an implicit equation

I’m trying to create a hyperbolic version of Pong in a Poincaré disk, using C++ and SFML. Here is my problem: when the ball rebounds on a paddle, I deduce two coordinates allowing me to recover the ...
0
votes
1answer
59 views

How do I get my sprite to do a regular jump instead of jolt up?

I have been getting into game development and I have made some progress. I have come across an obstacle which is jumping I managed to get the Jumping to semi work but it doesn't look like a jump but ...
0
votes
1answer
281 views

Unreal MouseWheelAxis negative axis does not work

Would like to avoid using separate action mappings i.e. MouseWheelUp and MouseWheelDown for a system I'm developing. I noticed <...
0
votes
0answers
40 views

How to efficiently average multiple rotations (quaternions)?

So, I'm working on an animation system in C++, and am trying to blend multiple animations together. A slerp is easy on two quaternions, but is it efficient (or accurate) to chain together for more ...
1
vote
0answers
57 views

OpenGL model not rendering properly

I have been playing with OpenGL for a while and I came into the wall that I don't know how to pass. I am trying to render a model of an object based on a .obj file. In that file I have position ...
0
votes
0answers
36 views

Attempt to fix sprite sheet pixel bleeding in OpenGL 2D causing sprite distortion

While working on a project, I encountered the common problem of pixel bleeding when trying to draw subregions of my sprite sheet. This caused sort of "seams" to appear at the edges of my ...
1
vote
2answers
197 views

Modern Compilers Inlining and Header and Implementation Practices in Game Development

I was taught that in general practice its best not to try to beat the compiler, at least until its proven to be stupid. So in general, and since I was told that its generally only used as a suggestion ...
0
votes
2answers
77 views

SDL2 Block collision with player Bug

I am currently working on a small 2D Games Engine with SDL2 for fun. The engine works in a way, that you can define a tileset, which accesses the engine and allows you to place tile by tile on the ...
0
votes
1answer
18 views

How to Sync the Location After Getting Up from Ragdoll?

I am currently working on multiplayer fighting game and my game will have an anim->ragdoll when the player is knocked out and be able to getting up from it. My problem now is ragdoll is making my ...
1
vote
0answers
29 views

SDL Texture not scaling to the renderQuad

I'm building a Space Invaders clone and using a sprite sheet for my invaders, but when I grab the texture from the sprite sheet, it doesn't scale to the renderQuad that I set. This is the original ...
0
votes
0answers
37 views

Z-Buffer Problem

I was working on my engine and while implementing post processing a very weird bug appeared. It seems to come from the Z-Test but I can't firgure out what exactly it is hapening First of all here's ...
0
votes
1answer
608 views

Why does my SFML game cause screen tearing on Linux? [closed]

I wrote a little game of a bouncing ball, using SFML and Box2D. On Windows, the graphics animate smoothly. However, on my Linux machine, the animation stutters randomly. To be precise, I get a ...
2
votes
2answers
2k views

How can I calculate the future position of my moving object?

I'm relatively new to games development and I have a 2D game where the playing area is an enclosed rectangle with width w and infinite height. In the playing area there is a ball. A gravity force of ...
0
votes
1answer
73 views

Directx11 batching verticies to draw later

I have several draw functions in my renderer to draw primitives e.g.: Drawing a Quad: ...
2
votes
1answer
5k views

How to render a PNG-file on the screen with SDL? [duplicate]

I'm coding a 2D platformer in using C++ and SDL2. I've started by coding the GUI, however I'm unsure how to get the menu buttons onto the screen and in the right positions. How do I load the PNG ...
1
vote
1answer
491 views

Instancing with Directx11

I'm a total beginner with Directx/3D programming. I need help with implementing hardware instancing on Directx 11. I'm trying to render multiple cubes on the screen, to create some sort of Minecraft-...
0
votes
2answers
579 views

Switched from immediate mode to VBOs, game runs slower

trying to improve draw performance on my c++, OpenGL, SDL game. Back in school we mostly learned immediate mode, so thats how my drawing was originally implemented. When I started reading up online ...
0
votes
1answer
24 views

How to collect objects from map in blueprints

I have a plate with trigger(TriggerVolume) on it. When it overlapped cubes from map deleting. I've manually created references on cubes in blueprint to delete them but it seems very hard-coded. Is ...
1
vote
2answers
444 views

Why is my call to SetDisplayMode not supported?

I have some legacy DirectX code that always returns DDERR_UNSUPPORTED. I originally developed the code using DirectX3, and I am porting it to DirectX7 after ...
1
vote
1answer
77 views

Unable to create Shader Object for Geometry Shader (GL_GEOMETRY_SHADER)

I am just starting with OpenGL using c++ on Ubuntu 18.04. The problem I have is that when I try to link Geometry Shader in my main program, the following function call is unable to create an object (...
1
vote
1answer
106 views

Instantiating GameObjects in Custom Game Engine

So,i'm having a bit of an issue with instantiating my gameobjects into to universe(My Scene object). I can create an empty object from scratch and populate it from there with ease,my problem starts ...
0
votes
2answers
77 views

Smooth out movement of the snake in a 2d Snake game

I am working on a 2-D snake game in C++ with the SFML library. I would like to smooth out the movement of my snake as it looks extremely choppy currently. How the Snake moves The snake is made up of a ...
1
vote
1answer
109 views

What type does one cast the result of “get_function_address” to in order to call the function within a C++ DLL?

According to the game maker documentation for dll manipulation: get_function_address('function_name') Returns the address of a GameMaker function. This can be passed to DLL's so the can call ...

1
2 3 4 5
79