Sign in to follow this  
Followers 0
Xandy

AutoItObject this pointer

1 post in this topic

#1 ·  Posted (edited)

Converting a windowclass from C++ to SDL_UDF.

int windowclass::drag()
{
int i=0;
if(mbDown[mbLEFT]==1) {
if(dragging==0) {
if(mouseoverrect(x, y, w, h)) {
if(buttons>0) {
for(i=0; i<buttons; i++) {
if(mouseoverrect(x+button[i].x, y+button[i].y, button[i].w, button[i].h)) {
return i;
}
}
}
SDL_GetMouseState(&mousex, &mousey);
windisx = mousex - x;
windisy = mousey - y;
dragging=1;
wdrag=this;// I can't do 'this' yet in AutoIt
}
}
}
if(wdrag==this && dragging && !nodrag) {
SDL_GetMouseState(&mousex, &mousey);
x = mousex-windisx;
y = mousey-windisy;
}
if(mbDown[mbLEFT]==0) {
dragging=0;
wdrag=NULL;
}
return -1;
}

func windowodrag($oself)
 if _ispressed(1) then
  if $oself.dragging= 0 then
   if mouseoverrect($oself.x, $oself.y, $oself.w, $oself.h)= 1 then
    $oself.dragdisx= $mousex-$oself.x
    $oself.dragdisy= $mousey-$oself.y
    $oself.dragging= 1
    $oself.wdrag= $oself; How do I use keyword 'this in AutoIt?
   endif
  endif;endif dragging= 0
  if $oself.wdrag= $oself and $oself.dragging= 1 and $oself.nodrag= 0 then
   _SDL_GetMouseState($mousex, $mousey)
   $oself.x= $mousex-$oself.dragdisx
   $oself.y= $mousey-$oself.dragdisy
   $redraw= 1
  endif
 else
  $oself.dragging= 0
  $oself.wdrag= 0
 endif;endif left mouse button
EndFunc

I use AutoItObject to store movable windows on an SDL_Surface.

Does anyone know a AutoItObject, C++ 'this' pointer to self equivalent?

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0