Files

> > CS2D > Lua Scripts > OOP Container/Layout
Files overviewCS2D overviewLua Scripts overview

English OOP Container/Layout >

6 comments11 kb, 439 Downloads

old OOP Container/Layout

tontonEd
User Off Offline

hello, I'm posting my implementation of gui container/Layouts.

I have no time nor desire to explain basic principle from scratch so to fully get this file, you have to know android Layout principle or web layout principle.
And java polymorphism if you want create your own layout.

all is containers, when you apply a layout on a container, this return you multiple containers depending the layout you used.

Container(int Id,Image bg, int dimx, int dimy, int x, int y,Color color)
Id - not used
dimx - dimmension x of the container
dimy - dimmension y of the container
x - position on screen of the container
y - position on screen of the container

Methods :
- addElement(Id, Image or string).
Id - not used
note : when you had an Element to a container, image or a string, don't create layout to this container after - that's is no sense. use bg container parametter for images instead.

-createLayout(Id,Layout,cpt)
Id - not used
Layout - Layout (meh)
cpt - int - global increment, important !
----------------------------------------------------------
all layout admit 4 parametters :
Layout(Int Id, Image bg, Int div or Int Heigt, Int space)
Id : the id - not used - put what you want
gb : background - type Image

the 3dr parametter is a int, but depending the nature of the layout this int mean something different,
1st case : div : numbers of divisions
2nd case : height : the number of division is set to 2, the height of the 1st or the 2nd containers.

space : the space between the containers.
-------------------------------------------------------------

Image(int Id, string path, int dimx, int dimy, boolean resize, float alpha)

Id - not used.
rest are obivius.

--------------------------------------------------------------

1st - you have to create a container :
local bg =Image(1,"gfx/pcsmix/window.png",272,440,false,1)
Color ={}
Color.BLUE = {52,152,219}

container1 =Container(1,bg,272,440,484,241,Color.BLUE)

2nd - add a windowsLayout to this container - you have to, that's the only contraint.

local WindowsLayout = WindowsLayout(1,"Create")
container1:createLayout(id,WindowsLayout,cptview[id])
aHeadContainerList:addHeadContainer(container1)

3rd - add element into container or again layout to infiniteee

here exemples : https://github.com/edwinmrtn/pcs_mixmatch/blob/master/view/create.lua

I wish the 3-4 people able to enjoy my file to enjoy my file
Approved by Rainoth

Download Download

11 kb, 439 Downloads

Comments

6 comments
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in

old

Nekomata
User Off Offline

U da real mvp
I like it!

old

Exist
User Off Offline

Cool Bro
I like it!

old

BcY
Reviewer Playing CS2D

It's looking really cool.Good job.
I like it!

old

Cebra
User Off Offline

It's a great idea
I like it!

old

Gaios
Reviewer Off Offline

I think this script is very good and clear
I like it!

old

Rainoth
Moderator Off Offline

Violet*
To the start Previous 1 Next To the start