Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Changes
Page history
Update to new event system
authored
Feb 20, 2022
by
Moritz Brückner
Hide whitespace changes
Inline
Side-by-side
Getting-Started.md
View page @
11fe5873
...
@@ -61,9 +61,8 @@ package;
...
@@ -61,9 +61,8 @@ package;
import
koui.Koui
;
import
koui.Koui
;
import
koui.elements.
*
;
import
koui.elements.
*
;
import
koui.events.EventHandler
;
import
koui.events.Events
;
import
koui.events.Events
;
import
koui.events.MouseEvent.MouseClickEvent
;
class
Main
{
class
Main
{
public
static
function
main
()
{
public
static
function
main
()
{
...
@@ -76,11 +75,11 @@ class Main {
...
@@ -76,11 +75,11 @@ class Main {
var
button
=
new
Button
(
"Click me!"
);
var
button
=
new
Button
(
"Click me!"
);
button
.
setPosition
(
400
,
180
);
button
.
setPosition
(
400
,
180
);
button
.
onMouseClick
(
function
(
e
:
Event
)
{
button
.
addEventListener
(
MouseClickEvent
,
(
e
:
MouseClick
Event
)
->
{
switch
(
e
.
s
tate
)
{
switch
(
e
.
getS
tate
()
)
{
case
Active
:
case
ClickHold
:
button
.
label
=
"Clicking"
;
button
.
label
=
"Clicking"
;
case
Deactivate
d
:
case
ClickEn
d
:
button
.
label
=
"Clicked"
;
button
.
label
=
"Clicked"
;
default
:
default
:
button
.
label
=
"Click me!"
;
button
.
label
=
"Click me!"
;
...
@@ -112,8 +111,7 @@ package arm;
...
@@ -112,8 +111,7 @@ package arm;
import
koui.Koui
;
import
koui.Koui
;
import
koui.elements.
*
;
import
koui.elements.
*
;
import
koui.events.EventHandler
;
import
koui.events.MouseEvent.MouseClickEvent
;
import
koui.events.Events
;
class
KouiTrait
extends
iron
.
Trait
{
class
KouiTrait
extends
iron
.
Trait
{
public
function
new
()
{
public
function
new
()
{
...
@@ -124,11 +122,11 @@ class KouiTrait extends iron.Trait {
...
@@ -124,11 +122,11 @@ class KouiTrait extends iron.Trait {
var
button
=
new
Button
(
"Click me!"
);
var
button
=
new
Button
(
"Click me!"
);
button
.
setPosition
(
400
,
180
);
button
.
setPosition
(
400
,
180
);
button
.
onMouseClick
(
function
(
e
:
Event
)
{
button
.
addEventListener
(
MouseClickEvent
,
(
e
:
MouseClick
Event
)
->
{
switch
(
e
.
s
tate
)
{
switch
(
e
.
getS
tate
()
)
{
case
Active
:
case
ClickHold
:
button
.
label
=
"Clicking"
;
button
.
label
=
"Clicking"
;
case
Deactivate
d
:
case
ClickEn
d
:
button
.
label
=
"Clicked"
;
button
.
label
=
"Clicked"
;
default
:
default
:
button
.
label
=
"Click me!"
;
button
.
label
=
"Click me!"
;
...
...
...
...