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

learn more… | top users | synonyms

-2
votes
1answer
24 views

how to rotate a sphere around centre (x y z) [duplicate]

I have centre of sphere at x y z. now I want to rotate any point (a b c) on the sphere about centre. how can I do it in c++.
0
votes
0answers
38 views

OpenGL Texture Loading

I've been using OpenGL for a bit so I have a general idea of what I'm doing. Recently, I've been working on a framework to let me test stuff more easily. As part of the framework, I split up loading ...
1
vote
1answer
69 views

Game Object, components priority?

So, my first attempt to create a component based game object is this: class GameObject; class GameObjectComponent { public: virtual ~GameObjectComponent(); virtual void Update(GameObject* ...
0
votes
0answers
23 views

Awesomium Input + SD2

In my project I use Awesomium GUI and SDL2. I want to create simple button. In HTML document I write <html> <body> <button onclick="app.sayHello()">Say ...
1
vote
1answer
63 views

Game is unable to load assets

I programmed a game in c++. Now I want to pack the finished product. Game runs fine from within the compiler. But how can i link the assets(like images, music etc) of the game to the exe ? When I run ...
0
votes
0answers
7 views

Bullet Physics - Create Rigid Body using btConvexTriangleMeshShape

Can someone please explain me how to create collision shape using btConvexTriangleMeshShape? The problem is that Bullet Physics is not well documented so i can't figure out how to fill vertex and ...
0
votes
0answers
24 views

How to import Cocos2d-x in codeblocks ide?

Is it possible to import cocos2d-x in codeblocks just as in xcode ?? How can I do that ? I use ubuntu. It is not possible to use xcode in ubuntu. Cocos2dx is in c++. How can I use codeblocks for game ...
0
votes
1answer
78 views

Good design for skills (heal,dmg etc)

I'm trying to create a good designed "skill system" for my game, but curious if anybody knows a good design? Skills can Heal,Damage ofc, they can be single target,multiple(chain), AOE. Instant ...
0
votes
1answer
25 views

useful way for coloring 3ds object in opengl

I have been working in making plane in blender and it has many materials over than 90 , and now I need it in an opengl project with c++ , but as you know if I but the 3ds file the plane color is ...
1
vote
0answers
29 views

Find camera coordinate of vanishing point

Given a vector and a camera (position, angle, up vector, field of view, etc), how would I find the vanishing point of the vector in camera space?
1
vote
0answers
20 views

Passing an SDL KeyboardState(Uint8*) to Lua

I'm working on my first big project and I've decided to integrate Lua with my C++ framework. Everything's worked out so far, but the only way I've managed to pass the SDL_GetKeyboardState(NULL) array ...
0
votes
1answer
20 views

How to set a struct as a Direct3D9 vertex shader constant?

I have a vs_2_0 shader like this: struct ConstantBuffer { float4 diffuse; float4 specular }; shared uniform ConstantBuffer g_cb : app_constantBuffer; void PS(out float4 Color: COLOR0) { ...
1
vote
1answer
52 views

Will Frame Independant Movement break collision

Using my game loop to give my game movement which is independant from the framerate, has been working fine for me but, I've started to consider my games running on machines which cannot keep up with ...
0
votes
0answers
21 views

SDL_ShowCursor not showing in Mac

I have the following code to create a software cursor in SDL: void Breakout::createAndActivateCursor() { int i, row, col; int hot_x, hot_y; Uint8 data[4*32]; Uint8 mask[4*32]; static const char ...
1
vote
1answer
42 views

Registering a C++ callback with Lua API without additional libraries

Basically, I'm trying to register a callback into a Lua state like this: class MyClass { public: int myLuaFunction(lua_State* L) { //do something } }; I ...
-3
votes
1answer
130 views

Performance of programming languages and frameworks [closed]

I want to program an online 2D MMORPG with graphics like in this game. Since I develop in javascript and python mainly I chose python for my first games and the game library pygame which is pretty ...
0
votes
2answers
178 views

Map Generation Algorithm [BOMBERMAN]

I'm looking for some wise tips concerning a specific game development : Bomberman-like. I am currently implementing a "random map" generation for the game, but I feel like I'm not doing in the best ...
-1
votes
1answer
32 views

Direct3d 9 z-buffer fails drastically [closed]

I have just completed my custom mesh class and my engine is very basic right now, but now I am facing this strange issue. I have posted the pictures bellow, it seems like z-buffer is not working ...
0
votes
5answers
104 views

How to properly pass sprites to a std::vector without destroying the sprite's texture in SFML?

From the official SFML tutorials, The White Box Problem:- "When you set the texture of a sprite, all it does internally is store a pointer to the texture instance. Therefore, if the texture is ...
0
votes
1answer
62 views

loading a texture in Opengl

I am working on a graphics project I want to make a city using opengl with c++ anyway in the last few days I have been trying to load a texture but it didn't work with me in any way I have tried many ...
1
vote
0answers
108 views

How to architect systems is Enity Component System, in C++ [closed]

When creating an ECS in C++, what are good, simple approaches to architecting the systems. Should each system be a static function of a dedicated class (is this semantically different than just ...
1
vote
2answers
34 views

glutPostRedisplay() is not redrawing after updating model view matrix

I am trying to change the rotation of my object with keyboards, when I move the object in the direction of x, y or z it is okay, it is responding correctly. But when I try to change rotation, it does ...
8
votes
0answers
420 views

Is it possible to use the Unreal Engine as a big C++ library, without using the editor?

I want to write a game entirely in C++, but I would like to profit from the possibilities offered by the Unreal Engine, especially in terms of graphics and physics. Nevertheless, I strongly dislike ...
1
vote
1answer
141 views

How do I Rigidbody.AddForce(Vector3) in Unreal Engine?

I am coming from the Unity Engine, and trying to get my feet wet with Unreal Engine 4. I want to add a one-time force to an object. To accomplish this in Unity 5, I would use: void Start(){ ...
1
vote
0answers
24 views

SDL_Mixer - Mix_LoadWav_RW returns NULL (Unrecognized sound file type)

I am loading sounds from resource file (Doom2.wad from game Doom 2: Hell on Earth), converting them into WAVE and then trying to play them using SDL_Mixer. If I save the converted sound into a .wav ...
1
vote
1answer
49 views

Bullet Physics - Collision not working when moving btBvhTriangleMeshShape

I have a robot (btTriangleMeshShape for each component) and a chain of boxes used as a cable, which is anchored on two components of the robot. I want to rotate a robot component and when this ...
2
votes
0answers
22 views

Are all C++ fixed-point operations deterministic? [migrated]

I'm writing a small RTS engine in C++ and want to use lockstep synchronisation. As floating point determinism is something I can't even hope to achieve, I have to use fixed point math. How ...
3
votes
1answer
97 views

Optimizing the “visibility cone” calculations for a 2d game

I'm creating a simple 2D game and got a little bit stuck with this algorithm. What I wanted to achieve - and achieved - is to draw a visibility cone influenced by walls and other obstacles on the map. ...
0
votes
1answer
41 views

Calculating density of an object

I'm using Box2D for physics in my game, and one of the things it needs to know when creating a shape for a physics body is the shape's density. I had no idea what value I should specify, so I went to ...
1
vote
1answer
133 views

Communication in a simple GUI (C++ / SDL2)

I've spent a few months now working on a fairly simply 2D game engine with SDL and C++. I'm now trying to develop a simple but well-featured GUI suitable for most games. Right now I'm really ...
0
votes
1answer
54 views

How to Load a Level for use with the Bullet Physics Library

I am trying to use a level in .obj format loaded with Assimp to generate a btBvhTriangleMeshShape to use with the Bullet physics library. I can successfully load btConvexHullShapes as well ...
-3
votes
0answers
51 views

3D Fractal terrain generation

I have a problem with my terrain, each time I get a strange terrain. I don't know where is exactely the problem. Here is my MidPoint dispacement function: bool terrain::MPD(int x1,int y1,int x2,int ...
0
votes
0answers
29 views

OpenGL - Cubemap “Rotating” Proportional To Camera Movement

I'm doing a simple planet rendering project and am running into an issue with accessing cubemap textures correctly. The planet terrain is generated using the diamond square algorithm done 6 times and ...
1
vote
1answer
38 views

Modern OpenGL Texture Displaying Incorrectly [closed]

I've been working with this code and have simplified it to the most basic form possible, and even then I cannot get a texture to display properly at all. Here is the code: ...
1
vote
1answer
79 views

Improving performance for flocking behavior?

I have a game that I am trying to make. It is a twin-stick shooter that I want to design to have a LOT (Up to 500) of enemies on the screen. The game's base design comes from that of Geometry Wars, ...
1
vote
3answers
99 views

How does Unity call “update()” in the scripts?

I understand that you can expose your C++ code to a scripting language such as ChaiScript. From this you can call code that you've made in C++. In Unity, however, they have functions in the script, ...
0
votes
1answer
99 views

Handling input with callback functions

I'm not sure if I understand callback functions completely - they are functions that another function calls? This seems like a powerful tool, especially w/r/t handling input. I've written up this ...
0
votes
1answer
160 views

How can I store additional attributes on DCEL edges?

I am currently working on a city generator, and I've ran into some issues with data storage while working on the roads. I currently use a doubly-connected edge list (DCEL for short), to store the road ...
1
vote
1answer
63 views

3D GUI Shader Problem

So I want to create one of these in my directX11 project. The little axis there that shows you the direction. I have a nice 3d shader for my world geometry that I tweaked from Frank D. Luna (He ...
0
votes
1answer
124 views

DirectX11 Equivalent of OpenGL code

I am currently porting parts of my engine over to D3D11 from OpenGL and was trying to figure out how I would accomplish the following blending functions in D3D11. glEnable(GL_BLEND); ...
37
votes
5answers
3k views

When prototyping, how can I more easily explore game behaviour?

I build indie games myself, but I'm usually out of energy once I've taken a newly developed game to a level where it's possible to play with behavior, so I settle for refinement instead of ...
1
vote
2answers
85 views

SDL draw dynamic select box

this might seem obvious to many, but I'm stuck and I cannot find any tutorial which helped me, so it would be great to find the answer here. I tried to make a rectangle like you have in RTS games, so ...
0
votes
1answer
68 views

Solitaire Game: Transferring Cards Design in C++

So, I'm working on a Solitaire game. I already created a the classes: Card, Pile, Stock. Each work as expected on it's own. My question is: What possible design for managing moving card(s) between the ...
0
votes
1answer
68 views

SDL pixel access very slow

I'm using SDL and need to plot pixels one by one on the screen. When I do this, it's extremely slow. I followed the tutorial here: http://www.programmersranch.com/2014/02/sdl2-pixel-drawing.html ...
0
votes
2answers
99 views

How to keep a shape inside a rectangle

So i'm making a game which is based on randomly generated rooms and i need a way to keep the player inside them and make the player glide when he collides with the room's bounds. I currently have a ...
-1
votes
1answer
47 views

How do i load, render and trasnform 2D images using Direct3D 11 API? [closed]

In my small game project using DirectX 11 API, I created a Direct3D device, and can draw 3D meshes, using web tutorials and a book. But I cannot figure out how to load, transform (rotate, scale, ...
3
votes
1answer
174 views

How do I create a multiplayer server also suitable for local single-player?

I've created a voxel game in C++, OpenGL and SFML, and I want to make it multiplayer. I'd like to make it similar to Minecraft's client-server model: The single-player is just a client to the hidden ...
-1
votes
1answer
79 views

How can i fix my Ground detection code?

My ground detection works by checking if the player's x position is between the range of a sprite xpos+16 and xpos-16 if it is,then it uses a separate axis theorem on the y axis to see if the player ...
1
vote
2answers
114 views

Movement in gameloop

I wonder what the best way is to move the player. Is it best to always check for movement like I do in the first example of is it better to only access the movement function via the input function ...
2
votes
2answers
132 views

Proper Text-RPG Monster Generator [closed]

I'm making a text-based RPG in C++ just for fun, and in a way that I can keep adding to it and hopefully give it graphics one day, and I've got a lot of code for everything. My only problem is that I ...