Example #1
0
/*- -------------------------------------------------------------- -*/
void Gui_sim::draw_map() {
    float side = 0.4;
    float zfar = 6;
    float initX = -2.5;
    float initY = -6.5;

    vec3f baseC(1, 1, 1);
    vec3f backC(0, 0, 0);

    // robot characteristics
    int num;
    char type;

    selectedX = -1;
    selectedY = -1;

    // drawing the map square by square and draqing the robots/flags in the appropriate tile
    for (int i=0; i<map_manip.get_height(); i++) {
        for (int j=0; j<map_manip.get_width(); j++) {
            if (r.checkForRobots(j, i, num, type) ){
                switch (type) {
                    case 'R':
                        draw_custom_square(side, zfar, initX, initY, baseC, tex_rescue);
                        break;
                    case 'A':
                        draw_custom_square(side, zfar, initX, initY, baseC, tex_analysis);
                        break;
                    case 'S':
                        draw_custom_square(side, zfar, initX, initY, baseC, tex_research);
                        break;
                }
            }else {
                if (map_manip.flags[j][i]){

                    draw_custom_square(side, zfar-0.005, initX, initY, baseC, tex_flag);

                    glColor4f(0, 0, 0, m_alpha);
                    shape.square(side, zfar, initX, initY);
                }
            } // checkForRobots if-else

            if (selected && shape.chechInsideSq(side, initX, initY, mouseX, mouseY)){
                glColor4f(1, 1, 1, m_alpha);
                shape.square(side, zfar-0.002, initX, initY);

                selectedX = j;
                selectedY = i;
            }else{
                glColor4f(0, 0, 0, m_alpha);
                shape.square(side, zfar-0.002, initX, initY);
            }// selected tile if-else

            initX += 0.9;
        }// j loop

        initX = -2.5;
        initY += 0.9;
    }// i loop

    // printing info on the screen
    menu.round_info(cur_robot, map_manip.get_width(), map_manip.get_height());
    menu.base_info(map_manip);
}
Example #2
0
/**********************************************************
 * @brief  back_mm (forward with control) - pulling function
 * @param  speed ( 0 to 100 ), distance millimeter
 * @retval None
**********************************************************/
void back_mm(int speed, int distance)
{
  controlEnable();
  backC(speed, distance*4);
  //controlDisable();
}