*NEW* Current Version on STEAM: 16.026Logfile: EN, DEWebchat:Visit the chat
// --------------------------------- //// Project: ZONES 1.4// Start: Friday, October 08, 2010// IDE Version: 8.125////// CreateZone Define a zone. You can use any number >0 Notice that zone[n] is not ZONE "n". Zone[1] is the first one created and could have ZoneID 21. Size is relative to a screensize 1024x640// CreateZoneAbs Define a zone with ABSolute coordinates// DeleteZone DELETE zone (id)// FreeZones DELETE all zones AND free up reserved memory.// MouseZone() Returns the number of the zone the mouse pointer is in.// ZoneProperty() Returns zone properties. 1=x, 2=y, 3=w, 4=h, 5=ID 6=Position of item in matrix// Zone() RETURN the number of the zone at given X AND Y co-ordinates.// ShowZones Call this function each loop before SHOWSCREEN to draw zone rectangles//// 1.0 Inicial version// 1.1 Fixed bug where zones with existing numbers where created as new, creating a ton of new zones// 1.2 Fixed a bug in ZoneProperty// 1.3 Fixed for rotating screens// 1.4 CreateZone now creates zones relatives to screen size (1024x768 is origin screen size)// CreateZoneAbs create ABSolute coordinates zones (the old createzone() function really)TYPE zon x // x coord y // y coord w // weight h // heigh n // zone number (ID)ENDTYPEGLOBAL zones[] AS zonFUNCTION CreateZone: ZoneNum, Xcoord, Ycoord, Width, Height LOCAL m,r,x1,x2,y1,y2,x,y,xz,yz,z,xd,yd x1=MIN(Xcoord,Xcoord+Width) x2=MAX(Xcoord,Xcoord+Width) y1=MIN(Ycoord,Ycoord+Height) y2=MAX(Ycoord,Ycoord+Height) r=ZoneProperty(ZoneNum,6) IF r=-1 m=BOUNDS(zones[],0) REDIM zones[m+1] ELSE m=r ENDIF xz=xres/1024;yz=yres/640 z=MIN(xz,yz) xd=(xres-(1024*z))/2 yd=(yres-(640*z))/2 zones[m].x=(x1*z)+xd zones[m].y=(y1*z)+yd zones[m].w=(x2-x1)*z zones[m].h=(y2-y1)*z zones[m].n=ZoneNumENDFUNCTIONFUNCTION CreateZoneAbs: ZoneNum, Xcoord, Ycoord, Width, Height LOCAL m,r,x1,x2,y1,y2 x1=MIN(Xcoord,Xcoord+Width) x2=MAX(Xcoord,Xcoord+Width) y1=MIN(Ycoord,Ycoord+Height) y2=MAX(Ycoord,Ycoord+Height) r=ZoneProperty(ZoneNum,6) IF r=-1 m=BOUNDS(zones[],0) REDIM zones[m+1] ELSE m=r ENDIF zones[m].x=x1 zones[m].y=y1 zones[m].w=x2-x1 zones[m].h=y2-y1 zones[m].n=ZoneNumENDFUNCTIONFUNCTION ZoneProperty: number, item LOCAL z,r,n n=-1;r=-1 FOREACH z IN zones[] INC n IF z.n=number IF item=1 THEN r=z.x IF item=2 THEN r=z.y IF item=3 THEN r=z.w IF item=4 THEN r=z.h IF item=5 THEN r=z.n IF item=6 THEN r=n BREAK ENDIF NEXT RETURN rENDFUNCTIONFUNCTION DeleteZone: n FOREACH z IN zones[] IF z.n=n DELETE z ENDIF NEXTENDFUNCTIONFUNCTION FreeZones: DIM zones[0]ENDFUNCTIONFUNCTION MouseZone: LOCAL z,mx,my,b1,b2 MOUSESTATE mx,my,b1,b2 z=Zone(mx,my) RETURN zENDFUNCTIONFUNCTION Zone: xcoord, ycoord LOCAL zo FOREACH z IN zones[] IF xcoord>=z.x AND xcoord<=(z.x+z.w) AND ycoord>=z.y AND ycoord<=(z.y+z.h) zo=z.n BREAK ENDIF NEXT RETURN zoENDFUNCTIONFUNCTION ShowZones: FOREACH z IN zones[]// DRAWRECT z.x,z.y,5,5,RGB(0,255,0) DRAWLINE z.x,z.y,z.x+z.w,z.y,RGB(255,50,0) DRAWLINE z.x,z.y,z.x,z.y+z.h,RGB(255,50,0) DRAWLINE z.x+z.w,z.y+z.h,z.x+z.w,z.y,RGB(255,50,0) DRAWLINE z.x+z.w,z.y+z.h,z.x,z.y+z.h,RGB(255,50,0) PRINT z.n,z.x,z.y,1 NEXTENDFUNCTION
IF xcoord>=z.x AND xcoord<=(z.x+z.h) AND ycoord>=z.y AND ycoord<=(z.y+z.w)
IF xcoord>=z.x AND xcoord<=(z.x+z.w) AND ycoord>=z.y AND ycoord<=(z.y+z.h)
An Error Has Occurred!You are not allowed to access this section
I tried to download the demo but clicking on the link but I get the following message:Code: (glbasic) [Select]An Error Has Occurred!You are not allowed to access this sectionThanks.