kurosio / Teeworlds-MRPG-0.6

Other
5 stars 10 forks source link

Motd menu with mouse #26

Open kurosio opened 2 months ago

kurosio commented 2 months ago

Example for motd menu: https://github.com/kurosio/Teeworlds-MRPG-0.6/assets/18047352/71b39c21-4260-40f6-b365-ccba416b4e09

An example of alignment, a small push to start the development of this system:

    constexpr int Lines = 20;
    constexpr int linesizeY = 20;
    constexpr int startLineY = -280;
    const int TargetX = m_Core.m_Input.m_TargetX;
    const int TargetY = m_Core.m_Input.m_TargetY;

    std::string Buffer;
    for(int i = 0; i < Lines; ++i)
    {
        int checksY = startLineY + (i * linesizeY);
        int checkeY = startLineY + ((i + 1) * linesizeY);

        if(TargetX > -196 && TargetX < 196 && TargetY >= checksY && TargetY < checkeY)
            Buffer += '#' + std::to_string(i) + ". .........\n";
        else
            Buffer += std::to_string(i) + ". .........\n";
    }

    GS()->Motd(m_pPlayer->GetCID(), Buffer.c_str());

Criteria: