cpp invalid conversion from Class ‘Butt*’ to ‘int’

  allegro4, allegro5, c++

I have this Class.h for the mouse and buttons
After clicking on the button(bt) it will erase and redirect a new button (b1). After clicking on the new button I’m trying to delete it and redirect it to the initial button(bt)
However I get the message ->
invalid conversion from ‘Butt*’ to ‘int’

class Butt{
public:
    int wx, wy, x, y, w, h;
    Butt(int _wx, int _wy, int _x, int _y, int _w, int _h){
        wx = _wx;
        wy = _wy;
        x = _x;
        y = _y;
        w = _w;
        h = _h;
    
    }
    void show(BITMAP *buffer, BITMAP *source){
        masked_blit(source, buffer, wx, wy, x, y, w, h);
        }
        bool hit(int mx, int my){
            return x+w > mx && x < mx+2 && y+h > my && y < my+2;
        }
        //~Butt(){
    }
};

Next

#include <allegro.h>
#include "Botoes.h"
//var global
BITMAP *buffer, *iBt;

int main() {

//Inicialização
allegro_init();
install_timer();
install_mouse();
install_keyboard();
set_color_depth(32);
//set_window_title("");
set_close_button_callback(sair);
install_int_ex(tempo, MSEC_TO_TIMER(100));
install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL);  
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 840, 612, 0, 0);

//Var local
iBt = load_bitmap("img/img.bmp",NULL);
Butt *bt = new Butt(0, 454, 622, 211, 159, 86);

while (true)
{
    bt->show(buffer, iBt);
    if(bt->hit(mouse_x, mouse_y)){
       bt->wx = 160; //light
    }else bt->wx = 0;// position init
    if(mouse_b == 1){ //click
       delete bt;
       Bt* b1 = new Butt(0, 804, 549, 144, 142, 125);
        if(mouse_b & 1){
           delete b1;
           return bt;
        }
    }
}
//return 0;
}
END_OF_MAIN();  

Focus

       delete bt;
       Bt* b1 = new Butt(0, 804, 549, 144, 142, 125);
        if(mouse_b & 1){
           delete b1;
           return bt;

Source: Windows Questions C++

LEAVE A COMMENT