View Single Post
Old 01-27-2014, 06:36 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Originally Posted by Torankusu View Post
I am making a mock up of an inventory system, and I want to have grid alignment.

0 0 0 0
0 0 0 0

00 0 0
0 0 00

At the moment, I am using a frames control, And showimg for the icons (32x32 pix), and that works fine.

What I want to do, is, say for example I have an icon that id 32 pix wide, and 64 pixels in height. I need that to take up grid space like this:

0 0 X 0
0 0 X 0

Without allowing anything else To display in that slot (X's refer to 32x64 item.)

I have thought of checking for the width/height of the image and basically chopping it in two and displaying two halves (one half in each corresponding frame) but that seems messy.
If you already have a way to check the width/height of the images, when you set the amount per line to show read each one its putting in as it comes in a loop, and check the width/height there, set a temp.var in the order, then on the next line (i'd imagine also in your loop) do checks to see, and if it the temp.var is set, on that next line when the loop comes to it, make it null on that spot for the image, erase the temp.var, and if there are anymore the set above for the temp.var will reset it to the next one.

PHP Code:
for (temp.0temp.< array.size(); temp.i++) {
// set up a checker for what position in the line it is (#1 - 6 in each line)
if (!temp.itemPos) {
temp.itemPos 0;
temp.line 0;
// since this is for the line, if it's past the 6 max for the line, reset
if (itemPos 6) {
itemPos 0;

GuiImgCtrl("whatever"@someID/Name) {
set x's
    y = line + adjustment space here
    // set everything else, including where you read for your width/height
  // see if the width or height (or both) is more than 32
  if (getimgwidth(whaterver.image) > 32) {
    temp.checkW = true;
    temp.checkWID = itemPos + 1;
  if (getimgheight(whaterver.image) > 32) {
    temp.checkH = true;
    temp.checkHID = itemPos + 6;

  // now check the width/height
  if (checkW && itemPos == checkWID) {
    this.checkW = false;
    // set the next image to move over
    (@"whatever"@someID/Name).x = adjust over to next;

    itemPos += 2;
  }else if (checkH && itemPos == checkHID) {
    this.checkH = false;
    // set the image under to move over when you get there
    (@"whatever"@someID/Name).x = adjusted over 1 however u wanna do it;
    itemPos += 2;
  }else itemPos++;

  // make sure to add the img ctrl to a parent, either a scroll or window.

I haven't tested the above, just going off how I would start. It may not be the best; I'm not the best scripter. Someone might have a better way.
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page:
Graal Forum Thread:
Graalians Thread:

Last edited by sssssssssss; 01-27-2014 at 07:50 PM..
Reply With Quote