Hi all.
I'm currently working on a project using C++ and DirectX9 and I'm looking into creating a light source which varies in colour as time goes on.
I know C++ has a timeGetTime() function, but was wondering if anyone knows of a function in HLSL that will allow me to do this?
Regards.
Mike.
...
hey guys,
i've got a bit problem. my program throws segmentation fault when returning zero in main
the main function looks like this
int main(int argc, char* argv[]){
ifstream fs("test.dat", ios::binary);
cSendStream sendstr(&fs,20);
char *zomg=sendstr.data();
//zomg[20]=0;
sendstr.read(20);
cout<<"Buffer: "<<sendstr.data()<<en...
hello
how can I set the current drive in c++?
this is how I set the directory but i'm unable to change the drive like this(duh) but I cant find anything on the msdn site...
anybody know this?
thanks
...
I have the text edit box as a chat window, but I was wondering if there was a way to set the scroll bar to be at the bottom to show the most updated message.
I am currently using Qt3 and C++.
chat_box->.... I tried looking and was only able to find "ScrollBarMode" but it only lets me turn it on or off or auto... which doesn't really he...
Ok I know the title doesn't fully explain this question. So I'm writing a program that performs a large number of calculations and I'm trying to optimize it so that it won't run quite so slow. I have a function that is a member of a class that gets called around 5 million times. This is the function:
void PointCamera::GetRay(float x, fl...
I'm working with a library that redefines NULL. It causes some problems with other parts of my program. I'm not sure what I can do about it. Any idea? My program's in C++, the library's in C.
#ifdef NULL
#undef NULL
#endif
/**
* NULL define.
*/
#define NULL ((void *) 0)
Oh, and it produces these errors:
Generic.h:67: error: def...
I was trying to incorporate the Singleton design pattern into my code, but I started getting a weird error:
main.obj : error LNK2005: "private: static class gameState * gameState::state" (?state@gameState@@0PAV1@A) already defined in gameState.obj
If you're not familiar with the singleton pattern, it is basically used to enforce only ...
I have a vector class that has addition, multiplication, subtraction, division, etc operators. I'm trying to optimize my program (which does a lot of vector operations) and I'm realizing that about 50% of the time spent is in constructing and destructing vectors. I understand that this is because every time I call a non-compound mathemat...
Yet another question, go me!...
Anyway, I have 2 classes with private constructors and static functions to return an instance of that class.
Everything was fine, I have a main.cpp file where I managed to get hold of my gameState object pointer, by doing:
gameState *state = gameState::Instance();
But now I seem to have a problem. For t...
Hi,
I am in need of a hash_map class in C++(STL). Primary operation is to put pair in the set and then check if it exists or not.
I am unable to find a sample code which does it to know if what I am declaration correctly or not.
#include <iostream>
#include <hash_map>
using namespace std;
using namespace __gnu_cxx;
typedef pair<int,...
I'm looking for an API (or some information as to where to look/start) that will ultimately allow me to monitor sound being played by the computer.
My end goal (well, certain to eventually be a stepping-stone) is an oscilloscope.
Where should I begin to look (aside from Google, which has yielded unsatisfactory results) to learn more a...
I have a pair
I know the value of the pair.first cannot be more than 1000.
I also know that the pair.second , the string, is always 1 word. Never more than 1 word.
So, to construct the Hash value for the pair I am doing the following:
pair<int,string> p;
hash<char*> H;
hash_vale = H(p.second)*1000 + p.first;
I think this will give uni...
Ok, this is veeery weird... I think. What I mean with the title is:
inside the act() function from an actionHandler object I have:
state->getHumanPieces();
Which gives me an address violation of some sort, apparently 'this' does not have a 'state' variable initialized... It so happens this actionHandler class has a static variable, w...
I can't do this in C++
string temp = "123";
int t = atoi(temp);
why????
...
A friend of mine showed me a situation where reading characters produced unexpected behaviour. Reading the character '¤' caused his program to crash. I was able to conclude that '¤' is 164 decimal so it's over the ASCII range.
We noticed the behaviour on '¤' but any character >127 seems to show the problem. The question is how would we ...
What will happen when we subclass a windows dialog and dialog is closed?
Scenario is that I am subclassing a dialog and application can launch many instances of that dialog.
Is it necessary to add unsubclassing code to all the dialogs in thier destruction logic.
I think when dialogs get closed there is no need to unsubclass them becau...
I'm writing a program right now which produces four unsigned 32-bit integers as output from a certain function. I'm wanting to hash these four integers, so I can compare the output of this function to future outputs.
I'm having trouble writing a decent hashing function though. When I originally wrote this code, I threw in a simple addit...
I'm trying to learn the basics of C++ by going through some Project Euler problems. I've made it to...#2.
Each new term in the Fibonacci
sequence is generated by adding the
previous two terms. By starting with 1
and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Find the sum of all the even-valu...
Is there some way to filter what files Visual Studio 2005 (C++) steps into?
For example, when stepping into
SomeFn( a.c_str(), b.c_str(), etc );
I hate how it steps into the standard template library files for c_str() - instead I just want to go into SomeFn().
If there was some way to filter out any source files didn't live in the ...
(I don't have a serious need for this answer, I am just inquisitive.)
Can every if-else construct be replaced by an equivalent conditional expression using the conditional operator ?:?
...