Programación General > C++ Builder

 Como mover una imagen en tiempo de ejecucion en c++

(1/1)

pochi:
Hola!!! de nuevo estoy buscando para mi juego de cartas en builder c++ el codigo para mover la carta en el turno del jugador he probado varias cosas y no me anda este es mi codigo:
--- Código: C++ ---bool gbMover = false;...void __fastcall TForm1::Image2MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,                  int X, int Y){   gbMover= true;}//--------------------------------------------------------------------------- void __fastcall TForm1::Image2MouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,          int X, int Y){   gbMover= false;}//--------------------------------------------------------------------------- void __fastcall TForm1::Image2MouseMove(TObject *Sender, TShiftState Shift, int X,          int Y){   if(gbMover == true){   TPoint *MyPoint;   GetCursorPos(MyPoint);   Image2-> Left = (MyPoint->x-Form1->Left)- Image2->Width/2;   Image2->Top = (MyPoint->y-Form1->Top)- Image2->Width/2;   }}No manda error pero no mueve la imagen.
Desde ya muchas gracias  :ayuda: :gracias:

juanC2:

--- Código: C++ ---bool gbMover;int xini, yini; void __fastcall TForm1::Image1MouseUp(TObject *Sender, TMouseButton Button,      TShiftState Shift, int X, int Y){   gbMover = false;}//--------------------------------------------------------------------------- void __fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift,      int X, int Y){ if(gbMover == true){   Image1->Left += (X-xini);   Image1->Top += (Y-yini);   }}//--------------------------------------------------------------------------- void __fastcall TForm1::Image1MouseDown(TObject *Sender,      TMouseButton Button, TShiftState Shift, int X, int Y){  if(Button == mbLeft){     xini = X;     yini = Y;     gbMover = true;    }} 

Navegación

[0] Índice de Mensajes

Ir a la versión completa