• Content count

  • Joined

  • Last visited

Community Reputation

198 Neutral

About SriLumpa

  • Rank
  1. Android or PC?

    I'll try a different approach for giving my 2 cents First, you should come up with a game idea. Then, if that game would play nicely with a touchscreen, go for android. Otherwise PC. Comparing the development frameworks does not make much sense to me. Both platforms have good tools. I have tried libgdx and it's good. I have not tried SFML but people seem to like it, so it must be good too.
  2. It is called an "anonymous class", I think.
  3. toString() [Java]

    It does not seem possible. How about creating another method, like toString2, and "sometimes" call it instead of toString.
  4. Not really debating, but you can try [url=""]libgdx[/url].
  5. "Beginning Android Games" Question

    The author of this book is also the author of the libgdx engine, so I don't think he would advise to roll your own. I don't know the book, nor how/whether it uses the engine, but my guess is that what is done in these first chapters has been judged beneficial and good things to know, even if you use an engine in the end.
  6. [quote name='Knight52' timestamp='1319303168' post='4875372'] class A is a button and class B is "Mine Button" in MineSweeper. [/quote] Actually the interesting thing to know is, how do the various B classes differ, and can some of them have several "functionIwantToPass" ? Assuming they don't, here is a solution: [code]class A { virtual void action() = 0; public: void activate() {action();} }; class B : A { void functionIwantToPass() {...} void action() { functionIwantToPass() } };[/code] Sorry I you already knew, or if this is not suitable. But I think it is best to learn simple things first, before function pointers.
  7. It is a terribly classic answer, but: could you describe more precisely what you are trying to achieve ? From your simple example, it seems that just using a virtual method would do the job, without using any function pointer.
  8. redundant threading pitfalls

    I'm not an expert on threading at all, but in my opinion, you avoid this by having functions that document the fact, if they are threading behind the scenes. Also, if they are doing really heavyweight things, maybe job spawning overhead is relatively not that important.
  9. preprocessor question

    [quote name='nuclear123' timestamp='1317446836' post='4867876'] is there anyways to have my compiler or preprocessor do the following with my code. if (1) everywhere there is a hardcoded C string add a .txt at the end? else continue compilation [/quote] Not that I know, but you did not mention the compiler. I would suggest: if the change is definitive, to make it with external search/replace tools. Else, make it dynamically in the code, where/when it is needed. Anyway, as many people could tell you: - it's bad to hardcode a lot of things - what are you trying to achieve ? give a small example
  10. Game developement for android?

    I suggest [url=""]libgdx[/url], that comes with a few simple example games.
  11. Canceling a Constructor [C++]

    [quote name='NicoLaCrevette' timestamp='1314981338' post='4856812'] I think handling exceptions in C++ is more expensive than simply check a boolean value .... (?) [/quote] I'm not competent to debate that, but in this case, there is not even the need to debate: the OP didn't say that this code was to be as efficient as possible. The famous "premature optimization etc...". And I doubt that texture loading code is called often.
  12. Canceling a Constructor [C++]

    I think throwing an exception is the correct way to indicate a failure of construction. Along with using RAII in order not to leak resources (fp in your case).
  13. Confusion about Law of Demeter

    [quote name='RecycledBytes' timestamp='1314421821' post='4854324'] Now if "s" was a copy rather than a reference it would be an object created inside the caller method and hence does not violate the Demeter. Otherwise, it's manipulating "obj's" data member directly. [/quote] I think it's exactly this. if the Something belongs to obj, then tell obj to do whatever needs to be done with it, so that you don't have to care what the Something is. (as ApochPiq said). Of course it supposes that you can refactor everything. If you don't have control over obj, you can't do much. It's about a bit more than just readability. And even then, I wouldn't say "only readability", as it's so important !
  14. my gallery

  15. [HELP] Installing Allegro on Linux

    You can try with just:[code]-L/usr/lib -lalleg-4.2.2[/code]You can check the lib file for symbols. Reproducing (or not) manually outside of codeblocks would also give hints.