HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: resizable panel/window question  (Read 2641 times)

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
resizable panel/window question
« on: Mar 24, 14, 10:38:22 AM »

Hi!

I want to implement some logic which is very similar to the resizeable panel. I was trying to find where is this logic implemented but couldn't find it (basically i want to reuse the same code, without having to reinvent the wheel). Is this panel resizing done via hsl, or is it something in the underlaying engine?
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: resizable panel/window question
« Reply #1 on: Mar 24, 14, 04:01:59 PM »

I am pretty sure that is done in the source code, not script.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: resizable panel/window question
« Reply #2 on: Mar 24, 14, 04:14:47 PM »

Blargh.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: resizable panel/window question
« Reply #3 on: Mar 25, 14, 08:03:52 PM »

I have written my own script code for something similar which resizes some of the panels we use. Here is a small section of it. It might help you get started. This is mostly working, with a small jitter on the resize.

Code: [Select]
// used to resize the panels and buttons to fit on window
method onMouseDrag(args references Class GUIMouseEvent)
  over as NodeRef of Class GUIControl = GetGUIControlUnderMouse()
  overPP as NodeRef of Class GUIControl

  if over <> None
    overPP = over.parent.parent
    if overPP <> None
      if overPP.name <> "PICwindow"
        return
      .
    .
  .

  if args.source is kindof GUIResizePanel
    if over <> None
      var win = FindGUIControlByName(None, "game.PICwindow" )
      screen as Vector3 = GetViewPortSize()
      type as NodeRef of Class GUIControl
      sizeX as Float
      sizeY as Float

      if over.name = "resizeTop" or over.name = "resizeBottom"
        win.size.x = win.size.y
      else
        win.size.y = win.size.x
      .
      if (win.size.x + win.position.x) > screen.x
        win.size.x = screen.x - win.position.x
        win.size.y = win.size.x
      .
      if (win.size.y + win.position.y) > screen.y
        win.size.y = screen.y - win.position.y
        win.size.x = win.size.y
      .
      if win.position.x < 0
        win.position.x = 0
      .
      if win.position.y < 0
        win.position.y = 0
      .
      size as NodeRef of Class GUILabel = FindGUIControlByName(win, "mysize")   // temp
      size.text = "("+win.size.x+"x"+win.size.y+")"

      win = FindGUIControlByName(None, "game.PICwindow.buttonPanel" )
      sizeX = (win.size.x - 12) / 5

      loop i from 1 to 5
        type = FindGUIControlByName(win, "Button"+i )    // buttons up top
        type.size.x = sizeX
      .
      setPanelSize()

      args.handled = true
    .
  .
.

// resize main panel
function setPanelSize()
  var win = FindGUIControlByName(None, "game.PICwindow" )
  type as NodeRef of Class GUIControl
  sizeX as Float = (win.size.x - 24) / 4
  sizeY as Float = (win.size.y - 64) / 4

  win = FindGUIControlByName(None, "game.PICwindow.mainPan2")
  loop i from 1 to 3
    type = FindGUIControlByName(win, "window"+i )   // power panel
    type.size.x = sizeX
  .
  type = FindGUIControlByName(win, "window5" )
  type.size.y = sizeY

  sizeX = (sizeX - 29) / 4
  loop i from 1 to 4
    type = FindGUIControlByName(win, "window1.butpanel.tab"+i )
    type.size.x = sizeX
  .
.

Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: resizable panel/window question
« Reply #4 on: Mar 26, 14, 02:33:07 AM »

thanks, i'll check it out
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: resizable panel/window question
« Reply #5 on: Apr 01, 14, 11:37:02 PM »

Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685