• What do you need help with? V. 3.0
    4,884 replies, posted
[QUOTE=FPSMango;31986763]Does anyone know why my solution in Visual C++ 2008 thinks the code is up to date even though it isn't, when I try to build it just gives me "Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped" Even though I have changed something and saved it. It seems to rebuild only if I delete the debug folder in my solution, anyone know what might be causing this?[/QUOTE] Are you sure the file you are changing is added to the solution?
Is: [code]JPanel panel = (JPanel)frame.getContentPane();[/code] The best way to get get the JPanel of a JFrame? [editline]28th August 2011[/editline] [QUOTE=FPSMango;31986763]Does anyone know why my solution in Visual C++ 2008 thinks the code is up to date even though it isn't, when I try to build it just gives me "Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped" Even though I have changed something and saved it. It seems to rebuild only if I delete the debug folder in my solution, anyone know what might be causing this?[/QUOTE] You can always go to Build -> Rebuild Solution.
Does anyone know of any good XNA voxel tutorials? I simply can't seem to wrap my head around the concept.
[QUOTE=Z_guy;31988650]Are you sure the file you are changing is added to the solution?[/QUOTE] As I said I save everything before building. [QUOTE=wdth2;31988858]You can always go to Build -> Rebuild Solution.[/QUOTE] That is the way I do it currently but it is very much unnecessary work just to run a debug build.
[QUOTE=wdth2;31988858]Is: [code]JPanel panel = (JPanel)frame.getContentPane();[/code] The best way to get get the JPanel of a JFrame? [editline]28th August 2011[/editline] You can always go to Build -> Rebuild Solution.[/QUOTE] Afaik its the only way
I'm working on a puzzle game and I'm trying to come up with a fake command line interface for it, so i can let the user type commands in a text box and have them appear above it kind of looking like dos prompt , and using a string compare to check for certain commands typed in. So I was wondering if anyone thinks that's a good way to go about it or whether they can suggest a good way to do this.
Depending on the programming language you use you are probably able to build an associative array from strings to functions. This would make the system quite comfortable to use and will most likely have a better time complexity.
[QUOTE=ZeekyHBomb;31994931]Depending on the programming language you use you are probably able to build an associative array from strings to functions. This would make the system quite comfortable to use and will most likely have a better time complexity.[/QUOTE] I'm working in C++ btw, forgot to mention. :) And that's great! :D Do you know where I could learn about building an associative array from strings to functions and how to use it in this fashion?
I asked this before but I didn't get much of an answer, how would one rotate a sprite?
[QUOTE=reevezy67;31995131]I asked this before but I didn't get much of an answer, how would one rotate a sprite?[/QUOTE] Depends entirely how you are rendering it. If you store it as a pixel array you just rotate the array and redraw it
Anyone know where to get pixel art resources for games?
[QUOTE=Richy19;31995318]Anyone know where to get pixel art resources for games?[/QUOTE] Make it your self or just google something -spritesheet
[QUOTE=TM Gmod;31995365]Make it your self or just google something -spritesheet[/QUOTE] I have already tried to, but I cant find any decent ones
[QUOTE=TM Gmod;31994889]I'm working on a puzzle game and I'm trying to come up with a fake command line interface for it, so i can let the user type commands in a text box and have them appear above it kind of looking like dos prompt , and using a string compare to check for certain commands typed in. So I was wondering if anyone thinks that's a good way to go about it or whether they can suggest a good way to do this.[/QUOTE] A console is always a good idea, is it meant to be for use by players in the game or just for debug/dev stuff?
[QUOTE=NovembrDobby;31995715]A console is always a good idea, is it meant to be for use by players in the game or just for debug/dev stuff?[/QUOTE] bit of both. It's the main control for the game, but i'll add a few commands for debugging. So the commands you enter will just be simple strings like "LEFT" and such But I'm making this all in a window that creates an OpenGL workspace so i dont know how to embed an win32 stuff inside that for my textbox and input.
I probably have of specified exactly what I wanted to know. I'm using XNA how do you rotate a sprite, I don't want the math I just don't know how i would set the angle its drawn at.
[QUOTE=reevezy67;31995787]I probably have of specified exactly what I wanted to know. I'm using XNA how do you rotate a sprite, I don't want the math I just don't know how i would set the angle its drawn at.[/QUOTE] Use one of the spriteBatch overloads: [code] SpriteBatch.Draw (Texture2D texture, Vector2 position, Rectangle? sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) SpriteBatch.Draw (Texture2D texture, Vector2 position, Rectangle? sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) [/code] rotation is the angle (in radians) to draw the texture at, and origin is the position in pixels on the texture that you want it to rotate around.
[csharp] spriteBatch.Draw(SpriteTexture, Position, null, Color.White, Rotation, Origin, Seffects, LayerDepth); [/csharp] This gave me an error saying it couldn't convert Position into a rectangle. Position is currently a Vector2 I thought the second argument was supposed to be a vector2? Changing that to a rectangle fixed the error but wouldn't let me set the position.
Have a close look at the overloads 5-7 of Draw(...) ! By the way: Rectangle rect = new Rectangle((int)Position.X, (int)Position.Y, SpriteSizeX, SpriteSizeY); call draw with this rect ?
[QUOTE=Felheart;31998463]Have a close look at the overloads 5-7 of Draw(...) ! By the way: Rectangle rect = new Rectangle((int)Position.X, (int)Position.Y, SpriteSizeX, SpriteSizeY); call draw with this rect ?[/QUOTE] Missed it thanks.
Is there an alternative to writing tons of "endl's" to center a text on screen after tons of "endl's" as an alternative to "system(cls)"? [code]if (game_over) { for (int i=0; i <20; i++) { cout << endl; } cout << "text to be centered here." << endl << endl << endl << endl << endl; cin.ignore();cin.get(); return 0; }[/code] le: or another for loop for the bottom spaces.
[QUOTE=TM Gmod;31995005]I'm working in C++ btw, forgot to mention. :) And that's great! :D Do you know where I could learn about building an associative array from strings to functions and how to use it in this fashion?[/QUOTE] Yeah, look up std::map and std::function (assuming you already know of std::string ;)). [QUOTE=WhatTheEf;32001502]Is there an alternative to writing tons of "endl's" to center a text on screen after tons of "endl's" as an alternative to "system(cls)"? [code]if (game_over) { for (int i=0; i <20; i++) { cout << endl; } cout << "text to be centered here." << endl << endl << endl << endl << endl; cin.ignore();cin.get(); return 0; }[/code] le: or another for loop for the bottom spaces. [/QUOTE] The WinAPI provides functions to move the cursor ([url=http://msdn.microsoft.com/en-us/library/ms686025(v=VS.85).aspx]SetConsoleCursorPosition[/url]) or write from a buffer to a certain position ([url=http://msdn.microsoft.com/en-us/library/ms687404(v=VS.85).aspx]WriteConsoleOutput[/url]). You can use [url=http://msdn.microsoft.com/en-us/library/ms683171(VS.85).aspx]GetConsoleScreenBufferInfo [/url] to obtain info about the size of the console. If you want ISO C++, then it's pretty much impossible, since you cannot get the width or height of the console. Btw, use '\n' for a new line, std::flush to flush the buffer and std::endl only if you want both.
Use a library like curses.
I've got a question about polymorphism in C++. Suppose I have a base class Base and 2 classes Derived1 and Derived2 both derived from Base. I have a pointer to Base. Is there any way to check if that pointer points also to Derived1 for example.
[QUOTE=sim642;32003257]I've got a question about polymorphism in C++. Suppose I have a base class Base and 2 classes Derived1 and Derived2 both derived from Base. I have a pointer to Base. Is there any way to check if that pointer points also to Derived1 for example.[/QUOTE] The proper way to do this would be to use [url=http://en.wikibooks.org/wiki/C++_Programming/RTTI]RTTI[/url].
I'm trying to get the spectrum data from a sound playing played via FMOD in my xna project but I have no idea why the getSpectrum is resulting in all 0s. Can anyone show me how to do it properly?
[QUOTE=q3k;32003359]The proper way to do this would be to use [url=http://en.wikibooks.org/wiki/C++_Programming/RTTI]RTTI[/url].[/QUOTE] It's a bit ugly since the names returned are dependent to the compiler. I guess I'll have to use those wierd names in my program then.
[QUOTE=sim642;32003874]It's a bit ugly since the names returned are dependent to the compiler. I guess I'll have to use those wierd names in my program then.[/QUOTE] You could just dynamic_cast it to the derived type and see if it works. If it does, you've got yourself a derived object.
[QUOTE=thf;32003949]You could just dynamic_cast it to the derived type and see if it works. If it does, you've got yourself a derived object.[/QUOTE] Although the link recommends using typeid over dynamic_cast when only type info is needed, I think I'll still use dynamic_cast since it's more portable.
[QUOTE=sim642;32003990]Although the link recommends using typeid over dynamic_cast when only type info is needed, I think I'll still use dynamic_cast since it's more portable.[/QUOTE] If you're going to use it as another type just after you've casted it if that was successful, you might as well use that.
Sorry, you need to Log In to post a reply to this thread.