|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On December 05 2013 02:01 ThatGuy wrote: Then let's continue the investigation ^^ can I see the CState.h? :D
Yeah alright.
+ Show Spoiler +#ifndef CSTATE_H #define CSTATE_H
#include <SFML/System.hpp> #include <SFML/Graphics.hpp>
/** * Class CState * Description: Acts as a base class for all different game states. **/
//namespace tpe {
class CGame;
class CState { // Our state manager needs full access. friend class CStateMachine; public: // == Constructors CState(); virtual ~CState();
// == Methods virtual void OnInit(CGame* _game);
virtual void OnDestroy(CGame* _game);
virtual bool OnLoop(CGame* _game);
virtual bool OnDraw(CGame* _game);
virtual void OnEvent(CGame* _game); protected: // == Members
/** * Local time, keeps track of time since start of this state. */ sf::Time m_localTime; /** * This state ID */ unsigned int m_stateId; };
//}
#endif
|
Hyrule19167 Posts
what the hell is going on with your whitespace
also, comments for everything are counter-productive, especially if you're naming stuff properly
|
On December 05 2013 02:46 tofucake wrote: what the hell is going on with your whitespace
also, comments for everything are counter-productive, especially if you're naming stuff properly
As a noob I like to keep it clean and comment a lot so I easily can see what I was thinking when I made the shit. Might not be needed for everyone but I like it. But thank you for your productive comment.
|
Hyrule19167 Posts
|
On December 05 2013 02:54 tofucake wrote: don't sass me
sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.
|
Nausea,
did you try this ?
bool CStateMachine::SetState(CState* _state, tpe::CGame* const _game, unsigned int _id);
|
@Nausea: First some general tips: Your prefixes are really confusing, I know that you learn that kind of stuff in books but in reality it makes your code less readable. Exception for this is "m_" or "_" for member functions/variables. Also, never ever use Init() and Destroy() functions. Thats what Constructors and Destructors are for!
That being said: Could you please post the implementation of the class where you actually call the function? Header and implementation of CGame? Your error is almost 100% due to wrong declration. Try using tpe::CGame*.
EDIT: Derp
|
On December 05 2013 03:23 Rombur wrote: Nausea,
did you try this ?
bool CStateMachine::SetState(CState* _state, tpe::CGame* const _game, unsigned int _id);
I actually just solved the problem. This error actually had nothing to do with it. And when the other stuff got fixed, this one solved itself. Thank you all for trying to help me tho
|
Hyrule19167 Posts
On December 05 2013 03:21 Nausea wrote:sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic. It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.
|
On December 05 2013 03:32 Nausea wrote:Show nested quote +On December 05 2013 03:23 Rombur wrote: Nausea,
did you try this ?
bool CStateMachine::SetState(CState* _state, tpe::CGame* const _game, unsigned int _id);
I actually just solved the problem. This error actually had nothing to do with it. And when the other stuff got fixed, this one solved itself. Thank you all for trying to help me tho 
What was the issue, may I ask? 
Glad you solved your problem, and GL with your project! SFML rocks!
|
What was the problem? I wanted to figure it out too .
On December 05 2013 03:24 KeksX wrote: @Nausea: First some general tips: Your prefixes are really confusing, I know that you learn that kind of stuff in books but in reality it makes your code less readable. Exception for this is "m_" or "_" for member functions/variables. Also, never ever use Init() and Destroy() functions. Thats what Constructors and Destructors are for!
That being said: Could you please post the implementation of the class where you actually call the function? Header and implementation of CGame? Your error is almost 100% due to wrong declration. Try using tpe::CGame*.
EDIT: Derp
Init and Destroy are useful for pooling, in case you want to avoid the object creation overhead. Considering that his code looks oriented for a game, it doesn't seem implausible. As for the prefixes, if they are event callbacks, then they seem appropriate; otherwise I would agree.
|
On December 05 2013 03:43 KeksX wrote:Show nested quote +On December 05 2013 03:32 Nausea wrote:On December 05 2013 03:23 Rombur wrote: Nausea,
did you try this ?
bool CStateMachine::SetState(CState* _state, tpe::CGame* const _game, unsigned int _id);
I actually just solved the problem. This error actually had nothing to do with it. And when the other stuff got fixed, this one solved itself. Thank you all for trying to help me tho  What was the issue, may I ask?  Glad you solved your problem, and GL with your project! SFML rocks!
Was a pretty simple problem, almost so simple I don't want to tell you xD I have the state class as a base class for other states. and the other states are kept outside the tpe namespace. So I needed to make sure they inherit tpe::CState och that all CGame* are prefixed with tpe::.
Oh well, at least I learned something.
|
On December 05 2013 03:44 ThatGuy wrote:What was the problem? I wanted to figure it out too  . Show nested quote +On December 05 2013 03:24 KeksX wrote: @Nausea: First some general tips: Your prefixes are really confusing, I know that you learn that kind of stuff in books but in reality it makes your code less readable. Exception for this is "m_" or "_" for member functions/variables. Also, never ever use Init() and Destroy() functions. Thats what Constructors and Destructors are for!
That being said: Could you please post the implementation of the class where you actually call the function? Header and implementation of CGame? Your error is almost 100% due to wrong declration. Try using tpe::CGame*.
EDIT: Derp Init and Destroy are useful for pooling, in case you want to avoid the object creation overhead. Considering that his code looks oriented for a game, it doesn't seem implausible. As for the prefixes, if they are event callbacks, then they seem appropriate; otherwise I would agree.
That is true, but I think it's bad practice if you do not explicitly need it. Especially for beginners it tends to manifest and eventually they will always use Init() and Destroy() even though it is practically useless.
Using c for Callbacks is acceptable, but I prefer to just write out "CallbackX" or "XCallback" to clarify, but thats just personal preference I guess.
@Nausea: The simple errors are those that will haunt you allll the time. Gj for fixing it! :D
|
On December 05 2013 03:40 tofucake wrote:Show nested quote +On December 05 2013 03:21 Nausea wrote:On December 05 2013 02:54 tofucake wrote: don't sass me sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic. It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.
Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code.
|
On December 05 2013 04:07 Nausea wrote:Show nested quote +On December 05 2013 03:40 tofucake wrote:On December 05 2013 03:21 Nausea wrote:On December 05 2013 02:54 tofucake wrote: don't sass me sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic. It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely. Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code. I'm fairly sure it's because you use actual tabs in your source code as opposed to 4 spaces (usually your code editor has an option to replace tabs with N spaces).
|
On December 05 2013 04:29 spinesheath wrote:Show nested quote +On December 05 2013 04:07 Nausea wrote:On December 05 2013 03:40 tofucake wrote:On December 05 2013 03:21 Nausea wrote:On December 05 2013 02:54 tofucake wrote: don't sass me sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic. It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely. Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code. I'm fairly sure it's because you use actual tabs in your source code as opposed to 4 spaces (usually your code editor has an option to replace tabs with N spaces).
Aha! Ok, thank you. May look into that.
|
On December 05 2013 03:40 tofucake wrote:Show nested quote +On December 05 2013 03:21 Nausea wrote:On December 05 2013 02:54 tofucake wrote: don't sass me sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic. It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.
ROFL
oh come on, that was pretty funny. And I thought he was being genuine when he thanked you. He's Swedish bro... for someone whose first language may or may not be English, I would be perfectly willing to believe they said that meaning well. But then again he did burn you fucking HARD for someone who doesn't speak good English afterwards... oh well, it was funny either way ^^
|
Hyrule19167 Posts
bah, swedes all speak better english than native speakers anyway
|
On December 05 2013 04:29 spinesheath wrote:Show nested quote +On December 05 2013 04:07 Nausea wrote:On December 05 2013 03:40 tofucake wrote:On December 05 2013 03:21 Nausea wrote:On December 05 2013 02:54 tofucake wrote: don't sass me sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic. It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely. Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code. I'm fairly sure it's because you use actual tabs in your source code as opposed to 4 spaces (usually your code editor has an option to replace tabs with N spaces).
Hm, I know that python will for some reason derp if you use 4 spaces and tabs in the same file. Do you think using 4 spaces is advantageous/better pratice than using tabs? I always used tabs and I only started seeing the 4 spaces from python code in the web.
|
On December 05 2013 05:08 misirlou wrote:Show nested quote +On December 05 2013 04:29 spinesheath wrote:On December 05 2013 04:07 Nausea wrote:On December 05 2013 03:40 tofucake wrote:On December 05 2013 03:21 Nausea wrote:On December 05 2013 02:54 tofucake wrote: don't sass me sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic. It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely. Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code. I'm fairly sure it's because you use actual tabs in your source code as opposed to 4 spaces (usually your code editor has an option to replace tabs with N spaces). Hm, I know that python will for some reason derp if you use 4 spaces and tabs in the same file. Do you think using 4 spaces is advantageous/better pratice than using tabs? I always used tabs and I only started seeing the 4 spaces from python code in the web. Tabs have more potential to mess up layouts. Spaces are always 1 character wide in monospaced fonts, which you will generally use for programming. Tabs usually are either 4 or 8 spaces wide, and sometimes you can adjust their width to whatever you like. You can't always make sure your tabs are displayed with the width. For example, the code browser on Sourceforge seems to use 8 spaces wide tabs.
Tabs have some minor advantages for editing code (less characters to move through or delete), but I don't really miss those having switched to spaces fairly recently. Especially because I'm usually not navigating single characters but rather use stuff like ctrl+arrow or end.
The advantages of using spaces over tabs aren't exactly massive either, though. I don't know a situation where it matters other than pasting code into different text display programs.
|
|
|
|
|
|