Results 1 to 4 of 4

Thread: Isometric Minesweeper

  1. #1
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    655
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default Isometric Minesweeper

    Hello everyoneRecently, I had free time, and I decided to warm up with programming. So, i'm developed the implementation of the Minesweeper game with isometric view.
    abWnQIyeBTInVhW9-.png

    C++ + SFML.

    Sources: https://github.com/CynicRus/Isometric-Minesweeper

    Binaries: https://github.com/CynicRus/Isometri....2/Release.zip

    Criticism of code are welcome
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  2. #2
    Join Date
    Dec 2007
    Posts
    2,110
    Mentioned
    69 Post(s)
    Quoted
    579 Post(s)

    Default

    Nothing inherently wrong with your source apart from using namespaces in your header files. You should not do that.

    Couple small nitpicks on top of that though.

    Don't use rand() in c++11 or higher. Use the <random> header.

    Define global vars/fncs in your main as private (static) where required.

    I saw a bunch of "15", maybe use #define WIDTH_HEIGHT_MINUS_ONE 15. (you get the idea).

    Use initialization lists in your Animation constructor. E.g:
    c++ Code:
    Animation() : currentFrame(0), loop(true), flip(false), isPlaying(true)
    {

    }

    You don't need a constructor or destructor for your AnimationManager class. So omit it.

    You should const ref when you can. E.g:
    c++ Code:
    void AnimationManager::create(const std::string& name, const Texture& texture, ..)
    {
    ...
    }

    You should use emplace_back instead of push_back when you're able to construct in place:
    c++ Code:
    a.frames.push_back(IntRect(x + i * (w + step - 1), y, w, h));
    // should be
    a.frames.emplace_back(x + i * (w + step - 1), y, w, h);

    Consider creating Animation in place.
    c++ Code:
    Animation a;
    a.speed = speed;
    animList[name] = a;
    //vs
    animList[name].speed = speed;
    // or even
    auto& Anim = animList[Name];
    Anim.speed = speed;

    another smallish optimization you could do is mark "int ClearC[225]" as static so you aren't constantly recreating it on the stack.

  3. #3
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    655
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Wow! Thank you!
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  4. #4
    Join Date
    Jan 2019
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Can't comment on the code, but I was wondering if it's a finished game? I could use with a new Minesweeper game at this point. haha

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •