Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
shadowrecon

Divide Screen Into Boxes

Recommended Posts

This function will take the parameters you input and divide them into equal boxes. This could be useful for alot of different applications, will save time and keep you from inputting a ton of manual parameters.

 

[scar]

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Function DivideScreen(xs, ys, xe, ye, divi: Integer): TBoxArray;

Contributors: ShadowRecon.

Description: Divides section of the screen into equal boxes for later use.

Date Created: May 21, 2012. By ShadowRecon.

Last Modified: May 21, 2012. By ShadowRecon.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

Function DivideScreen(xs, ys, xe, ye, divi: Integer): TBoxArray;

Var

I: Integer;

Begin

SetLength(Result, (divi * divi));

for I := 0 to (divi * divi) - 1 do

Result := Box(Round(xs + ((I mod divi) * ((xe - xs) / divi))), Round(ys + ((I div divi) * ((ye - ys) / divi))), Round(xs + ((xe - xs) / divi) + ((I mod divi) * ((xe - xs) / divi))), Round(ys + ((ye - ys) / divi) + ((I div divi) * ((ye - ys) / divi))));

end;

[/scar]

Share this post


Link to post
Share on other sites
I can imagine a few uses for this already.

 

Yeah i found it pretty useful it always seems i need to break things into boxes and with this you can set the size of the area and then divide it into equal sections.

 

btw i love this forum for us to put random functions. =)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...