202 Posted Topics
Re: You may get better responses to DirectX specific questions in the Game Development forum, or in the [URL="http://forums.xna.com/forums/"]XNA forums[/URL] (it's mostly centered on using the XNA tools with C#, but there are some forums on DirectX, and I do believe it's supposed to be the official DirectX forum). As to … | |
Re: It's always a good idea to post the specific errors you get from the compiler. I think you may be initializing your array incorrectly. Listing all the elements as you have done may not be the proper way to populate a multidimensional array. [CODE]void display_draw(int mega[12][6], int draw_index); [/CODE] This … | |
Re: Couldn't he also use pointers? [CODE] if( TTF_Init() < 0 ) { return 1; } Font* thing = new Font; delete thing; TTF_Quit(); [/CODE] | |
Re: Yes - std::strings are [COLOR="Green"]good[/COLOR]. char* and char arrays are [COLOR="Red"]bad[/COLOR]. In case you're wondering why you can't use the == operator with char*, think about it. buff is a pointer to a char. In other words, it contains the address of a single char, and so should be compared … | |
Hey, I'm running into some issues with delete[]. I have these lines: [CODE] delete[] temp1; delete[] temp2; [/CODE] in a loop. temp1 and temp2 are pointers to std::strings. In the first iteration of the loop, temp1 and temp2 are both NULL pointers. The statements work fine. In the second iteration, … | |
Re: [QUOTE=herms14;648813]it also doesn't work. I've tried it but my outputs are some strange symbols nothing else..[/QUOTE] Show us your file. How are the numbers separated? I would use the >> operator, not the get() method. Also, on further review, I seem some weird things in your loop. First, you read … | |
| |
Re: I learned C++ from C++ for Dummies. I enjoyed it, but I've heard bad things about it because it has typos. I did notice a couple of typos when going through it, but it was nothing I couldn't bare or make sense of. Still, there may be better books out … | |
Re: If you'd like to link to a lib through the compiler's interface rather than using #pragma, right-click on your project's name in the panel to the left, go down to properties, expand linker, go to input, and put the libraries names in the additional dependencies field, separated by spaces. | |
Re: @AncientDragon Doesn't the loop you give continually ask for strings until you enter one that doesn't have an 'i'? The original program just asked for one, and check if there was an 'i' in it, then ended. You can reduce lines 14-25 to [CODE] if( strchr(word,'i') ) { cout << … | |
Re: Do you want an example to explain classes in English, or in C++? Or perhaps both? Is there something specific about classes you don't understand? | |
Re: If you have a file, and you have pieces of data in the file seperated by whitespace, and you know the type and order of those pieces of data, you can just use an ifstream object. For example, if you have a file that has a string with someone's first … | |
Re: Data is very, [I]very[/I] important. To try and prove otherwise wouldn't make sense. If you mean create a program that ignores a piece of data: [CODE=C++] #include <iostream> using namespace std; int main() { int x; cin >> x; cout << "Hello\n\n"; cout << "We do not care about your … | |
Re: You may also want to consider learning the Windows API:[URL="http://winprog.org/tutorial/"]http://winprog.org/tutorial/[/URL] | |
Re: [QUOTE=Alex Edwards;647371]Hmm I wonder... [code=c++] typedef void VOID [/code] =P[/QUOTE] I'm pretty sure that exists too. I also love this one (not sure if its in Windows API or DirectX): [CODE=C++] #define 1 TRUE #define 0 FALSE typedef int BOOL; [/CODE] It's just a way to make types sort of … | |
Re: If you're on Windows: [ICODE]system("PAUSE");[/ICODE] may be what you're looking for, though you can't get the character that was pressed, if that's also what you wanted (wasn't sure). ![]() | |
Re: But wait, doesn't this work? [CODE=C++] int x; cin >> x; [/CODE] x is an int, not a reference to one. Is it different when you're dealing with function return types and just the data type of a variable? | |
Re: Do you know about [URL="http://www.cplusplus.com/doc/tutorial/templates.html"]templates[/URL]? You could create a Linked List template class to make things easier to understand. Though, on second thought, creating a linked list template class can be a hassle, and giving you one wouldn't teach you anything about linked lists. | |
Re: What type of program are you dealing with? A window? A console window? Most likely, the answer will lie somewhere in either the Direct3D (Microsoft), or OpenGL (open source) APIs. Look them up. | |
Re: C++ is powerful. As was mentioned, the JVM was written in C++. If you can't do something in another language, do it in C++. As is evident by the fact that the JVM is written in C++, you can create languages with C++. Almost all of the software you use … | |
Re: EDIT: Dave beat me to it, but read it anyway if you like (apparently I was missing a few things). [QUOTE=anuizath2007;646815]i didnt get you!!!![/QUOTE] Firstly, wrap your code in CODE tags, and specify a language (i.e. [ CODE = C++ ], w/o the spaces) so that there are numbers - … | |
Re: [QUOTE=iamthwee;646696]Well why do you have a return in the function, you shouldn't need one because you are passing back by reference.[/QUOTE] Wait, I'm not sure if he edited the code in the first post, but the function just had [ICODE]return;[/ICODE], not [ICODE]return someVal;[/ICODE]. It's not neccesary to include the return; … | |
Hey, I'm writing an XML parser in C++. Currently it works, but too much of what needs to be done is left up to the end user. I'm trying to figure out a way to have a clean, more encapsulated interface for the parser, but I can't seem to think … | |
Re: No one's going to do the homework for you. If you have some code that you're having problems with or if you have a basic layout for the program but need help moving forward, post that here. | |
Re: I think you would use the system() function. I'm no expert on the windows command line, but I think you can run programs from it. If so, you could pass a command to run firefox or ie, thought I'm not sure if you can pass the url as a command … | |
Re: The c-string temperatures is declared [ICODE]char *tempatures;[/ICODE], but never intialized. Then you try to use it in the constructor for temperature [ICODE]ofstream tempature(tempatures, ios::app);[/ICODE]. You need to tell the compiler what file to open. | |
Re: Like the others have said - post your specific problem. This isn't your error, but it's a bad idea to put function implementations in .h files. If you include the same .h file more than once in different files that are within the same projects, you will get issues. The … | |
Re: You would actually name the file myFile.h, not myFile.cpp. When you #include something you are basically taking the contents of the header (*.h) file and dumping them into your current .cpp file. If the file you need to include is in your current working directory (or if you're specifying an … | |
Re: Are you serious? It's bad enough people come here and ask for homework, but you actually named your post "Do my homework for me."? Read the forum rules, no one is going to do your homework for you. Also, doubly linked lists are NOT reffered to as DLLs. A DLL … | |
What's the difference exactly between opening a file stream in the default text mode and opening it in binary mode? The cplusplus.com article on file i/o mentioned a few things, but I really didn't get the gist of it. Could someone explain it? Thanks. | |
Re: I'm assuming it took many trained, experienced, professionals working an absolute minimum of 8 hours a day a couple of years to write the Unreal engine (again, an assumption). I'm not sure how much experience you have, but I don't think you're going to have too much luck witting an … | |
When using >> to extract data from an istream, are spaces skipped over? I.e., if I extracted every character from: "Hello, my name is not World.", would the 5 spaces not be read by >>? If so, is this behavior omitted from istream::get()? Thanks. | |
Re: I've always wondered, is this: [CODE]int atr = amountToReturn; [/CODE] a good/safe way of truncating the decimal portion of a float/double? Should it be type-cast? Or should you use the floor() function? | |
Re: No one's going to do this for you. If you have a specific question - ask that. To start off, do you know what a linked list is? | |
Hey, I'm attempting to write an XML parser in C++, and I have some questions on some XML syntax. First: what is the rule for what goes between the end of the last attribute and the end of a tag? E.g.: is this ok:[ICODE]<tag attribute="value" >[/ICODE]? is this ok:[ICODE]<tag attribute="value">[/ICODE]? … | |
Re: [QUOTE=Clockowl;641765]And that won't happen with the #ifndef "protection", if I'm right.[/QUOTE] I'm not so sure: if file A #includes file B, and file B #includes file A, and file A is #included by the main project first, then this will happen: file A #includes file B file B #includes file … | |
Does this code look right for centering an image on the screen (in this case a chess board): [CODE=C++] int Chess::Board::Center(int width,int height) { if(m_texture == NULL) return 0; D3DXVECTOR2 center; center.x = (float)width/2.0f; center.y = (float)height/2.0f; m_position.x = center.x - (m_texture->GetWidth())/2; m_position.y = center.y - (m_texture->GetHeight())/2; return 1; } … | |
Re: Practically [I]anything[/I] is possible in C++. They can be extremely difficult, but they tend to be possible. How much experience do you have with C++? The project you're talking about seems very ambitious. I definitely don't think I would be able to do it, and I'm doubtful that programs like … | |
Re: If you want a good deal of control over the sound, you might want to consider DirectSound (though using it can be very annoying and complex). If not, I believe there is a simple Windows function that you can use to play sounds asynchronously, but I can't remember it on … | |
Hey, I'm starting out Java development, and I want to know exactly what I need to download. I believe I need to download the JVM, but what else? And I know there are IDEs like NetBeans where you can just press a button to build and/or run the program, but … | |
Re: This function: [CODE] void ENTITY::SetLife(int newLife) { if (life < 0) life = 0; } [/CODE] Doesn't set the life at all. All it does is check to see if the current life is less than zero, and if so, sets it to zero. The input parameter is ignored. That's … | |
Re: If you select 1 without first setting x with 2, you may receive unexpected results. You haven't told us what's not working correctly, and I'm going to go ahead and assume that you want the variable x to retain its value even after the program closes. This is not what … | |
Re: Er... I'm not exactly sure what you're asking, but it sounds like you may be searching for the break command. Having [ICODE]break;[/ICODE] anywhere in a loop will end the current iteration and end the loop. If that's not it, then [ICODE]continue;[/ICODE] will end the current iteration, but instead of breaking … | |
Hey, I'm working on a chess game, and I'm creating two enumerations - for piece_color and piece_type. I'm wondering what the difference is (whether it's an actual difference in the way the program executes or a matter of good object-oriented practice) between having the enums be global or having them … | |
Re: Do you know any programming languages? Before using SDKs you're going to need some basic coding knowledge. C++ is probably what you should shoot for (if you've found XNA and used it, you would be using C#, Microsoft's variant of C++). Learn C++. Some people may say its too difficult … | |
Hey, I'm trying to run a simple DirectX program, it loads a model and displays it. I run it once, and it works. I run it again, doesn't work. Didn't change any code. Just recompiled, and it doesn't work. I'm not sure if the issue is with my computer (which … | |
Re: I do believe that older versions of the Unreal Engine (which is the engine used to make UT3 that you were referring to) are available at prices affordable by an average individual (vs. an entire gaming company or someone who's extremely rich). I heard somewhere that the very first version … | |
Hey, sorry if this is the wrong place for this, but... A while ago I was thinking of getting a new laptop. At first I was going to focus on battery life, but as time went by I saw myself caring less about that and more about a quality machine. … | |
Hey, sorry if this is in the wrong forum. My computer keeps crashing, causing it to restart, and I don't know why. Here's what I know: [LIST] [*]It's happened only on Windows XP [*]Its happened on one of my machines multiple times,and just started happening on my second [*]The crashes … | |
Hey, What will happen if you link to the same lib twice using #pragma? Will this cause an error, or if the lib is already being linked to, will the second #pragma be ignored? Thanks. |
The End.