Should I try to have 3ds give me a vertex list so I can use the model with directx or is there a better way?
Type: Posts; User: alanb
Should I try to have 3ds give me a vertex list so I can use the model with directx or is there a better way?
No, I wasn't, and I've moved that line (and others like it) to a constructor within the declaration, and I removed the instance names in the process. I can now access the members in that way from...
I began by removing it until I could compile cleanly, then I took the assignments collecting in the main .cpp and put them back into a constructor and all seems well.
void do_something(cPlayer &player); //declaration
:)
I tried duplicating the declaration just after it and removed the constructor and gave the floats a value. The compiler says - 'cPlayer' : 'class' type redefinition.
I was paraphrasing, sorry.
...
Should this work?
/* .h */
class cPlayer //declaration
{
public:
float x, y, z;
Thanks for the by reference suggestions and the info on pointers, this will help me in future.
I think I'll try a class. The more I think of it, the more it seems appropriate for later expansion.
Not sure but would a class seem overkill for three floats? Would the point be to fill the class with some of the surrounding code?
In one cpp file I have three particular variables and a loop. From within this loop I want to pass the three variables to a function in another cpp file. Before I do this I want to pass them to an...
OK, so I gather that global header files should be used judiciously and preferrably only semi-globally.
Say, I want to build a world. I have one file for starting and getting a window, one for...
Until now I have been putting all function declarations in a single global header file (except for those that have an obviously limited need of scope).
I am now considering putting all...
The access violation is a reading one. I began looking for an out of range subscript, and found one, also the exception was happening at 3 minutes from run.
Now it is happening at this line
...
I have a d3d program, that if I run it and leave it alone it will render a scene and wait for keyboard input but in a few minutes will come up with an unhandled exception (access violation) calling a...
Aha, I see.
It will take a while for me to un-learn inline programming. OOP has much potential but right now it just seems like a pain. Thanks for the assist.
Got it!
I moved it all into a function but I had 'undeclared' errors, then I realised that the two declarations needed a wider scope and I put them at the top of the file and the two next lines...
No, I'm doing it directly in the source file after some preprocessor stuff.
I'm trying to create a DX sprite...
LPD3DXSPRITE d3dspt;
LPDIRECT3DTEXTURE9 sprite;
D3DXCreateSprite(d3ddev, &d3dspt);
D3DXCreateTextureFromFile(d3ddev, L"panel1.png", &sprite);
...and I'm...
That's what I thought?
I figured since this question was not C++ specific.....I'll get the hang of it.
I have it working now I put the extern line in the header and the second line in only one source file. Thanks :)
These structs come from a library. When the compiler was suggesting I was defining...
I made it,
extern lpStruct var;
lpStruct var;
and included this in both source files. It gives: already defined in the second file. If I comment out the second line it gives 'unresolved...
I find that if I don't include the header file with the declarations into both source files (but just one), I get undeclared identifier errors. If I do, I get linker errors.
These declarations are...
OK, I have some global variables (structs) that I want to share across two source files and I've moved their declarations to the header of one of these files instead of the main header.
I've...
I can hardly believe it sounds so simple (wait, haven't tried it yet). Should every source file have its own header?
Would it also be OK to declare the functions in the header file corresponding...
I'm after a primer on how to deal with files. I want to learn things like: connecting .h with .c, how to call functions across different .c files, when/how often to include a file, whether a function...