C++ on Stack Overflow and Game Dev

0 answers

Should I expect problems depending on statically compiled library from VS?

I have a project in Visual Stuio 2012 Express. I also have the source of a mixed C and C++ library, along with makefiles for compiling with gcc. I compiled with gcc from MinGW and changed the project ...

0 answers

How to debug dynamic index buffer updates in DirectX11

// Get address from GPU for the CPU to write to D3D11_MAPPED_SUBRESOURCE indexResource; hr = g_pImmediateContext->Map(indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &indexResource); if ...

2 answers

clock() returns 0

When I run my code below I get a value 0, a few times I did get a value for the intAddition. I've tried many suggestions I found online, but have yet to prevail. My classmate showed me how he did his ...

2 answers | 12 mins ago by Ugluk on Stack Overflow stackoverflow.com
0 answers

Significant slowdown when adding threading

I've been working on making a model for the game Monopoly in C++. My model works and is reasonably fast, however my advisor wants me to add multithreading to speed it up. My system is Linux with gcc ...

5 answers

Should I use memcmp or chained equal-to operations when both give the same result?

Precondition: Consider such a class or struct T, that for two objects a and b of type T the following statement is true: memcmp(&a, &b, sizeof(T)) == 0 yields the same result as a.member1 ...

5 answers | 13 mins ago by zenith on Stack Overflow stackoverflow.com
0 answers

get a data type from a run-time given argument in C++

I want to have a type-generating functionality (need not to be a real function) that return a type from a run-time given parameter. For example,get_me_type('d') gives me int type. The following is my ...

1 answer

How to merge 2 textures into single SRV

I have 2 textures in 2 different ShaderResourceViews. What's the fastest/least expensive way to merge them into one? I would use CopySubresourceRegion but copying a texture is quite a bit expensive. ...

1 answers | 21 mins ago by Quest on Game Development gamedev.stackexchange.com
1 answer

Why some eigen vector signs from C++ Armadillo are different from Python and R

I was wondering why the sign of the elements in the eigen vectors from Armadillo is the opposite from other languages like Python (i.e. numpy) and R. For example: C++ using namespace arma; vec ...

0 answers

CUDA: How to fill a vector of dynamic size on device and return its contents to another device function?

I want to know which is the proper technique to fill an dynamic size array on device (int *row, in the code bellow) and then return its content, to be used by another device function. Aiming to ...

0 answers

Convert from CFURLRef or CFStringRef to std::string

How can I convert a CFURLRef to a C++ std::string? I also can convert from the CFURLRef to a CFStringRef by: CFStringRef CFURLGetString ( CFURLRef anURL ); But now I have the same problem. How can ...

0 answers

Check pointer handle is valid

I want to implement a Microsoft CryptographicServiceProvider library and currently I thinking about the best way how to deal with context handle which I create. My question is specific to this case ...

1 answer

What is the meaning of this linker warning and how I can fix it?

I am getting this warning during li king my application which uses several library, warning LNK4049: locally defined symbol ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ (public: virtual ...

1 answers | 28 mins ago by mans on Stack Overflow stackoverflow.com
5 answers

C++ Changing a decimal to octal, output backwards

So I wrote this small application that will convert a decimal to octal, and it is outputting the right answer only it's backwards. An example would be that if the answer to the conversion was 17, the ...

5 answers | 29 mins ago by user2970001 on Stack Overflow stackoverflow.com
4 answers

does C++ have a self initializing pointer

I am a bit embarrassed of asking such a simple question: Is there any pointer class in cpp that initializes itself with nullptr but is 100% compatible to a basic c-stylish pointer? to write: extern ...

4 answers | 31 mins ago by vlad_tepesch on Stack Overflow stackoverflow.com
1 answer

Qt build menu for touch screen

i want to build a QT application for windows/android. I have one mainwindow in which i have different buttons to call submenus, as you can see on the pictures. What do you think is the best ...

1 answers | 31 mins ago by Hunk on Stack Overflow stackoverflow.com
0 answers

Why does ncurses' start_color() darken regular text?

I'm currently creating a program using the ncurses library, but have ran into a problem while starting to implement colors. When I use the start_color() functions from ncurses, the default text color ...

1 answer

overload resolution fails for derived class

I am using a class mArray, which implements numerical data containers with variable dimensionality template <typename T> class mArray<T>: { ... std::vector<T> my_data; ...

3 answers

Trouble while writing an resiseable vector with std::vector

i'm a Brazilian beginner in c++ coding (apologize my poor knowledge in both things). I'm trying to write an .txt output file containing the positions of pixels i click with the mouse. I'm making use ...

3 answers | 33 mins ago by Kauê de Moraes Vestena on Stack Overflow stackoverflow.com
2 answers

error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' afxwin.h

I'm trying to make class responsible for putting some text on grey bg: Score.h #pragma once class Score { public: Score(); ~Score(); void UpdateScore(int points); void ...

2 answers | 36 mins ago by mielu on Stack Overflow stackoverflow.com
0 answers

Qt5 and Pattern for similar dialogs implementation

What is in your opinion the best way to implement similar dialogs in Qt5 without duplicating the code? This is the problem: having two "slightly different" data structures, with many common parts, ...

0 answers

how to get unsigned char value with SQLGetData()?

After successful connection to DB and fetching rows i try to put TINYINT age value from DB into variable yearbut it doesn't work. What i do wrong? ... std::string query_string = "SELECT username,age ...

3 answers

How to compare a template template with a template instance?

First, let me introduce you a partial solution: template <template <class...> class, typename ...> struct is_tbase_of: std::false_type { }; template <template ...

0 answers

paint background in mfc

I am experimenting with painting the background of a window in c++ using the MFC library. It is mandated that i use this framework because I am working on an MFC application. I have tried several ...

0 answers

NPM Install on Windows 7 issue, no Microsoft.CPP folder

I'm having troubles with npm install on Windows 7. I'm using Visual Studio 2013 Express and I've also installed Microsoft Build Tools 2013. I have the Path variable set and I've tried with the ...

0 answers

Function returning function is not allowed in typedef FOO(BAR)

I have a problem with a piece of code from SuperUser. I'm actually not sure what that syntax is even supposed to mean: typedef NTSTATUS( WINAPI* PNT_QUERY_SYSTEM_INFORMATION ) ( __in ...

1 answer

Using a shared pointer in a std::thread

I have a scenario where: I launch a new thread from within a dll that does some work. The dlls destructor could be called before the new thread finishes its work. If so I want to set a boolean flag ...

3 answers

vector referencing C++

Not sure if I’ve posted the right question for what I’m actually asking but here it is. I am trying to print the maximum and minimum rainfall from the sumofrain vector along with the corresponding ...

3 answers | 41 mins ago by louiej15 on Stack Overflow stackoverflow.com
1 answer

double precision error when converting to scientific notation

I'm building a program to to convert double values in to scientific value format(mantissa, exponent). Then I noticed the below 369.7900000000000 -> 3.6978999999999997428 68600000 -> ...

1 answer

Aggregate initialization of non-POD class types?

Is it legal to aggregate initialize non-POD class types in ISO C++? For example if we have a structure with a single method like this: struct T { operator double(); int a; int b; } ; ...

1 answers | 43 mins ago by FISOCPP on Stack Overflow stackoverflow.com
3 answers

Pathfinding for 2D tile map for multiple goals

I'm trying to create a simple grid-based game in C++. The pathfinding is necessary part of it. I've been searching, but there isn't what I am exactly looking for. The rules are simple. There is a ...

15 30 50 per page
1 2 3