Example #1
0
void Peacemaker::fireprimary(Gamestate *state)
{
    double cosa = std::cos(aimdirection), sina = std::sin(aimdirection);
    double collisionptx, collisionpty;
    double d = std::hypot(state->currentmap->width(), state->currentmap->height());
    EntityPtr target = state->collidelinedamageable(x, y, x+cosa*d, y+sina*d, team, &collisionptx, &collisionpty);
    if (target.id != 0)
    {
        double distance = std::hypot(collisionptx-x, collisionpty-y);
        double falloff = 1.0;
        if (distance > FALLOFF_BEGIN)
        {
            falloff = std::max(0.0, 1 - (distance-FALLOFF_BEGIN)/(FALLOFF_END-FALLOFF_BEGIN));
        }
        MovingEntity *m = state->get<MovingEntity>(target);
        if (m->entitytype == CHARACTER)
        {
            Character *c = reinterpret_cast<Character*>(m);
            c->damage(state, MAX_DAMAGE*falloff);
        }
    }

    state->make_entity<Trail>(state, al_premul_rgba(133, 238, 238, 150), x+cosa*24, y+sina*24, collisionptx, collisionpty, 0.1);
    Explosion *e = state->get<Explosion>(state->make_entity<Explosion>(state, "heroes/mccree/projectiletrail/", aimdirection));
    e->x = x+cosa*24;
    e->y = y+sina*24;

    --clip;
    firinganim.reset();
    firinganim.active(true);
}
Example #2
0
void Peacemaker::firesecondary(Gamestate *state)
{
    double spread = (2*(rand()/(RAND_MAX+1.0)) - 1)*25*3.1415/180.0;
    double cosa = std::cos(aimdirection+spread), sina = std::sin(aimdirection+spread);
    double collisionptx, collisionpty;
    EntityPtr target = state->collidelinedamageable(x, y, x+cosa*FALLOFF_END, y+sina*FALLOFF_END, team, &collisionptx, &collisionpty);
    if (target.id != 0)
    {
        double distance = std::hypot(collisionptx-x, collisionpty-y);
        double falloff = 1.0;
        if (distance > FALLOFF_BEGIN)
        {
            falloff = std::max(0.0, (distance-FALLOFF_BEGIN) / (FALLOFF_END-FALLOFF_BEGIN));
        }
        MovingEntity *m = state->get<MovingEntity>(target);
        if (m->entitytype == CHARACTER)
        {
            Character *c = reinterpret_cast<Character*>(m);
            c->damage(state, MAX_FTH_DAMAGE*falloff);
        }
    }

    state->make_entity<Trail>(state, al_premul_rgba(133, 238, 238, 150), x+cosa*24, y+sina*24, collisionptx, collisionpty, 0.1);
    Explosion *e = state->get<Explosion>(state->make_entity<Explosion>(state, "heroes/mccree/projectiletrail/", aimdirection+spread));
    e->x = x+cosa*24;
    e->y = y+sina*24;

    --clip;

    if (clip > 0 and state->engine->isserver)
    {
        if (isfthing)
        {
            fthanim = Animation("heroes/mccree/fanthehammerloop/", std::bind(&Peacemaker::wantfiresecondary, this, state));
        }
        else
        {
            fthanim = Animation("heroes/mccree/fanthehammerstart/", std::bind(&Peacemaker::wantfiresecondary, this, state));
            isfthing = true;
        }
    }
}
Example #3
0
File: exp1.cpp Project: kruci/rGUI
int main(int argc, char **argv)
{
    char cCurrentPath[FILENAME_MAX];

    if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
    {
        return errno;
    }

    cCurrentPath[sizeof(cCurrentPath) - 1] = '\0'; /* not really required */

    std::cout << cCurrentPath << std::endl;

    int newsw = 771 , newsh = 600;
    float _sx = (float)newsw / (float)SCREEN_W, _sy = (float)newsh / (float)SCREEN_H;
    float _offx = (SCREEN_W - newsw)/2, _offy = (SCREEN_H - newsh)/2;

    rGUI::Init_Allegro();
    rGUI::Init_rGUI();
    //rGUI::Init_rGUI(_sx, _sy, _offx, _offy);

    ALLEGRO_DISPLAY *display = NULL;
    ALLEGRO_EVENT_QUEUE *event_queue = NULL;
    ALLEGRO_TIMER *timer = NULL;
    ALLEGRO_BITMAP *bouncer = NULL;
    float bouncer_x = SCREEN_W / 2.0 - BOUNCER_SIZE / 2.0;
    float bouncer_y = SCREEN_H / 2.0 - BOUNCER_SIZE / 2.0;
    bool redraw = true;
    ALLEGRO_FONT *font = al_load_font("Calibri.ttf", 35, 0);

    timer = al_create_timer(1.0 / FPS);
    if(!timer)
    {
        fprintf(stderr, "failed to create timer!\n");
        return -1;
    }

    display = al_create_display(SCREEN_W, SCREEN_H);
    //display = al_create_display(newsw, newsh);

    al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR);
    if(!display)
    {
        fprintf(stderr, "failed to create display!\n");
        al_destroy_timer(timer);
        return -1;
    }

    bouncer = al_create_bitmap(BOUNCER_SIZE, BOUNCER_SIZE);
    if(!bouncer)
    {
        fprintf(stderr, "failed to create bouncer bitmap!\n");
        al_destroy_display(display);
        al_destroy_timer(timer);
        return -1;
    }

    al_set_target_bitmap(bouncer);

    al_clear_to_color(al_map_rgb(255, 0, 255));

    al_set_target_bitmap(al_get_backbuffer(display));

    event_queue = al_create_event_queue();
    if(!event_queue)
    {
        fprintf(stderr, "failed to create event_queue!\n");
        al_destroy_bitmap(bouncer);
        al_destroy_display(display);
        al_destroy_timer(timer);
        return -1;
    }

    al_register_event_source(event_queue, al_get_display_event_source(display));

    al_register_event_source(event_queue, al_get_timer_event_source(timer));

    al_register_event_source(event_queue, al_get_mouse_event_source());
    al_register_event_source(event_queue, al_get_keyboard_event_source());


    al_clear_to_color(al_map_rgb(0,0,0));

    al_flip_display();

    al_start_timer(timer);

    tmh.c_text = al_map_rgba(255,255,255,0);
    tmh.c_outline = al_map_rgba(0,200,0,255);
    tmh.c_background = al_map_rgba(255,0,0,255);
    tmh.c_movablepart = al_map_rgb(200,0,0);
    tmh.c_clicking = al_map_rgba(0,0,0,125);
    tmh.thickness = 2;
    tmh.added_thickness = 2;
    tmh.roundx = 0;
    tmh.roundy = 0;
    ALLEGRO_FONT *fnt = al_load_ttf_font("Calibri.ttf",30,0);



    widgets.push_back(new rGUI::Button(10,40,100,50,"wwwLong text", "Calibri.ttf",&tmh));
    tmh.roundx = 3;
    tmh.roundy = 3;
    widgets.push_back(new rGUI::CheckBox(160, 40, 50,50,&tmh, false));
    widgets.push_back(new rGUI::SlideBar(10,100,100,30,0,1,&tmh, (rGUI::bf_HORIZONTAL | rGUI::bf_HAS_FRAME) ));
    widgets.push_back(new rGUI::SlideBar(115,40,30,50,0,5, &tmh, (rGUI::bf_VERTICAL | rGUI::bf_HAS_FRAME) ));
    widgets.push_back(new rGUI::BitmapButton(10,140,100,45, "button.png",&tmh, 0));
    widgets.push_back(new rGUI::ScrollBar(220, 5, 30, 185, 800, &tmh, (rGUI::bf_VERTICAL)));
    widgets.push_back(new rGUI::ScrollBar(10, 195, 240, 30, 800, &tmh, (rGUI::bf_HORIZONTAL)));
    widgets.push_back(new rGUI::InputField(115,100,95,40, "Calibri.ttf",&tmh, FPS));
    widgets.push_back(new rGUI::SingleKeyInputField(115,145,95,40, ALLEGRO_KEY_BACKQUOTE, "Calibri.ttf",&tmh));

    //Callback example
    int progressbar = widgets.size();
    widgets.push_back(new rGUI::ProgressBar(10,5,200,30,0,&tmh));
    widgets[progressbar]->wd_md->md_callback_data = widgets[progressbar];
    widgets[progressbar]->wd_md->Just_clicked_callback = pbar_callback;


    widgets.push_back(new rGUI::ScrollableArea(10,240,440,440,2000,2000,&tmh,20, (rGUI::bf_VERTICAL | rGUI::bf_HORIZONTAL | rGUI::bf_ZOOMABLE)));
    int scbapoz = widgets.size()-1;
    widgets[scbapoz]->widgets.push_back(new rGUI::Button(10,10,100,30, "Text", "Calibri.ttf", &tmh));
    widgets[scbapoz]->widgets.push_back(new rGUI::BitmapButton(10,50,100,45, "button.png",&tmh, 0));
    widgets[scbapoz]->widgets.push_back(new rGUI::CheckBox(120, 30, 50,50,&tmh, false));
    widgets[scbapoz]->widgets.push_back(new rGUI::SlideBar(10,100,120,30,0,300,&tmh, (rGUI::bf_HORIZONTAL | rGUI::bf_HAS_FRAME) ));
    widgets[scbapoz]->widgets.push_back(new rGUI::ScrollBar(10, 160, 120, 30, 800, &tmh, (rGUI::bf_HORIZONTAL)));
    widgets[scbapoz]->widgets.push_back(new rGUI::InputField(10,2000,100,40, "Calibri.ttf",&tmh, FPS));
    widgets[scbapoz]->widgets.push_back(new rGUI::TextBox(2000,1200,300,120, "Big box", "Calibri.ttf", 200,&tmh,
                                                          (rGUI::bf_HAS_FRAME | rGUI::bf_RESIZE_CONTENT)));
    widgets[scbapoz]->widgets.push_back(new rGUI::SlideBar(1000,100,200,40,0,20,&tmh, (rGUI::bf_HORIZONTAL | rGUI::bf_HAS_FRAME) ));
    widgets[scbapoz]->widgets.push_back(new rGUI::BitmapButton(300,300,0,0, "image.jpg",&tmh, (rGUI::bf_RESIZE_WIDGET | rGUI::bf_DISABLE_CLICKING_SHADOW)));
    ((rGUI::ScrollableArea*)widgets[scbapoz])->I_added_new_widgets();

    //roundXY
    widgets.push_back(new rGUI::TextBox(680,5,300,40, "RoundXY",  "Calibri.ttf",15, &tmh, (rGUI::bf_HAS_FRAME)));
    int poz_roundXY = widgets.size();
    widgets.push_back(new rGUI::SlideBar(800,10,100,30,0,10,&tmh, (rGUI::bf_HORIZONTAL)));
    //Thickness
    widgets.push_back(new rGUI::TextBox(680,50,300,40, "Thickness",  "Calibri.ttf",15, &tmh, (rGUI::bf_HAS_FRAME)));
    int poz_thickness = widgets.size();
    widgets.push_back(new rGUI::SlideBar(800,55,100,30,0,10,&tmh, (rGUI::bf_HORIZONTAL)));

    //Added thickness
    widgets.push_back(new rGUI::TextBox(680,95,300,40, "Added Thickness",  "Calibri.ttf",10, &tmh, (rGUI::bf_HAS_FRAME)));
    int poz_addedthickness = widgets.size();
    widgets.push_back(new rGUI::SlideBar(800,100,100,30,0,10,&tmh, (rGUI::bf_HORIZONTAL)));

    //Update Button
    int poz_updatebutton = widgets.size();
    widgets.push_back(new rGUI::Button(680,140,180,40,"Update Theme","Calibri.ttf", &tmh));

    //Reset Button
    int poz_rb = widgets.size();
    widgets.push_back(new rGUI::TextBox(862,140,36,40,"Reset theme","Calibri.ttf", 12, &tmh,
                                        (rGUI::bf_AS_BUTTON | rGUI::bf_HAS_FRAME | rGUI::bf_MULTILINE)));
    //widgets.push_back(new rGUI::Button(865,140,30,40,"Reset colors","Calibri.ttf", &tmh));

    //Color selector
    int poz_colscba = widgets.size();
    widgets.push_back(new rGUI::ScrollableArea(400,5,275,180,2000,2000,&tmh,0,0));
        //red
        int poz_colsba_R =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::SlideBar(5,5,30,140,0,255,&tmh, rGUI::bf_VERTICAL));
        //Green
        int poz_colsba_G =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::SlideBar(40,5,30,140,0,255,&tmh, rGUI::bf_VERTICAL));
        //Blue
        int poz_colsba_B =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::SlideBar(75,5,30,140,0,255,&tmh, rGUI::bf_VERTICAL));
        //Alpha
        int poz_colsba_A =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::SlideBar(110,5,30,140,0,255,&tmh, rGUI::bf_VERTICAL));
        //cols
        int poz_colsba_cols =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::TextBox(15,150,120,20, "R    G     B     A", "Calibri.ttf", 20, &tmh, rGUI::bf_HAS_FRAME));

        //TextC
        int poz_colsba_c_T =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::Button(150,5,120,30, "Text color", "Calibri.ttf", &tmh));
        //BackgroundC
        int poz_colsba_c_B =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::Button(150,40,120,30, "Background color", "Calibri.ttf", &tmh));
        //OutlineC
        int poz_colsba_c_O =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::Button(150,75,120,30, "Outline color", "Calibri.ttf", &tmh));
        //ClickingC
        int poz_colsba_c_C =  widgets[poz_colscba]->widgets.size();
        widgets[poz_colscba]->widgets.push_back(new rGUI::Button(150,110,120,30, "Clicking color", "Calibri.ttf", &tmh));

    ((rGUI::ScrollableArea*)widgets[poz_colscba])->I_added_new_widgets();



    //Drag&drop
    int poz_dbm = widgets.size();
    widgets.push_back(new rGUI::DropBoxManager());
    rGUI::DropBox_Item dpi;
    dpi.load_bmp_fom_file = true;
    dpi.bmp_str = "button.png";
    dpi.print_x = 10;
    dpi.print_y = 10;
    dpi.print_w = 30;
    dpi.print_h = 30;
    widgets.push_back(new rGUI::DropBox(600,400,50,50,&tmh, (rGUI::DropBoxManager*)widgets[poz_dbm],&dpi));
    dpi.load_bmp_fom_file = false;
    dpi.bmp = al_load_bitmap("button.png");

    al_set_target_bitmap(dpi.bmp);
    al_draw_tinted_bitmap(dpi.bmp, al_map_rgba(255,0,0,100),0,0,0);

    std::vector<ALLEGRO_COLOR*> colvect;

    widgets[scbapoz]->widgets.push_back(new rGUI::DropBox(600,400,50,50,&tmh, (rGUI::DropBoxManager*)widgets[poz_dbm],&dpi));
    for(int a = 0;a < 5;a++)
    {
        for(int b = 0;b < 5;b++)
        {
            if(a == 0 && b == 0)
            {
                continue;
            }
            ALLEGRO_COLOR tmpc = al_map_rgba(rand()%256,rand()%256,rand()%256,255);
            colvect.push_back(new ALLEGRO_COLOR);
            colvect[colvect.size()-1]->r = tmpc.r;
            colvect[colvect.size()-1]->g = tmpc.g;
            colvect[colvect.size()-1]->b = tmpc.b;
            colvect[colvect.size()-1]->a = tmpc.a;
            al_clear_to_color(tmpc);
            dpi.data = colvect[colvect.size()-1];
            widgets.push_back(new rGUI::DropBox(600 + a*55,400 + b*55,50,50,&tmh, (rGUI::DropBoxManager*)widgets[poz_dbm], nullptr));
            widgets[scbapoz]->widgets.push_back(new rGUI::DropBox(600 + a*55,400 + b*55,50,50,&tmh, (rGUI::DropBoxManager*)widgets[poz_dbm], &dpi));
        }
    }
    al_set_target_backbuffer(display);
    int poz_backgroundDB = widgets.size();
    widgets.push_back(new rGUI::DropBox(710,345,50,50,&tmh, (rGUI::DropBoxManager*)widgets[poz_dbm], nullptr));
    int poz_scba_DP = widgets[scbapoz]->widgets.size();
    widgets[scbapoz]->widgets.push_back(new rGUI::DropBox(710,345,50,50,&tmh, (rGUI::DropBoxManager*)widgets[poz_dbm], nullptr));
    ((rGUI::ScrollableArea*)widgets[scbapoz])->I_added_new_widgets();

    //Group
    int poz_ext = widgets.size();
    widgets.push_back(new rGUI::Button(SCREEN_W - 50, SCREEN_H - 17,40,12,"Exit", "Calibri.ttf", &tmh));
    int poz_group = widgets.size();
    widgets.push_back(new rGUI::Group());
    ((rGUI::Group*)widgets[poz_group])->Add_Widgets(widgets, 0, widgets.size()-1);

    int poz_ext_scba = widgets.size();
    widgets.push_back(new rGUI::ScrollableArea( (SCREEN_W/2)-200, (SCREEN_H/2)-100, 400, 200,400,200,&tmh,14, 0));
    widgets[poz_ext_scba]->widgets.push_back(new rGUI::Button(10,150,100,45,"Yes", "Calibri.ttf", &tmh));
    widgets[poz_ext_scba]->widgets.push_back(new rGUI::Button(290,150,100,45,"No", "Calibri.ttf", &tmh));
    widgets[poz_ext_scba]->widgets.push_back(new rGUI::TextBox(0,0,400,120, "Do you rly wanna go ?", "Calibri.ttf",100, &tmh,
        (rGUI::bf_HORIZONTAL_CENTER | rGUI::bf_VERTICAL_CENTER | rGUI::bf_RESIZE_CONTENT) ));
    ((rGUI::ScrollableArea*)widgets[poz_ext_scba])->I_added_new_widgets();

    int poz_ext_group = widgets.size();
    widgets.push_back(new rGUI::Group());
    ((rGUI::Group*)widgets[poz_ext_group])->Add_Widgets(widgets, poz_ext_scba, widgets.size()-1);
    ((rGUI::Group*)widgets[poz_ext_group])->Set_all_Inputing(false);
    ((rGUI::Group*)widgets[poz_ext_group])->Set_all_Printing(false);

    ALLEGRO_TRANSFORM trans;
    al_identity_transform(&trans);
    al_scale_transform(&trans, _sx, _sy);
    al_translate_transform(&trans, _offx, _offy);
    //al_use_transform(&trans);
    int progresval = 0, progressadd = 1;
    ALLEGRO_COLOR backgroundcollor = al_map_rgb(255,255,255);

    float scale = 1.0f;
    while(1)
    {
        ALLEGRO_EVENT ev;
        al_wait_for_event(event_queue, &ev);

        rGUI::GetStatesAdnEvents(ev);

        if(ev.type == ALLEGRO_EVENT_TIMER)
        {
            progresval++;
            redraw = true;
            if(progresval >= 3)
            {
                progresval = 0;
                ((rGUI::ProgressBar*)widgets[progressbar])->Set_value(
                ((rGUI::ProgressBar*)widgets[progressbar])->Get_value() + progressadd);
            }

        }
        else if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
        {
            break;
        }
        else if(ev.type == ALLEGRO_EVENT_MOUSE_AXES ||
                ev.type == ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY)
        {

            bouncer_x = ev.mouse.x;
            bouncer_y = ev.mouse.y;
        }


        for(int a = 0;a < (int)widgets.size();a++)
        {
            widgets[a]->Input();
        }

        if(widgets[poz_ext]->wd_md->md_clicked == true)
        {
            widgets[poz_ext]->wd_md->md_clicked = false;
            ((rGUI::Group*)widgets[poz_group])->Set_all_Inputing(false);
            ((rGUI::Group*)widgets[poz_group])->Set_all_Printing(false);

            ((rGUI::Group*)widgets[poz_ext_group])->Set_all_Inputing(true);
            ((rGUI::Group*)widgets[poz_ext_group])->Set_all_Printing(true);
        }

        if(widgets[poz_ext_scba]->widgets[0]->wd_md->md_clicked == true)
        {
            break;
        }
        else if(widgets[poz_ext_scba]->widgets[1]->wd_md->md_clicked == true)
        {
            widgets[poz_ext_scba]->widgets[1]->wd_md->md_clicked = false;
            ((rGUI::Group*)widgets[poz_group])->Set_all_Inputing(true);
            ((rGUI::Group*)widgets[poz_group])->Set_all_Printing(true);

            ((rGUI::Group*)widgets[poz_ext_group])->Set_all_Inputing(false);
            ((rGUI::Group*)widgets[poz_ext_group])->Set_all_Printing(false);
        }

        if(widgets[poz_updatebutton]->wd_md->md_clicked == true || widgets[poz_rb]->wd_md->md_clicked == true)
        {
            widgets[poz_updatebutton]->wd_md->md_clicked = false;
            tmh.thickness = ((rGUI::SlideBar*)widgets[poz_thickness])->value;
            tmh.added_thickness = ((rGUI::SlideBar*)widgets[poz_addedthickness])->value;
            tmh.roundx = tmh.roundy = ((rGUI::SlideBar*)widgets[poz_roundXY])->value;

            if(widgets[poz_rb]->wd_md->md_clicked == true)
            {
                widgets[poz_rb]->wd_md->md_clicked = false;
                thmreset();
            }

            for(int a = 0;a < (int)widgets.size();a++)
            {
                widgets[a]->Update_theme(&tmh);
            }
            widgets[poz_colscba]->widgets[poz_colsba_cols]->wd_theme.c_background =
                al_premul_rgba(((rGUI::SlideBar*)widgets[poz_colscba]->widgets[poz_colsba_R])->Get_value(),
                            ((rGUI::SlideBar*)widgets[poz_colscba]->widgets[poz_colsba_G])->Get_value(),
                            ((rGUI::SlideBar*)widgets[poz_colscba]->widgets[poz_colsba_B])->Get_value(),
                            ((rGUI::SlideBar*)widgets[poz_colscba]->widgets[poz_colsba_A])->Get_value());
        }
        else if(widgets[poz_colscba]->widgets[poz_colsba_R]->wd_md->md_mouse_on_it == true ||
                widgets[poz_colscba]->widgets[poz_colsba_G]->wd_md->md_mouse_on_it == true ||
                widgets[poz_colscba]->widgets[poz_colsba_B]->wd_md->md_mouse_on_it == true ||
                widgets[poz_colscba]->widgets[poz_colsba_A]->wd_md->md_mouse_on_it == true)
        {
            widgets[poz_colscba]->widgets[poz_colsba_cols]->wd_theme.c_background =
                al_premul_rgba(((rGUI::SlideBar*)widgets[poz_colscba]->widgets[poz_colsba_R])->Get_value(),
                            ((rGUI::SlideBar*)widgets[poz_colscba]->widgets[poz_colsba_G])->Get_value(),
                            ((rGUI::SlideBar*)widgets[poz_colscba]->widgets[poz_colsba_B])->Get_value(),
                            ((rGUI::SlideBar*)widgets[poz_colscba]->widgets[poz_colsba_A])->Get_value());
        }
        else if(widgets[poz_colscba]->widgets[poz_colsba_c_T]->wd_md->md_clicked == true)
        {
            tmh.c_text = widgets[poz_colscba]->widgets[poz_colsba_cols]->wd_theme.c_background;
            widgets[poz_colscba]->widgets[poz_colsba_c_T]->wd_md->md_clicked = false;
        }
        else if(widgets[poz_colscba]->widgets[poz_colsba_c_O]->wd_md->md_clicked == true)
        {
            tmh.c_outline = widgets[poz_colscba]->widgets[poz_colsba_cols]->wd_theme.c_background;
            widgets[poz_colscba]->widgets[poz_colsba_c_O]->wd_md->md_clicked = false;
        }
        else if(widgets[poz_colscba]->widgets[poz_colsba_c_B]->wd_md->md_clicked == true)
        {
            tmh.c_background = widgets[poz_colscba]->widgets[poz_colsba_cols]->wd_theme.c_background;
            widgets[poz_colscba]->widgets[poz_colsba_c_B]->wd_md->md_clicked = false;
        }
        else if(widgets[poz_colscba]->widgets[poz_colsba_c_C]->wd_md->md_clicked == true)
        {
            tmh.c_clicking = widgets[poz_colscba]->widgets[poz_colsba_cols]->wd_theme.c_background;
            widgets[poz_colscba]->widgets[poz_colsba_c_C]->wd_md->md_clicked = false;
        }



        if(((rGUI::DropBox*)widgets[poz_backgroundDB])->changed)
        {
            if(((rGUI::DropBox*)widgets[poz_backgroundDB])->db_item != nullptr && ((rGUI::DropBox*)widgets[poz_backgroundDB])->db_item->data != nullptr)
            {
                ((rGUI::DropBox*)widgets[poz_backgroundDB])->changed = false;
                rGUI::DropBox *tmpdb = ((rGUI::DropBox*)widgets[poz_backgroundDB]);
                backgroundcollor.r = ((ALLEGRO_COLOR*)(tmpdb->db_item->data))->r;
                backgroundcollor.g = ((ALLEGRO_COLOR*)(tmpdb->db_item->data))->g;
                backgroundcollor.b = ((ALLEGRO_COLOR*)(tmpdb->db_item->data))->b;
                backgroundcollor.a = ((ALLEGRO_COLOR*)(tmpdb->db_item->data))->a;
            }
            else
            {
                backgroundcollor = al_map_rgb(255,255,255);
            }


        }
        if(((rGUI::DropBox*)(widgets[scbapoz]->widgets[poz_scba_DP]))->db_item != nullptr &&
           ((rGUI::DropBox*)(widgets[scbapoz]->widgets[poz_scba_DP]))->db_item->data != nullptr &&
           ((rGUI::DropBox*)(widgets[scbapoz]->widgets[poz_scba_DP]))->changed)
        {
            ((rGUI::DropBox*)(widgets[scbapoz]->widgets[poz_scba_DP]))->changed = false;
            rGUI::DropBox *tmpdb = ((rGUI::DropBox*)(widgets[scbapoz]->widgets[poz_scba_DP]));
            widgets[scbapoz]->wd_theme.c_background.r = ((ALLEGRO_COLOR*)(tmpdb->db_item->data))->r;
            widgets[scbapoz]->wd_theme.c_background.g = ((ALLEGRO_COLOR*)(tmpdb->db_item->data))->g;
            widgets[scbapoz]->wd_theme.c_background.b = ((ALLEGRO_COLOR*)(tmpdb->db_item->data))->b;
            widgets[scbapoz]->wd_theme.c_background.a = ((ALLEGRO_COLOR*)(tmpdb->db_item->data))->a;
        }

        if(redraw && al_is_event_queue_empty(event_queue))
        {
            redraw = false;

            al_clear_to_color(backgroundcollor);

            al_draw_bitmap(bouncer, bouncer_x, bouncer_y, 0);

            for(int a = 0;a < (int)widgets.size();a++)
            {
                widgets[a]->Print();
            }
            widgets[poz_dbm]->Print();

            al_flip_display();
        }
    }


    for(int a = 0;a < (int)widgets.size();a++)
    {
        delete widgets[a];
    }
    widgets.clear();
    for(int a = 0;a < (int)colvect.size();a++)
    {
        delete colvect[a];
    }
    colvect.clear();

    rGUI::End();

    al_destroy_bitmap(bouncer);
    al_destroy_timer(timer);
    al_destroy_display(display);
    al_destroy_event_queue(event_queue);
    al_destroy_font(fnt);
    al_destroy_font(font);

    return 0;
}