Jump to content

Recommended Posts

Intro
The idea of a GUI layout manager is simple: instead of using raw coordinate values we can use sets of rules and let the system calculate UI element positions and sizes for us. Just think about how mobile phones scale their apps for different screen sizes and orientations, or how web browsers manage page layout.
 

GUI Layout Manager for Arma 3
This layout manager is written in SQF. It supports several sizing and positioning options for rows, columns and elements inside cells. Just watch the video:

 

Summary of supported layout rules

Column/row sizes: absolute and relative
columnSizes.png

Cell content sizes: absolute and relative
contentSizes.png

Cell content positioning: relative and snapping to borders
contentPos.png

Content margins:
margins.png

 

Layout Example
For example, this is how the code for the following GUI looks like:
https://github.com/Sparker95/Layout-Manager/blob/master/tests/example.sqf
example.png


Source code and docs

Please check the GitHub page to get the code or documentation:
https://github.com/Sparker95/Layout-Manager

https://github.com/Sparker95/Layout-Manager/wiki/1-Basic-concepts
 

I hope this helps someone in GUI adventures. So far I have seen zero people who like to do positioning of GUIs for Arma (including myself), I really hope that this code changes it!

 
  • Like 7
  • Thanks 4

Share this post


Link to post
Share on other sites

I've been experimenting with this and God I wish we could've gotten this years ago but then again better late than never so thank you @Sparker!

 

Additionally I would like to report that I've been getting this one error when running both example.sqf and test.sqf with [] execVM "tests\test.sqf"; from the console.

 

Image:

https://ibb.co/r6Yhf2s

Share this post


Link to post
Share on other sites

Hey, so I guess you're the first person to try the test code? I'm glad that you are enjoying it 🙂.

Thanks for the error report, I've fixed the issue, make sure you update the code from the repository. I didn't notice it because I was testing the code with a call compile ... of the files, instead of spawning the code. In this case the game doesn't report unknown variable names, unfortunately 😕 and I totally forgot that

  • Thanks 1

Share this post


Link to post
Share on other sites
3 hours ago, Sparker said:

Hey, so I guess you're the first person to try the test code? I'm glad that you are enjoying it 🙂.

Thanks for the error report, I've fixed the issue, make sure you update the code from the repository. I didn't notice it because I was testing the code with a call compile ... of the files, instead of spawning the code. In this case the game doesn't report unknown variable names, unfortunately 😕 and I totally forgot that

 

I am pretty sure I was not the first but perhaps I tested it more than anyone else 😉

 

I was wandering a few minor things:

 

A-) This tool was meant as a fully scripted (.sqf) way to implement GUIs (a replacement to the current Arma 3 system) or B-) This is rather a tool (complement to the current Arma 3 system) to make it easier for the mission makers to get their GUI template like they want and then export it to regular GUI format (.hpp).

 

I am asking because I have modified your example .sqf and test.sqf exactly like I wanted but don't know how to export it or how to customize each button etc. Once I have the template the way I want it how I am supposed to continue the customization?

Share this post


Link to post
Share on other sites

This is a fully scripted solution to solve the problems of UI element positioning and size. It's up to you how to set event handlers of your controls and how to decorate them:
- You can use arma's standard Rsc... config classes and create elements according to them, then register them in the grids.
- You can create your own GUI element config classes, then create elements in code and do the same.
- You can also customize the elements (event handlers, color, text size, etc) by SQF code when you create the controls.

There is no 'export this to config' button, the goal was to get rid of horrible configs for size and positioning :).

Share this post


Link to post
Share on other sites
19 hours ago, Sparker said:

There is no 'export this to config' button, the goal was to get rid of horrible configs for size and positioning :).

 

That is great to know! Out of all the possible uses of this tool that one is the best by far, no need to export to something that is quite unwieldy.

 

I have a working GUI in config format and want to do the same but on your GUI solution. I was wondering if you could help me on that regard and I can contact you on discord if you can.  

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×