Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] GUI Framework #30

Open
iceBear67 opened this issue Mar 4, 2022 · 6 comments
Open

[FEAT] GUI Framework #30

iceBear67 opened this issue Mar 4, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@iceBear67
Copy link
Member

GUI uses Kotlin DSL for definition.

An Example for that:

shape {
  "XXX",
  "AAA",
  "XXX
}

item "sidebars" {
  bind = "X"
  placeholder = Materials.GLASS_PANE
}

item "buttons" {
  bind = "A",
  placeholder = AstralItems.XX_XX
  onClick = ....
  requires = [
    "money > 100"
  ]
}

I'll complete this designation in future

@iceBear67 iceBear67 added enhancement New feature or request help wanted Extra attention is needed priority: low labels Mar 4, 2022
@iceBear67 iceBear67 self-assigned this Mar 4, 2022
@iceBear67
Copy link
Member Author

The example only defined what does dsl looks like, however we need a low-level and concrete implementation.

@iceBear67
Copy link
Member Author

GuiPattle

A class defines a ready-to-compile gui template consists of Points.It's unstateful but mutable.

1. loadFrom
This method merges other gui presets.

  1. fill(point from,point to,UnaryOperator op)
    This method allows us to modify an area of points.

  2. draw(BiConsumer<Pen,GuiPalette> a)
    This method opens a transaction and allows us to draw something.

  3. get Width/Height

  4. at(x,y) returns a point.

  5. `set/getTitle

  6. refresh updates all opened inventories for players.

  7. onRender(Consumer<GuiPalette> c) allows us to hook gui updates.

  8. addViewer(...) allows us to add viewer.

  9. clone

PalettePoint

getId set get clone

@iceBear67
Copy link
Member Author

Alignments

They're also components.

column [id] {} align components vertically

row [id] {} align components horizonally

Components

item [id] {
  [placeholder] = {placeholder selector}
  [meta] {
    [name] = ...
    [lore] = ...
    [modelId] = ...
  }
  [action] = [some predefined actions]
  [requires] = [some predefined conditions]
  [onClick] = {method}
}

@iceBear67
Copy link
Member Author

shape {
  "ABA",
  "BAB,
  "ABA"
}

@iceBear67
Copy link
Member Author

And how do we organize components with guipalette ? It will be a higher facade

@iceBear67
Copy link
Member Author

There is a interesting thing.

https://github.com/Simplix-Softworks/Cirrus

@iceBear67 iceBear67 added this to the Backlog milestone Mar 27, 2022
@iceBear67 iceBear67 modified the milestones: Backlog, 0.2.0-M1 May 13, 2022
@iceBear67 iceBear67 removed help wanted Extra attention is needed priority: low labels May 13, 2022
@iceBear67 iceBear67 modified the milestones: 0.2.0-M1, 0.2.0-M2 Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant