You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Aether is a UI component library engine for Minecraft** and LWJGL projects (or anything really). You can create your
6
-
own renderer implementation or use the default implementation
7
-
with *[NanoVG](https://github.com/memononen/nanovg"An anti-aliased vector graphics library")*, which is an **
8
-
Anti-Aliased vector graphics library**. **Please note the project is in the early stages of development.** Bugs may
9
-
arise, and there might be incomplete/missing features. The library is licensed under GPL-v2.0 license.
5
+
Aether is a UI component engine for Minecraft. It's designed with Kotlin, Figma, and Minecraft in mind. Aether is
6
+
designed to allow you to customize the renderer to your own, or the default one
7
+
with *[NanoVG, an anti-aliased 2D vector graphics library](https://github.com/memononen/nanovg"An anti-aliased vector graphics library")*.
8
+
As mentioned before, Aether is designed with Figma in mind. Features such as [Auto Layouts](https://help.figma.com/hc/en-us/articles/360040451373-Explore-auto-layout-properties)
9
+
and [Figma Font](https://help.figma.com/hc/en-us/articles/360039956434-Getting-started-with-text) are implemented to
10
+
streamline the process of creating UIs from Figma. The library is licensed under GPL-v2.0 license.
10
11
11
-
Ready to get started? [Check out the docs!](https://aether.prismclient.net/)
12
+
Convinced? [Check out the docs!](https://aether.prismclient.net/)
12
13
13
14
# Including the project
14
15
@@ -18,11 +19,11 @@ Ready to get started? [Check out the docs!](https://aether.prismclient.net/)
@@ -241,20 +243,20 @@ open class Aether(renderer: UIRenderer) {
241
243
* as de-focusing the focused component and adding listeners to input.
242
244
*/
243
245
companionobject Properties {
246
+
247
+
val timings:Timings=Timings()
248
+
244
249
@JvmStatic
245
250
var debug:Boolean=true
246
251
247
252
@JvmStatic
248
253
lateinitvar instance:Aether
249
-
protected set
250
254
251
255
@JvmStatic
252
256
lateinitvar renderer:UIRenderer
253
-
protected set
254
257
255
258
@JvmStatic
256
259
var activeScreen:UIScreen?=null
257
-
protected set
258
260
259
261
/**
260
262
* The focused component (if applicable).
@@ -265,92 +267,79 @@ open class Aether(renderer: UIRenderer) {
265
267
*/
266
268
@JvmStatic
267
269
var focusedComponent:UIFocusable?=null
268
-
protected set
269
270
270
271
/**
271
272
* The width of the screen. It can be set via [update]
272
273
*/
273
274
@JvmStatic
274
275
var width:Float=0f
275
-
protected set
276
276
277
277
/**
278
278
* The width of the screen. It can be set via [update]
279
279
*/
280
280
@JvmStatic
281
281
var height:Float=0f
282
-
protected set
283
282
284
283
/**
285
284
* The device pixel ratio. It can be set via [update]. It is the equivalent of content scale.
286
285
*/
287
286
@JvmStatic
288
287
var devicePxRatio:Float=1f
289
-
protected set
290
288
291
289
/**
292
290
* The x position of the mouse relative to the screen
293
291
*/
294
292
@JvmStatic
295
293
var mouseX:Float=0f
296
-
protected set
297
294
298
295
/**
299
296
* The y position of the mouse relative to the screen
300
297
*/
301
298
@JvmStatic
302
299
var mouseY:Float=0f
303
-
protected set
304
300
305
301
/**
306
302
* Invoked whenever the layout needs to be updated. This can be when the screen
307
303
* is resized or created. Invoked prior to components.
308
304
*/
309
305
@JvmStatic
310
306
var updateListeners:HashMap<String, Runnable>?=null
311
-
protected set
312
307
313
308
/**
314
309
* The listeners for then the mouse is moved. Invoked prior to components.
315
310
*/
316
311
@JvmStatic
317
312
var mouseMoveListeners:HashMap<String, Runnable>?=null
318
-
protected set
319
313
320
314
/**
321
315
* Invoked when the mouse is pressed. Invoked prior to components.
322
316
*/
323
317
@JvmStatic
324
318
var mousePressedListeners:HashMap<String, Runnable>?=null
325
-
protected set
326
319
327
320
/**
328
321
* Invoked when the mouse is released. Invoked prior to components.
329
322
*/
330
323
@JvmStatic
331
324
var mouseReleasedListeners:HashMap<String, Runnable>?=null
332
-
protected set
333
325
334
326
/**
335
327
* Invoked when a key is pressed. Invoked prior to components.
336
328
*/
337
329
@JvmStatic
338
330
var keyPressListeners:HashMap<String, Consumer<Char>>?=null
339
-
protected set
340
331
341
332
/**
342
333
* Invoked when the mouse is scrolled. Invoked prior to components.
343
334
*/
344
335
@JvmStatic
345
336
var mouseScrollListeners:HashMap<String, Consumer<Float>>?=null
346
-
protected set
347
337
348
338
/**
349
339
* Invoked when the screen is deleted. This is used to deallocate listeners added to UICore.
350
340
*/
351
341
@JvmStatic
352
342
var deallocationListeners:HashMap<String, Runnable>?=null
353
-
protected set
354
343
355
344
/**
356
345
* The list of modifier keys. The value is if the key is pressed
@@ -502,13 +491,7 @@ open class Aether(renderer: UIRenderer) {
502
491
* Focuses the component. Please use [UIComponent.focus] instead.
503
492
*/
504
493
@JvmStatic
505
-
funfocus(component:UIFocusable) {
506
-
// Check if the given value is a valid instance of UIComponent
507
-
try {
508
-
component asUIComponent<*>
509
-
} catch (castException:ClassCastException) {
510
-
throwRuntimeException("When trying to focus, the provided value is not an instance of UIComponent. Make sure you are only using the UIFocus interface to focus UIComponents.")
511
-
}
494
+
fun <T> focus(component:T) where T : UIComponent<*>, T : UIFocusable {
512
495
focusedComponent = component
513
496
}
514
497
@@ -548,7 +531,8 @@ open class Aether(renderer: UIRenderer) {
548
531
for (i in0 until instance.frames!!.size) {
549
532
// UIContainers are what control scrolling, so
550
533
// if it is not an instance of it, skip and continue
551
-
val container = instance.frames!![i] as?UIContainer<*> ?:continue
534
+
@Suppress("UNCHECKED_CAST")
535
+
val container = instance.frames!![i] as?UIContainer<UIContainerSheet> ?:continue
552
536
if (container.isMouseInsideBounds() && container.expandedHeight >0f&& container.style.overflowY !=UIContainerSheet.Overflow.None) {
553
537
// Iterate through the frame to see if there are more
554
538
// containers with it. If there are, it will pass true
0 commit comments