• What do you need help with? Version 5
    5,752 replies, posted
[QUOTE=raBBish;36991667]It's old. That's a function definition without a name. Takes two ints, returns one.[/QUOTE] Thanks.
Actually that's function type definition, isn't it? Sort of like function pointers except... Not pointers.
[QUOTE=esalaka;36992548]Actually that's function type definition, isn't it? Sort of like function pointers except... Not pointers.[/QUOTE] It is a template class that can take function pointers, bind expressions and lambda expressions, at least to my understanding.
[QUOTE=HubmaN;36991592]How old is the "int (int, int)" portion of the syntax? I'm not familiar with it - it seems like an awfully application-specific way to pass in a parameter pack. [code] std::function<int (int, int)> func; [/code][/QUOTE] Not really, you can set that to a function with an entirely different signature using std::bind.
How exactly should I do the AABB/physics between all my objects? ATM I do this: [cpp] for (int i = 0; i < Objects.size(); i++) { if(Objects[i]->isPlayer()) Objects[i]->needsUpdate = true; for (int j = i+1; j < Objects.size(); j++) { if(Objects[i]->isColliding(*Objects[j])) { //do nothing yet } } } bool PhysicsObj::isColliding(PhysicsObj &po) { if(this == &po) return false; if(needsUpdate) { oldPosition = currPos; needsUpdate = false; velocity += gravity * game->getDelta(); } if(po.needsUpdate) { po.oldPosition = po.currPos; po.needsUpdate = false; } sf::FloatRect thisRect = sf::FloatRect(currPos + velocity, bbSize); sf::FloatRect poRect = sf::FloatRect(po.currPos, po.bbSize); bool colide = thisRect.intersects(poRect); if(colide) velocity.y = 0.0f; currPos += velocity; sprite.setPosition(currPos); return colide; } [/cpp] the player is meant to hit the tile under it but it doesnt
[QUOTE=AlienCat;36959251]What? What do you mean with visual?[/QUOTE] that can make graphics for games and such easier.
If you want to do games, try SFML for C++. I wouldn't suggest switching languages entirely just for that. SFML will help you do 2D games, and if you want to do 3D, there are libraries for that too (I'm not sure which are good but hopefully someone else will suggest some.)
[QUOTE=krazipanda;36995304]that can make graphics for games and such easier.[/QUOTE] None of tem make graphics, they display them. And pretty much all programming language will use the same API for doing this OGL/DX they just might happen to have a more simle wrapper for it. That said SFML which is the generally preffered one here is pretty much the sme in both C++ and C#
[QUOTE=ShaunOfTheLive;36995490]If you want to do games, try SFML for C++. I wouldn't suggest switching languages entirely just for that. SFML will help you do 2D games, and if you want to do 3D, there are libraries for that too (I'm not sure which are good but hopefully someone else will suggest some.)[/QUOTE] I switched to C++ just for SFML 2.0 and I think it was worth it. Though I knew C and was already familiar with other OOP languages so it was an easy transition.
[QUOTE=Richy19;36995510]None of tem make graphics, they display them. And pretty much all programming language will use the same API for doing this OGL/DX they just might happen to have a more simle wrapper for it. That said SFML which is the generally preffered one here is pretty much the sme in both C++ and C#[/QUOTE] Sorry, I phrased that pretty terribly. From what I have seen and heard, it is harder to make a GUI/workable graphics engine on c++ than it is on c#. [editline]29th July 2012[/editline] I'll try using SFML though, thanks for the tip.
Anyone know where to learn coding for UDK? I am trying to find an area as I want to learn coding for it but can't find anything specific.
[QUOTE=krazipanda;36997324]From what I have seen and heard, it is harder to make a GUI/workable graphics engine on c++ than it is on c#.[/QUOTE] No language is really "harder" (well, no OOP language), it's just that C# has more stuff built-in, whereas with C++ you have to use more third-party libraries. And C# has XNA for making DirectX games.
[QUOTE=krazipanda;36997324]Sorry, I phrased that pretty terribly. From what I have seen and heard, it is harder to make a GUI/workable graphics engine on c++ than it is on c#. [editline]29th July 2012[/editline] I'll try using SFML though, thanks for the tip.[/QUOTE] I rated you agree thinking it's harder to design a workable engine on c++ than c#, but then I realized it's the same difficulty because the hardest part is making a good design. I can help you out with good c++ engine design if you add me on steam. I've got it down really good with my fourth engine redesign with design ideas stolen from kopini which were stolen from the irrlicht engine. You can find the github page here: [url]https://github.com/naelstrof/Astrostruct[/url]
Actually, the only difficulties you can have with C++ is the memory management. You have to do it by hand, or use smart pointers. Should I switch to C++? I can use it like C#, I just don't know if I would have any more advantages over C# other than performance. Also should I use the boost library?
[QUOTE=TH3_L33T;36997905]Anyone know where to learn coding for UDK? I am trying to find an area as I want to learn coding for it but can't find anything specific.[/QUOTE] I'd say read through the code in the SDK to learn more about it, but other than that, there's the Unreal Developer Network.
Perhaps a silly question, but for some reason I'm unable to decide on a method for solving this problem... I have a Button class in XNA, and I want to have the option to make a Button with an animated texture. Should I make an entirely new AnimatedButton class, or should I just add another constructor to my Button class to accept an animated texture object, then update the Button code accordingly so it can handle the absence of the standard texture and deal with the animated one? I can't figure out which is neater, for some reason
Whichever would you guys prefer? size_t or unsigned int? I'm currently using unsigned int, after having transfered from size_t as it required <cstring>.
[QUOTE=ichiman94;37000172]Actually, the only difficulties you can have with C++ is the memory management. You have to do it by hand, or use smart pointers. Should I switch to C++? I can use it like C#, I just don't know if I would have any more advantages over C# other than performance. Also should I use the boost library?[/QUOTE] Don't learn C++ just because, stick to C# if you're comfortable with it. I personally only use C++ for low-level software development and use C# for regular applications.
[QUOTE=T3hGamerDK;37003497]Whichever would you guys prefer? size_t or unsigned int? I'm currently using unsigned int, after having transfered from size_t as it required <cstring>.[/QUOTE] size_t
[QUOTE=Overv;37004171]Don't learn C++ just because, stick to C# if you're comfortable with it. I personally only use C++ for low-level software development and use C# for regular applications.[/QUOTE] Uh, I said that I'm already comfortable with C++ as much as with C#. I just wanted to know if I would benefit much more with using C++.
[QUOTE=ichiman94;37006228]Uh, I said that I'm already comfortable with C++ as much as with C#. I just wanted to know if I would benefit much more with using C++.[/QUOTE] If you can produce better final machine code than the .NET JITter then you might see performance gains. Mostly with algorithms that can be implemented very efficiently on a low level, I guess. Not really anything significant in programs that don't need to get every little bit of power the comp can give them.
[QUOTE=Overv;37004171]Don't learn C++ just because, stick to C# if you're comfortable with it. I personally only use C++ for low-level software development and use C# for regular applications.[/QUOTE] Uh, I said that I'm already comfortable with C++ as much as with C#. I just wanted to know if I would benefit much more with using C++.
It's in fact very easy to write slower code in C++ than in C# as well. Just choose the tools that suit you and your project and [B]then[/B] if you have issues, optimise. You [B]can[/B] call native code from .NET programs and if you really have a massive overhead due to things being managed... Do that? [editline]30th July 2012[/editline] Wait, what the fuck just happened
[QUOTE=T3hGamerDK;37003497]Whichever would you guys prefer? size_t or unsigned int? I'm currently using unsigned int, after having transfered from size_t as it required <cstring>.[/QUOTE] size_t is usually the same size as a pointer (on most sane architectures)
So I'm learning java, not sure if this is the right place. I can't seem to get the substring right. Example of a code in the course I am taking where myCountry is a variable [code]console.log(myCountry).substring(0,3);[/code]
[QUOTE=Confuzzed Otto;37015890]So I'm learning java, not sure if this is the right place. I can't seem to get the substring right. Example of a code in the course I am taking where myCountry is a variable [code]console.log(myCountry).substring(0,3);[/code][/QUOTE] [code]console.log(myCountry.substring(0, 3));[/code]
[QUOTE=Confuzzed Otto;37015890]So I'm learning java, not sure if this is the right place. I can't seem to get the substring right. Example of a code in the course I am taking where myCountry is a variable [code]console.log(myCountry).substring(0,3);[/code][/QUOTE] That's JavaScript, not Java. This code should work. Remember you're taking the substring of the country name, not the logging event itself. [code]console.log(myCountry.substring(0, 3));[/code]
Oh, I see. Thanks! [editline]31st July 2012[/editline] God damnit, this is so confusing. The course told me to make my own if/else statement, I make one that I think is working as no errors show up, but the course says this: [quote]Oops, try again. You did not log the correct string to the console![/quote] My code: [code]if (1 === 1) { console.log("This is horrendous"); } else { console.log("Something went wrong"); }[/code]
[QUOTE=Confuzzed Otto;37016091]Oh, I see. Thanks! [editline]31st July 2012[/editline] God damnit, this is so confusing. The course told me to make my own if/else statement, I make one that I think is working as no errors show up, but the course says this: My code: [code]if (1 === 1) { console.log("This is horrendous"); } else { console.log("Something went wrong"); }[/code][/QUOTE] Sounds like a shitty course if you ask me. I do not get what you are trying to do, or are supposed to do. Oh, I see now, you put "===", it should be "==".
[QUOTE=AlienCat;37017696]Sounds like a shitty course if you ask me. I do not get what you are trying to do, or are supposed to do. Oh, I see now, you put "===", it should be "==".[/QUOTE] "===" checks for equality of the type and the value, whereas "==" just checks for equality of the value. Changing to "==" wouldn't make a difference in this case.
Sorry, you need to Log In to post a reply to this thread.