Jump to content

Recommended Posts

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...