Xandy Posted September 12, 2012 Posted September 12, 2012 (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 September 12, 2012 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now