• What do you need help with? Version 1
    5,001 replies, posted
-snip- Oops, lack of sleep led me to horribly misread the code.
[QUOTE=Whitewater;22943749]I'm getting a really strange error when trying to compile some code in MSVC++, I'll post the error here, and link the code [url=http://pastebin.com/0bDFrnZ6]here[/url], [url=http://pastebin.com/ccn3cz9c]and here[/url]. The error is [cpp]1>bitmap.obj : error LNK2019: unresolved external symbol "bool const __cdecl Bitmap::GetGLTexture(class Bitmap::File const &,unsigned int &)" (?GetGLTexture@Bitmap@@YA?B_NABVFile@1@AAI@Z) referenced in function "bool const __cdecl Bitmap::GetGLTexture(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int &)" (?GetGLTexture@Bitmap@@YA?B_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAI@Z) 1>main.obj : error LNK2001: unresolved external symbol "bool const __cdecl Bitmap::GetGLTexture(class Bitmap::File const &,unsigned int &)" (?GetGLTexture@Bitmap@@YA?B_NABVFile@1@AAI@Z)[/cpp][/QUOTE] You're missing the File for your GetGLTexture-implementations. [editline]12:03PM[/editline] @silentjubjub: The toupper stuff can be easily done via [cpp]gender[0] = toupper(gender[0]); if(gender != "F" || gender != "M") // something invalid was selected // do something intelligent, like ask again (a while-loop might be good instead just checking once)[/cpp] You must note that == is not the same as =. = is assignment, what you are using in some of your ifs, where you probably want to check for equality, what == is for. Some ifs are also lacking parenthesis: [cpp]if (activityLevel = "i") || (activityLevel = "I") // should be if(activityLevel == "i" || activityLevel == "I") // or if((activityLevel == "i") || (activityLevel == "I"))[/cpp]
[QUOTE=ZeekyHBomb;22946652] [cpp] if(gender != "F" || gender != "M") // something invalid was selected [/cpp][/QUOTE] Just a note, that || should be an && And double quotes should be single quotes if you're comparing a single character?
[QUOTE=Vampired;22949057]Just a note, that || should be an && And double quotes should be single quotes if you're comparing a single character?[/QUOTE] Isn't gender declared as a string not a char though? [code]string gender = "";[/code]
gender is a std::string and I believe that you cannot compare it with a char via operator== or !=. You could compare gender[0], but we wouldn't want the person to enter, say "Fuck" and let him get away with it. Another, quite fitting option would be having gender as a char rather as a std::string though, in which case comparing with a char would also of course work fine. Your statement about the logical and is quite right though. [editline]03:42PM[/editline] :ninja:
Good point. If the console says type 'M or F' I would just assume Fuck meant Female just because it's quicker
How can I make an app appear in the taskbar next to the steam and MSN and junk? (C#)
[QUOTE=Chad Mobile;22955167]How can I make an app appear in the taskbar next to the steam and MSN and junk? (C#)[/QUOTE] [url]http://www.developer.com/net/net/article.php/3336751/C-Tip-Placing-Your-C-Application-in-the-System-Tray.htm[/url]
[QUOTE=Dj-J3;22955195][url]http://www.developer.com/net/net/article.php/3336751/C-Tip-Placing-Your-C-Application-in-the-System-Tray.htm[/url][/QUOTE] I was about to post how easy it was to find that: [url]http://www.google.com/search?q=taskbar+icon+C%23[/url]
[QUOTE=Overv;22955214]I was about to post how easy it was to find that: [url]http://www.google.com/search?q=taskbar+icon+C%23[/url][/QUOTE] yeah
I can't find a 'ContextMenu' in Visual Studio. Is 'ContextMenuStrip' the same thing?
[QUOTE=Chad Mobile;22955750]I can't find a 'ContextMenu' in Visual Studio. Is 'ContextMenuStrip' the same thing?[/QUOTE] Yea, it's the same. Question, i wrote a code to check if there's a second screen hooked to the computer and if it's bigger than the primary. If it is, the code returns the bounds of the second one. If not it returns the primary screen bounds. It works, i just wanna make sure if it will work with more than 2 screens. Can anyone tell me? My code: [PHP] public static string GetScreenSize() { if (Screen.AllScreens.Length <= 1) { string ScreenX = Screen.PrimaryScreen.Bounds.Width.ToString(); string ScreenY = Screen.PrimaryScreen.Bounds.Height.ToString(); return ScreenX + "x" + ScreenY; } else { string ScreenY = null; string ScreenX = null; foreach (Screen screen in Screen.AllScreens) { if (screen.Bounds.Height > Screen.PrimaryScreen.Bounds.Height && screen.Bounds.Width > Screen.PrimaryScreen.Bounds.Width) { ScreenX = screen.Bounds.Width.ToString(); ScreenY = screen.Bounds.Height.ToString(); } else { ScreenX = Screen.PrimaryScreen.Bounds.Width.ToString(); ScreenY = Screen.PrimaryScreen.Bounds.Height.ToString(); } } return ScreenX + "x" + ScreenY; } }[/PHP]Kinda messy, but works with 2 monitors.
[cpp]public static string GetScreenSize() { Assert(Screen.AllScreens.Length >= 1); int width, height, pixels = 0; foreach(Screen screen in Screen.AllScreens) if(screen.Bounds.Width * screen.Bounds.Height > pixels) { width = screen.Bounds.Width; height = screen.Bounds.height; pixels = width * height; } return width.ToString() + "x" + height.ToString(); }[/cpp] cleaner
Writing a C++ program with SFML, the only asset required is a font. Is there some way I can attach the font file to the exe into one file?
[url=http://msdn.microsoft.com/en-us/library/3bka19x4(v=VS.80).aspx]Visual Studio[/url] [url=http://stackoverflow.com/questions/2627004/embedding-binary-blobs-using-gcc-mingw/2627243#2627243]MinGW/gcc[/url]
[QUOTE=Jallen;22974376]Writing a C++ program with SFML, the only asset required is a font. Is there some way I can attach the font file to the exe into one file?[/QUOTE] copy /b sfml-game.exe+somefont.ttf better-game.exe
Awesome, thanks.
I am trying to use the luaInterface for C# and I made a enemy object which has the fireBullet1 method. Now in the constructor of the enemy I am trying to register the function but I can't get it to work : [cpp] luaInterpreter.RegisterFunction("FireBullet1",this,this.GetType().GetMethod("FireBullet1")); [/cpp] Error : [code] Object reference not set to an instance of an object. [/code]
Are you sure that luaInterpreter is initialized?
Yes
Is the methods name fireBullet1 as you wrote in the post or FireBullet1 as you wrote in the code? The case is important.
FireBullet1 as in the code, sorry [editline]01:38PM[/editline] Found it, my function was private so I couldn't access it
[url]http://www.sfml-dev.org/forum/viewtopic.php?t=2790[/url] [code]Hello. I'm accessing pixel data directly but just doing image.SetPixel() is too slow. I read a while back that it's faster to simply work on my own array and then use Image::LoadFromPixels(). The problem with this is I can't seem to figure out how to get my pixel data from my image (Image::GetPixelsPtr() looks like what I want but ???), into a workable array, and then back into my image... So how do I do this? I'm using SFML 1.6 Thanks.[/code]
I am having troubles with removing bullets from my bullet list. For some reason whetever I add the remove part of the code some bullets seem to "Lagg" and what I mean with lagg is that somethimes they suddenly seem to move up(or slow down). Bulletlist update code : [cpp] for (int i = bulletList.Count - 1; i >= 0; i--) { bulletList[i].Think(gameTime); Rectangle collisionRectangle; Texture2D bulletTexture; switch (((Bullet)bulletList[i]).bulletType) { case 1: bulletTexture = Bullet1Texture; break; default: bulletTexture = Bullet1Texture; break; } if (((Bullet)bulletList[i]).collisionGroup == CollisionGroup.ENT_PLAYER) { collisionRectangle = FirstPlayer.collisionRectangle; } else { collisionRectangle = boss1.collisionRectangle; } Rectangle bulletRectangle = new Rectangle( (int)bulletList[i].position.X, (int)bulletList[i].position.Y, bulletTexture.Width, bulletTexture.Height ); if (!bulletRectangle.Intersects(collisionRectangle)) { if (bulletList[i].position.X < bounds.X || bulletList[i].position.X > bounds.Width || bulletList[i].position.Y < bounds.Y || bulletList[i].position.Y > bounds.Height) { bulletList.RemoveAt(i); i--; } } else { bulletList.RemoveAt(i); i--; } } [/cpp]
Kay, I'm making a pong thing, half for the contest half for experience. I've never really dealt with this kind of thing that requires a timestep and my movement speed and bouncing is freaking out beyond belief, how would I go about working with a timestep or whatever it is I need?
Add a time_t member in your game-class and set it to the current time. Then in your update function, pass the delta time (current_time - time_t_member) to multiply that to anything that should happen over time (e.g. position += velocity * dt;). When the update-loop is finished, set the time_t_member to the current time.
[QUOTE=NorthernGate;23004813]Kay, I'm making a pong thing, half for the contest half for experience. I've never really dealt with this kind of thing that requires a timestep and my movement speed and bouncing is freaking out beyond belief, how would I go about working with a timestep or whatever it is I need?[/QUOTE] [url]http://gafferongames.com/game-physics/fix-your-timestep/[/url]
hey i have a question about the set command in cmd. [Code] SYNTAX: (the /p is not necessary) set /p input= input here > echo %input% result: input here > hello hello [/code] when i enter nothing in the input and just press enter the program crashes. how do i make it go back to the beginning of the script by using the goto command... or make it just recognize that there is no input... so it looks like this in the program. [Code] input here > input here > input here > etc. [/code]
what do you mean "crashes"? You need to tell us what error occurs. Also, don't use > like that, it will error because it thinks you're trying to redirect the output to a file, but no file is specified.
[QUOTE=Z_guy;23005282][url]http://gafferongames.com/game-physics/fix-your-timestep/[/url][/QUOTE] That article is very helpful, but unfortunately it doesn't talk about collision detection (and none of the articles on his site really do, except for the one about networking). I know people (myself included) have been having problems figuring out what to do when some object is travelling at such a velocity that it travels a significant distance past the paddle (or whatever it has to bounce off of) in a single timestep. (although this is much more of a problem when you're simulating something that accelerates, like gravity, instead of constant speeds like Pong)
Sorry, you need to Log In to post a reply to this thread.