# Search the Community

Showing results for tags 'C++'.

• ### Search By Tags

Type tags separated by commas.

### Categories

• Audio
• Music and Sound FX
• Career Development
• Production and Management
• Game Design
• Game Design and Theory
• Writing for Games
• UX for Games
• Industry
• Interviews
• Event Coverage
• Programming
• Artificial Intelligence
• General and Gameplay Programming
• Graphics and GPU Programming
• Engines and Middleware
• Math and Physics
• Networking and Multiplayer
• Visual Arts
• Archive

• News

• Audio
• Visual Arts
• Programming
• Writing

### Categories

• Audio Jobs
• Game Design Jobs
• Programming Jobs
• Visual Arts Jobs

### Categories

• GameDev Unboxed

### Forums

• Audio
• Music and Sound FX
• Games Career Development
• Production and Management
• Game Design
• Game Design and Theory
• Writing for Games
• Programming
• Artificial Intelligence
• Engines and Middleware
• General and Gameplay Programming
• Graphics and GPU Programming
• Math and Physics
• Networking and Multiplayer
• Visual Arts
• 2D and 3D Art
• Critique and Feedback
• Topical
• Virtual and Augmented Reality
• News
• Community
• GameDev Challenges
• For Beginners
• GDNet+ Member Forum
• GDNet Lounge
• GDNet Comments, Suggestions, and Ideas
• Coding Horrors
• Hobby Project Classifieds
• Indie Showcase
• Article Writing
• Affiliates
• NeHe Productions
• AngelCode
• Workshops
• C# Workshop
• CPP Workshop
• Freehand Drawing Workshop
• Hands-On Interactive Game Development
• SICP Workshop
• XNA 4.0 Workshop
• Archive
• Topical
• Affiliates
• Contests
• Technical

### Calendars

• Community Calendar
• Games Industry Events
• Game Jams

• Members

• 0 Replies

• 0 Reviews

• 0 Views

### Steam

Found 293 results

1. ## Esenthel's latest WebGL demo

Just finished making latest WebGL demo for my game engine: http://esenthel.com/?id=live_demo Let me know what you think, as of now only Chrome and Firefox can run it. Edge, Safari, Opera have some unresolved bugs at the moment.
2. ## Yet Another Pong

Hi, everyone! I "finished" building my first game. Obviously Pong. It's written in C++ on Visual Studio with SFML. Pong.cpp What do you think? What should I consider doing to improve the code? Thank you very much. EDIT: added some screenshot and .zip file of the playable game Pong.zip
3. ## DX11 Depth buffer and depth stencil state comparison function confusion

I was wondering if anyone could explain the depth buffer and the depth stencil state comparison function to me as I'm a little confused So I have set up a depth stencil state where the DepthFunc is set to D3D11_COMPARISON_LESS, but what am I actually comparing here? What is actually written to the buffer, the pixel that should show up in the front? I have these 2 quad faces, a Red Face and a Blue Face. The Blue Face is further away from the Viewer with a Z index value of -100.0f. Where the Red Face is close to the Viewer with a Z index value of 0.0f. When DepthFunc is set to D3D11_COMPARISON_LESS the Red Face shows up in front of the Blue Face like it should based on the Z index values. BUT if I change the DepthFunc to D3D11_COMPARISON_LESS_EQUAL the Blue Face shows in front of the Red Face. Which does not make sense to me, I would think that when the function is set to D3D11_COMPARISON_LESS_EQUAL the Red Face would still show up in front of the Blue Face as the Z index for the Red Face is still closer to the viewer Am I thinking of this comparison function all wrong? Vertex data just in case //Vertex date that make up the 2 faces Vertex verts[] = { //Red face Vertex(Vector4(0.0f, 0.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(100.0f, 100.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(100.0f, 0.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(0.0f, 0.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(0.0f, 100.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(100.0f, 100.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), //Blue face Vertex(Vector4(0.0f, 0.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(100.0f, 100.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(100.0f, 0.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(0.0f, 0.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(0.0f, 100.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(100.0f, 100.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), };
4. ## C++ Filling console with ASCII

Hi, I'm trying to fill a win64 Console with ASCII char. At the moment I have 2 solutions: one using std::cout for each line, let's say 30 lines at once using std::endl at the end of each one. The second solution is using FillConsoleOutputCharacter. This method seems a lot more robust and with less flickering. But I'm guessing, internally it's using a different table than the one used by std::cout. I'm trying to fill the console with the unsigned char 0xB0 which is a sort of grey square when I use std::cout but when using FillConsoleOutputCharacter it is outputted as the UTF8 char '°'. I tried using SetConsoleOutputCP before but could not find a proper way to force it to only use the non-extended ASCII code page... Has anyone a hint on this one? Cheers!
5. ## Cant find how to do this asm code in c++...

Hi guys, i know this is stupid but i've been trying to convert this block of asm code in c++ for an hour or two and im stuck ////////////////////////////////////////////////////////////////////////////////////////////// /////// This routine write the value returned by GetProcAddress() at the address p /////////// ////////////////////////////////////////////////////////////////////////////////////////////// bool SetProcAddress(HINSTANCE dll, void *p, char *name) { UINT *res = (UINT*)ptr; void *f = GetProcAddress(dll, name); if(!f) return false; _asm { push ebx push edx mov ebx, f mov edx, p mov [ebx], edx // <--- put edx at the address pointed by ebx pop edx pop ebx } return res != 0; } ... // ie: SetProcAddress(hDll, &some_function, "function_name"); I tried: memcmp(p, f, sizeof(p)); and UINT *i1 = (*UINT)p; UINT *i2 = (*UINT)f; *f = *p; The first one dosent seem to give the right retult, and the second one won't compile. Any idea?
6. ## C++ MAZE GAME ASSIGNMENT

I am a computer engineering student and i have the assignment below. İ only can write the 2D maze array and have no idea about creating car and time as well. Could anyone write and explain hot to do??? Minimum Criteria: You are expected to design the game by using C ++ . Below are the minimal criteria: • You must create game board with 2 - Dimensional Matrix • Bonuses create with randomly in the game board • All bonuses have got the same value but different effect for car and score . These effects may be positive or negative . • You must use pointer for creating and using car . Some bonuses may be change car type. • When the game finish, you must show high - score. • For moving car , you need to create coordinate s randomly and you need to write proper control statements. • You must use functions for drawing game board and changing car type . If you need extra functions, you can use it. • If you cannot get out the maze when the time is up , the game is over and you need to show high score. In this project, you must do all minimum criteria. In the end, your program must be work without any errors. Bonus: • Save and load high score information to/from disk • Each bonus has got different random values. • You can create cheat codes for the game. • You can create alternative control for car . • Car can jump over the wall but may lose the score . When car exit the maze , game is over and you need to show high score.
7. ## C++ Virtuals hide information on the implementation

Hey everyone! Text is down below, just wanted to provide some C++ish pseudo-code to help me expressing my issue ('...' defines omitted details): class Interface_Tree { public: ... } class Tree : public Interface_Tree { public: ... private: std::vector<Interface_Bucket> buckets; } class Interface_Bucket { public: ... add_object(Interface_Object* obj) } class Special_Bucket : public Interface_Bucket { public: add_object(Interface_Bucket_Object* obj) { /* If Interface_Bucket_Object cannot be cast to Special_Bucket_Object_Category, do nothing. This would require a dynamic_cast which I want to avoid, that probably cannot unless restructuring. Check what enum-type Special_Bucket_Object_Category If VERY_IMPORTANT use pointer very_important_obj. Else add to objs. */ } private: std::vector<Interface_Bucket_Object*> objs; Interface_Bucket_Object* very_important_obj; } class Interface_Bucket_Object { public: ... } enum Special_Bucket_Object_Category { IMPORTANT, VERY_IMPORTANT, SPAM }; class Special_Bucket_Object : public Interface { public: ... private: Special_Bucket_Object_Category category; } I wanted to start programming to interfaces (or in C++, virtual classes) instead of actual classes (which are now just derived ones) in order to improve unit-testing etc., hence every class derives a base, that can be easily implemented differently. But the issue is, if I have a Hash-Bucket data-structure class owning buckets that collect bucket-objects, how can the bucket differentiate characteristics of an implementation of the implemented bucket-object? Sure, I can do a dynamic-cast, if that fails just abort, but I do not want to do a dynamic-cast, because I would rather restructure my code. I want my bucket-objects to have a flag (could also be called tag, category, ...) that notifies a bucket that this object needs the entire bucket, hence the enum in my code expressing the flags an object can raise. If I would omit all interface-stuff, it would be fairly easy. My Bucket's add_object() method could easily only be called with that exact object and since the exact bucket-object type is now given, and not just some interface, accessing the enum is trivial via a getter-method. And a last reminder: I'm not using virtual-classes to profit from inheritance in a sense of a bucket being able to collect a tons of different implementations, just one implementation that carries an enum. The bucket-tree won't own different types of buckets neither, just one implementation kind of bucket. The only reason I use inheritance is to enable easy unit-testing. So, how can I access the object's category without dynamic-casting?
8. ## My first 3D game

I 'm learning how to create game by using opengl with c/c++ coding, so here is my fist game. In video description also have game contain in Dropbox. May be I will make it better in future. Thanks.
9. ## DX11 Multitexturing in DirectX11 - 3 textures work fine, but 4th turns black!

Trying to write a multitexturing shader in DirectX11 - 3 textures work fine, but adding 4th gets sampled as black! Could you please look at the textureClass.cpp line 79? - I'm guess its D3D11_TEXTURE2D_DESC settings are wrong, but no idea how to set it up right. I tried changing ArraySize from 1 to 4, but does nothing. If thats not the issue, please look at the LightShader_ps - maybe doing something wrong there? Otherwise, no idea. // Setup the description of the texture. textureDesc.Height = height; textureDesc.Width = width; textureDesc.MipLevels = 0; textureDesc.ArraySize = 1; textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; textureDesc.SampleDesc.Count = 1; textureDesc.SampleDesc.Quality = 0; textureDesc.Usage = D3D11_USAGE_DEFAULT; textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; textureDesc.CPUAccessFlags = 0; textureDesc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; Please help, thanks. https://github.com/mister51213/DirectX11Engine/blob/master/DirectX11Engine/Texture.cpp

11. ## 3D -DIRECTX 9- Can someone help me out with this vertex buffer error?

Can someone help out with this. The code builds but I get "Exception thrown: Read Access Violation" and says my index buffer was a nullptr. I'm going to attach my code and a screenshot of the error below or above. Any help is greatly appreciated. //------------------------------- //ヘッダファイル //------------------------------- #include "manager.h" #include "renderer.h" #include "dome.h" #include "camera.h" //------------------------------- //コンストラクタ //------------------------------- CDome::CDome() { m_pIndxBuff = nullptr; m_pVtxBuff = nullptr; m_HorizontalGrid = NULL; m_VerticalGrid = NULL; // ワールドの位置・拡大・回転を設定 m_Scale = D3DXVECTOR3(1.0f, 1.0f, 1.0f); m_Pos = D3DXVECTOR3(0.0f, 0.0f, 0.0f); //m_Rotate = 0.0f; } CDome::CDome(int HorizontalGrid, int VerticalGrid, float Length) { m_pIndxBuff = nullptr; m_pVtxBuff = nullptr; m_HorizontalGrid = HorizontalGrid; m_VerticalGrid = VerticalGrid; // ワールドの位置・拡大・回転を設定 m_Scale = D3DXVECTOR3(1.0f, 1.0f, 1.0f); m_Pos = D3DXVECTOR3(0.0f, 0.0f, 0.0f); m_Length = Length; } CDome::CDome(int HorizontalGrid, int VerticalGrid, float Length, D3DXVECTOR3 Pos) { m_pIndxBuff = nullptr; m_pVtxBuff = nullptr; m_HorizontalGrid = HorizontalGrid; m_VerticalGrid = VerticalGrid; // ワールドの位置・拡大・回転を設定 m_Scale = D3DXVECTOR3(1.0f, 1.0f, 1.0f); m_Pos = Pos; m_Length = Length; } //------------------------------- //デストラクタ //------------------------------- CDome::~CDome() { } //------------------------------- //初期化処理 //------------------------------- void CDome::Init(void) { LPDIRECT3DDEVICE9 pDevice; pDevice = CManager::GetRenderer()->GetDevice(); m_VtxNum = (m_HorizontalGrid + 1) * (m_VerticalGrid + 1); m_IndxNum = (m_HorizontalGrid * 2 + 2) * m_VerticalGrid + (m_VerticalGrid - 1) * 2; // テクスチャの生成 if (FAILED(D3DXCreateTextureFromFile(pDevice, "data/TEXTURE/dome.jpg", &m_pTexture))) { MessageBox(NULL, "Couldn't read Texture file destination", "Error Loading Texture", MB_OK | MB_ICONHAND); } //頂点バッファの作成 if (FAILED(pDevice->CreateVertexBuffer(sizeof(VERTEX_3D) * m_VtxNum, D3DUSAGE_WRITEONLY, FVF_VERTEX_3D, D3DPOOL_MANAGED, &m_pVtxBuff, NULL))) //作成した頂点バッファのサイズ { MessageBox(NULL, "Error making VertexBuffer", "Error", MB_OK); } //インデクスバッファの作成 if (FAILED(pDevice->CreateIndexBuffer(sizeof(VERTEX_3D) * m_IndxNum, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &m_pIndxBuff, NULL))) { MessageBox(NULL, "Error making IndexBuffer", "Error", MB_OK); } VERTEX_3D *pVtx; //仮想アドレス用ポインターVertex WORD *pIndx; //仮想アドレス用ポインターIndex //頂点バッファをロックして仮想アドレスを取得する。 m_pVtxBuff->Lock(0, 0, (void**)&pVtx, 0); //インデクスをロックして仮想アドレスを取得する。 m_pIndxBuff->Lock(0, 0, (void**)&pIndx, 0); for (int i = 0; i < (m_VerticalGrid + 1); i++) { for (int j = 0; j < (m_HorizontalGrid + 1); j++) { pVtx[0].pos = D3DXVECTOR3(m_Length * sinf(i * (D3DX_PI * 0.5f / ((int)m_VerticalGrid - 1))) * sinf(j * (D3DX_PI * 2 / ((int)m_HorizontalGrid - 1))), m_Length * cosf(i * (D3DX_PI * 0.5f / ((int)m_VerticalGrid - 1))), m_Length * sinf(i * (D3DX_PI* 0.5f / ((int)m_VerticalGrid - 1))) * cosf(j * (D3DX_PI * 2 / ((int)m_HorizontalGrid - 1)))); D3DXVECTOR3 tempNormalize; D3DXVec3Normalize(&tempNormalize, &pVtx[0].pos); pVtx[0].normal = -tempNormalize; pVtx[0].color = D3DXCOLOR(255, 255, 255, 255); pVtx[0].tex = D3DXVECTOR2((float)j / (m_HorizontalGrid - 1), (float)i / (m_VerticalGrid - 1)); pVtx++; } } for (int i = 0; i < m_VerticalGrid; i++) { if (i != 0) { pIndx[0] = ((m_HorizontalGrid + 1) * (i + 1)); pIndx++; } for (int j = 0; j < (m_HorizontalGrid + 1); j++) { pIndx[0] = ((m_HorizontalGrid + 1) * (i + 1)) + j; pIndx[1] = ((m_HorizontalGrid + 1) * i) + j; pIndx += 2; } if (i + 1 != m_VerticalGrid) { pIndx[0] = pIndx[-1]; pIndx++; } } //インデクスをアンロックする m_pIndxBuff->Unlock(); //頂点バッファをアンロックする m_pVtxBuff->Unlock(); } //------------------------------- //終了処理 //------------------------------- void CDome::Uninit(void) { // 頂点バッファの破棄 SAFE_RELEASE(m_pVtxBuff); // インデクスの破棄 SAFE_RELEASE(m_pIndxBuff); Release(); } //------------------------------- //更新処理 //------------------------------- void CDome::Update(void) { m_Pos = CManager::GetCamera()->GetCameraPosEye(); } //------------------------------- //描画処理 //------------------------------- void CDome::Draw(void) { LPDIRECT3DDEVICE9 pDevice; pDevice = CManager::GetRenderer()->GetDevice(); D3DXMATRIX mtxWorld; D3DXMATRIX mtxPos; D3DXMATRIX mtxScale; D3DXMATRIX mtxRotation; // ワールドID D3DXMatrixIdentity(&mtxWorld); // 3D拡大行列 D3DXMatrixScaling(&mtxScale, m_Scale.x, m_Scale.y, m_Scale.z); D3DXMatrixMultiply(&mtxWorld, &mtxWorld, &mtxScale); // 3D平行移動行列 D3DXMatrixTranslation(&mtxPos, m_Pos.x, m_Pos.y + 70.0f, m_Pos.z); D3DXMatrixMultiply(&mtxWorld, &mtxWorld, &mtxPos); // ワールド座標変換 pDevice->SetTransform(D3DTS_WORLD, &mtxWorld); // 頂点バッファをデータストリームに設定 pDevice->SetStreamSource(0, m_pVtxBuff, 0, sizeof(VERTEX_3D)); // 頂点フォーマットの設定 pDevice->SetFVF(FVF_VERTEX_3D); // テクスチャの設定 pDevice->SetTexture(0, m_pTexture); // インデクスの設定 pDevice->SetIndices(m_pIndxBuff); // カラーが見えるようにライトを消す pDevice->SetRenderState(D3DRS_LIGHTING, FALSE); // ポリゴンの描画 pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, 0, m_VtxNum, 0, m_IndxNum - 2); // ライトを元に戻す pDevice->SetRenderState(D3DRS_LIGHTING, TRUE); } //------------------------------- //Create MeshDome //------------------------------- CDome *CDome::Create(int HorizontalGrid, int VerticalGrid, float Length) { CDome *pMeshDome; pMeshDome = new CDome(HorizontalGrid, VerticalGrid, Length); pMeshDome->Init(); return pMeshDome; } CDome *CDome::Create(int HorizontalGrid, int VerticalGrid, float Length, D3DXVECTOR3 Pos) { CDome *pMeshDome; pMeshDome = new CDome(HorizontalGrid, VerticalGrid, Length, Pos); pMeshDome->Init(); return pMeshDome; }
12. ## C++ Recursion Quick Sort

Edit : Maybe this should be in Beginners forum. Sorry if it should be there. Hello everyone, we're getting closer to the holidays. Everyone have a safe happy season. I'm having trouble with a recursion problem for an : Inside the Quick Sort example. At the very least, I am having trouble understanding how the right side of the quick sort is done after doing all the left hand subsections. I understand that the partition function's job is to keep reducing the left-hand subsection. I am not very good at recursion yet and I am also having trouble mostly with the two quicksort calls in the quicksort function. I could really use some help. Thank you, Josheir Here is the code: #include <iostream> void getdata(int[], int); void display(int[], int); void swap(int &, int &); void partition(int[], int&, int&); void quicksort(int[], int, int); //using std; int main() { const int max = 10; int list[max]; getdata(list, max); std::cout << "initial list\n"; display(list, max); quicksort(list, 0, max - 1); std::cout << "sorted list:\n"; display(list, max); while (1); return(0); } void getdata(int a[], int n) { a[0] = 10; a[1] = 9; a[2] = 8; a[3] = 7; a[4] = 6; a[5] = 5; a[6] = 4; a[7] = 3; a[8] = 2; a[9] = 1; } void display(int a[], int n) { for (int i = 0; i < n; i++) std::cout << a[i] << "[" << i << "]\t"; std::cout << std::endl; } void swap(int &a, int &b) { int temp = a; a = b; b = temp; } void quicksort(int a[], int left, int right) { int l = left, r = right; partition(a, l, r); if (left < r) { quicksort(a, left, r); } if (l < right) { quicksort(a, l, right); } } void partition(int a[], int &l, int &r) { int pivot = a[l]; while (r > l) { while (a[l] < pivot)++l; while (pivot < a[r])--r; if (l > r)continue; swap(a[l], a[r]); ++l; --r; } } Thanks again.
13. ## C++ Will it cast?

int i = 208; float f = (float)i; Despite i know you will rant about that code please tell me if i will be 208 or i may get something close to 208? Cheers
14. ## 2 Person Dev Team for serious hobby dev

Hi there, after some years of silence i now will have the time again to do some serious hobby game dev. I am a OpenGL / 3D / 2D Expert and can code almost any landuage. For some serious hobby game dev i am looking for 1 stable person to join me. Best case , you are an artist in 2d or 3d and/or have some game idea. I am open to any kind of game that the 2 of us can finisch. Find some stuff from / about me here: https://www.youtube.com/user/uwi2k2/videos cu kai

16. ## [Android] JumpBall

Hello everyone. My new game Name: JumpBall Genre: clicker Engine: cocso2d-x + Box2D Language: C++ Complete: 80 % Description: Tap to screen for pushed ball. At each mark it is necessary to be ahead of the balloon, which is constantly accelerated. When pushing the ball you need to give the maximum possible acceleration if you make a mistake then the ball will slow down very much. Video Each time generate new terrain
17. ## OpenGL ES Display problem, is it memory data corruption ?

Hi ! I have a drawing problem, display seems to be corrupted. The program is opengl es 3.0 running on iPhone. I have a file loader and it loaded data correctly before, but if you look at both attached images, the red, blue and green cubes aren't displayed correctly ( and only them). I haven't changed the source code of my loader, so I don't think it comes from it. I know however one thing, it is that vertices and indices ( and texture coordinates, and normals ) are raw pointers, and I think my problem is in relation to memory data/heap corruption because I didn't freed them before. The scenes were displayed correctly before and this problem came suddenly, without changing the source code for the loader and the opengl es class. What do you think about this problem ? Can you help me to solve it ?
18. ## DX11 Tool for checking compiler errors in hlsl

Hey, anyone know a good plugin for debugging hlsl shaders? I have hlsl tool installed, and it makes the text change color, but it wont show me any of teh errors so I have no way of spotting errors in the shader I write other than my own two eyes. It doesnt do the red squiggly underline for some reason. Settings issue or do I need another plugin? Thanks.
19. ## An easy explanation to Dual Contouring?

Hello, I'm a trainee for software development and in my free time I try to do various things. I decided I wanted to figure out how "Dual Contouring" works, but I haven't been successful yet. I could find some implementations in code which are very hard to follow along and same sheets of paper "explaining" it written in a way that I have a hard time even understanding what the input and output is. All I know that it is used to make a surface/mesh out of voxels. Is there any explanation someone can understand without having studied math/computer science? The problem is also that most of the words I can't even translate to German(like Hermite Data) nor I can find a explanation which I can understand. I know how Marching Cubes work but I just can't find anything to Dual Contouring also I don't quite get the sense of octrees. As far I'm aware of this is a set of data organized like a tree where each element points to 8 more elements. I don't get how that could be helpful in a infinite 3D world and why I shouldn't just use a List of coordinates with zeros and ones for dirt/air or something like that. Thanks A clueless trainee ^^

21. ## C++ When/How often should I be using forward declaration?

So I recently ran into a problem where my Game class needed to know about my GraphicDevice class (Its being used as member variable) and my GraphicsDevice class needed to know about my Game class (Its being used as a method param) //In my Game.h file #include <Windows.h> #include "GraphicsDevice.h" class Game { public: /*Other methods and things*/ GraphicsDevice graphicsDevice; }; //In my GraphicsDevice.h file #include <d3d11.h> #include "Game.h" class GraphicsDevice { public: /*Other stuff*/ void init(Game* game); }; Now I know this wont compile because it causes a circular dependency issue and that it can be easily be solved with forward declaration But it started to make me wonder, should I be forward declaring everything? Not only classes but structs too? EG: //In GraphicsDevice.h //Structs from d3d11.h (directx 11 header) //Not directly used in the header file, but needed to be known for the member variables struct IDXGISwapChain; struct ID3D11Device; struct ID3D11DeviceContext; struct ID3D11RenderTargetView; class GraphicsDevice { public: /* Other methods and stuff */ IDXGISwapChain* swapchain; ID3D11Device* device; ID3D11DeviceContext* deviceContext; ID3D11RenderTargetView* backBuffer; }; Normally I just include the header file, but I'm not sure if this is correct. Should I be making DTO like class instead and the use that for the properties that I need to pass from Game to GraphicsDevice?
22. ## [MingW - Boost::asio + OpenSSL] Undefined reference BUT find it with "nm"

Hello, I am not really sure where I should post that since it is linked to a network library and I want to make my connection secured I will put my problem here. I am trying to make SSL work with boost ASIO. I am on windows and using MingW 6.3. I built OpenSSL 1.1, 1.0 and 0.8 with MingW when I try to link them to the project I always get different errors (depending on what is missing). Right now I am trying to make work OpenSSL 1.1.0g but I have those error even though I give manually the path to the libs with CMAKE. This is the errors if I build my projct with OpenSSL 1.1.0g : "C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" --build C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --target AuthServer -- -j 2 "C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -HC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer -BC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0 C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 AuthServer mingw32-make.exe[1]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug' "C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -HC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer -BC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0 "C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E cmake_progress_start C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug\CMakeFiles 6 C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 CMakeFiles/AuthServer.dir/all mingw32-make.exe[2]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug' C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\AuthServer.dir\build.make CMakeFiles/AuthServer.dir/depend mingw32-make.exe[3]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug' "C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug\CMakeFiles\AuthServer.dir\DependInfo.cmake --color= mingw32-make.exe[3]: Leaving directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug' C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\AuthServer.dir\build.make CMakeFiles/AuthServer.dir/build mingw32-make.exe[3]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug' [ 16%] Linking CXX executable bin\Windows\AuthServer.exe "C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E cmake_link_script CMakeFiles\AuthServer.dir\link.txt --verbose=1 "C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E remove -f CMakeFiles\AuthServer.dir/objects.a C:\MinGW\bin\ar.exe cr CMakeFiles\AuthServer.dir/objects.a @CMakeFiles\AuthServer.dir\objects1.rsp C:\MinGW\bin\g++.exe -g -Wl,--whole-archive CMakeFiles\AuthServer.dir/objects.a -Wl,--no-whole-archive -o bin\Windows\AuthServer.exe -Wl,--out-implib,lib\libAuthServer.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\AuthServer.dir\linklibs.rsp CMakeFiles\AuthServer.dir/objects.a(main.cpp.obj): In function ZN5boost4asio3ssl6detail17openssl_init_base7do_initD1Ev': c:/users/myuser/documents/magesbattleauthservercpp/include/boost/asio/ssl/detail/impl/openssl_init.ipp:89: undefined reference to CONF_modules_unload' CMakeFiles\AuthServer.dir/objects.a(main.cpp.obj): In function ZNK5boost4asio5error6detail12ssl_category7messageB5cxx11Ei': c:/users/myuser/documents/magesbattleauthservercpp/include/boost/asio/ssl/impl/error.ipp:39: undefined reference to ERR_reason_error_string' collect2.exe: error: ld returned 1 exit status CMakeFiles\AuthServer.dir\build.make:217: recipe for target 'bin/Windows/AuthServer.exe' failed mingw32-make.exe[3]: Leaving directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug' CMakeFiles\Makefile2:69: recipe for target 'CMakeFiles/AuthServer.dir/all' failed mingw32-make.exe[2]: Leaving directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug' mingw32-make.exe[3]: *** [bin/Windows/AuthServer.exe] Error 1 mingw32-make.exe[2]: *** [CMakeFiles/AuthServer.dir/all] Error 2 CMakeFiles\Makefile2:81: recipe for target 'CMakeFiles/AuthServer.dir/rule' failed mingw32-make.exe[1]: Leaving directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug' Makefile:120: recipe for target 'AuthServer' failed mingw32-make.exe[1]: *** [CMakeFiles/AuthServer.dir/rule] Error 2 mingw32-make.exe: *** [AuthServer] Error 2 My make : cmake_minimum_required(VERSION 3.8) project(AuthServer) #----------------- MACROS ----------------------------- #FIND THE CORRECT VERSION OF WINNT macro(get_WIN32_WINNT version) if (CMAKE_SYSTEM_VERSION) set(ver ${CMAKE_SYSTEM_VERSION}) string(REGEX MATCH "^([0-9]+).([0-9])" ver${ver}) string(REGEX MATCH "^([0-9]+)" verMajor ${ver}) # Check for Windows 10, b/c we'll need to convert to hex 'A'. if ("${verMajor}" MATCHES "10") set(verMajor "A") string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver${ver}) endif ("${verMajor}" MATCHES "10") # Remove all remaining '.' characters. string(REPLACE "." "" ver${ver}) # Prepend each digit with a zero. string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver}) set(${version} "0x${ver}") endif(CMAKE_SYSTEM_VERSION) endmacro(get_WIN32_WINNT) #----------------- MACROS ----------------------------- set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_CXX_STANDARD 14) SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") add_definitions(-DBOOST_NETWORK_ENABLE_HTTPS) set(SOURCE_FILES AuthServer/Client.cpp AuthServer/Client.h AuthServer/main.cpp AuthServer/NetworkManager.cpp AuthServer/NetworkManager.h AuthServer/Message.cpp AuthServer/Message.h AuthServer/JsonSerializable.h AuthServer/JsonDeserializerFactory.cpp AuthServer/JsonDeserializerFactory.h) if (WIN32) #windows #set the correct WINNET version get_WIN32_WINNT(ver) add_definitions(-D_WIN32_WINNT=${ver}) set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32 -lwsock32 -lmswsock") #set the correct lib build type .a because we are using mingw if(${CMAKE_BUILD_TYPE} MATCHES "debug") SET(CMAKE_FIND_LIBRARY_SUFFIXES "-mgw63-mt-d-1_65_1.a" ".a") ELSEIF(${CMAKE_BUILD_TYPE} MATCHES "release") SET(CMAKE_FIND_LIBRARY_SUFFIXES "-mgw63-mt-1_65_1.a" ".a") ENDIF() #find all the libs find_library(BOOST_LIBRARY_atomic NAMES boost_atomic PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_chrono NAMES boost_chrono PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_date_time NAMES boost_date_time PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_regex NAMES boost_regex PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_thread NAMES boost_thread PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_system NAMES boost_system PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_iostreams NAMES boost_iostreams PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_zlib NAMES boost_zlib PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(LIBRARY_ossl_ssl NAMES ssl PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(LIBRARY_ossl_crypto NAMES crypto PATHS${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) add_executable(AuthServer${SOURCE_FILES}) ELSEif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") #osx SET(CMAKE_OSX_ARCHITECTURES x86_64) SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".dylib") find_library(BOOST_LIBRARY_atomic NAMES boost_atomic PATHS${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_chrono NAMES boost_chrono PATHS${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_date_time NAMES boost_date_time PATHS${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_regex NAMES boost_regex PATHS${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_thread NAMES boost_thread PATHS${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_system NAMES boost_system PATHS${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_iostreams NAMES boost_iostreams PATHS${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) find_library(BOOST_LIBRARY_zlib NAMES boost_zlib PATHS${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE} NO_DEFAULT_PATH) add_executable(AuthServer${SOURCE_FILES}) endif() target_include_directories(AuthServer PUBLIC ${CMAKE_SOURCE_DIR}/../Include) target_link_libraries(AuthServer PUBLIC${BOOST_LIBRARY_chrono} ${BOOST_LIBRARY_atomic}${BOOST_LIBRARY_date_time} ${BOOST_LIBRARY_regex}${BOOST_LIBRARY_thread} ${BOOST_LIBRARY_system}${BOOST_LIBRARY_iostreams} ${BOOST_LIBRARY_zlib}${LIBRARY_ossl_ssl} ${LIBRARY_ossl_crypto} ) set_target_properties(AuthServer PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME}" ) Command to build OpenSSL (mingw msys2) :$ ./Configure mingw64 no-shared no-asm --prefix=/C/OpenSSL-x64 $make && make install linklibs.rsp : C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_chrono-mgw63-mt-d-1_65_1.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_atomic-mgw63-mt-d-1_65_1.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_date_time-mgw63-mt-d-1_65_1.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_regex-mgw63-mt-d-1_65_1.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_thread-mgw63-mt-d-1_65_1.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_system-mgw63-mt-d-1_65_1.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_iostreams-mgw63-mt-d-1_65_1.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_zlib-mgw63-mt-d-1_65_1.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libssl.a C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libcrypto.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lws2_32 -lwsock32 -lmswsock -ldl -lpthread nm of crypto : myuser@LHCFB203 MINGW64 ~$ nm /C/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libcrypto.a | grep 'CONF_modules_unload' 00000000000005c0 T CONF_modules_unload myuser@LHCFB203 MINGW64 ~ \$ nm /C/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libcrypto.a | grep 'ERR_reason_error_string' 0000000000004de0 T ERR_reason_error_string I'm really lost here. What did I do wrong ? rXp
23. ## OpenGL Texture buffers and UBOs

I am currently implementing UBOs and Buffer Textures in an effort to go from using glUniforms which are quite decent performance to something more per-frame and per-world-transition. I have a few thousands of mesh chunks that are generated for coordinate (0, 0) so that I can translate them wherever I need. I'm now doing the translation with a glUniform call each time I make a draw call. I would like to transition away from this by using UBOs (once per frame to setup all per-frame stuff) and then using texture buffers to translate and get better control over chunks. 1. Is this new method much faster than before? If the answer is no, it might not be worth it for me 2. How do I make sure that a given mesh that knows nothing about itself can sample from the right index in the texture buffer? There might be a ray of hope here if each draw call could be numbered from 0 .... N-1. EDIT: I baked in a mesh ID in all meshes and used a vec3 buffer texture as translation to avoid setting any kind of uniform data at all. I didn't notice any performance improvements.
24. ## C++ Showing or hide variables[Unreal engine 4]

Hi there, I would like to make a quick question for unreal engine. I have a master class called Door, and this door has 3 variables, aimationDuration, Start Delay and an Enum with 2 options - ClosingDoor and OpeningDoor. Now, I would like to know if its possible when I choose ClosingDoor, on the editor just to appear the animationDuration variable and hide the StartDelay variable, and then choose the openingDoor and hide the animationDuration and show the StartDelay. Is this possible? or has another way to this? Thank you
25. ## DX11 Frustum culling Rastertek Tutorial - Need urgent help!

Hi, there's a great tutorial on frustum culling, but impossible to compile because it uses old DirectX 11 types (Direct3DXPlane instead of XMVECTOR, etc). Can someone please help me update this one class - frustumClass - to the new DirectX11 types (XMMATRIX, XMVECTOR, etc)? http://www.rastertek.com/dx11tut16.html Furthermore, can anyone please explain how he gets the minimum Z distance from the projection matrix by dividing one element by another? He leaves no explanation for this math and it's extremely frustrating. // Calculate the minimum Z distance in the frustum. zMinimum = -projectionMatrix._43 / projectionMatrix._33; r = screenDepth / (screenDepth - zMinimum); projectionMatrix._33 = r; projectionMatrix._43 = -r * zMinimum; Also not sure how to use an XMVECTOR instead of the old Plane class that he uses. Confused as to where all the m12, m13, etc correspond to the elements of an XMVECTOR. I thought you're not supposed to even access the elements of an XMVECTOR directly! So incredibly frustrating. Please help, thanks.