API updates

master
Mark 2024-02-16 13:29:19 -08:00
parent 327e2b43b3
commit 69b35bd43c
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
2 changed files with 37 additions and 37 deletions

View File

@ -57,8 +57,8 @@ fn init(state) {
(radar_size / 2.0 + 5), (radar_size / 2.0 + 5),
(radar_size / -2.0 - 5), (radar_size / -2.0 - 5),
3.5, 3.5, 3.5, 3.5,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
); );
sprite::add("radar.frame.ne", "ui::radarframe", init_pos); sprite::add("radar.frame.ne", "ui::radarframe", init_pos);
@ -114,12 +114,12 @@ fn event(state, event) {
fn step(state) { fn step(state) {
radialbar::set_val("shield", radialbar::set_val("shield",
state.player_ship().get_shields() state.player_ship().current_shields()
/ state.player_ship().get_total_shields() / state.player_ship().stat_shield_strength()
); );
radialbar::set_val("hull", radialbar::set_val("hull",
state.player_ship().get_hull() state.player_ship().current_hull()
/ state.player_ship().get_total_hull() / state.player_ship().total_hull()
); );
@ -138,8 +138,8 @@ fn step(state) {
Rect( Rect(
pos.x(), pos.y(), pos.x(), pos.y(),
5.0, 5.0, 5.0, 5.0,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
sprite::set_angle("radar.arrow", angle - 90.0); sprite::set_angle("radar.arrow", angle - 90.0);
@ -201,8 +201,8 @@ fn step(state) {
Rect( Rect(
pos.x(), pos.y(), pos.x(), pos.y(),
size, size, size, size,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
} else { } else {
@ -211,8 +211,8 @@ fn step(state) {
Rect( Rect(
pos.x(), pos.y(), pos.x(), pos.y(),
size, size, size, size,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
} }
@ -263,8 +263,8 @@ fn step(state) {
Rect( Rect(
pos.x(), pos.y(), pos.x(), pos.y(),
size, size, size, size,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
} else { } else {
@ -273,8 +273,8 @@ fn step(state) {
Rect( Rect(
pos.x(), pos.y(), pos.x(), pos.y(),
size, size, size, size,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
} }
@ -291,8 +291,8 @@ fn step(state) {
(radar_size / 2.0 + 5) - dx, (radar_size / 2.0 + 5) - dx,
(radar_size / -2.0 - 5) + dy, (radar_size / -2.0 - 5) + dy,
3.5, 3.5, 3.5, 3.5,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
sprite::set_rect("radar.frame.se", sprite::set_rect("radar.frame.se",
@ -300,8 +300,8 @@ fn step(state) {
(radar_size / 2.0 + 5) - dx, (radar_size / 2.0 + 5) - dx,
(radar_size / -2.0 - 5) - dy, (radar_size / -2.0 - 5) - dy,
3.5, 3.5, 3.5, 3.5,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
sprite::set_rect("radar.frame.sw", sprite::set_rect("radar.frame.sw",
@ -309,8 +309,8 @@ fn step(state) {
(radar_size / 2.0 + 5) + dx, (radar_size / 2.0 + 5) + dx,
(radar_size / -2.0 - 5) - dy, (radar_size / -2.0 - 5) - dy,
3.5, 3.5, 3.5, 3.5,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
sprite::set_rect("radar.frame.nw", sprite::set_rect("radar.frame.nw",
@ -318,8 +318,8 @@ fn step(state) {
(radar_size / 2.0 + 5) + dx, (radar_size / 2.0 + 5) + dx,
(radar_size / -2.0 - 5) + dy, (radar_size / -2.0 - 5) + dy,
3.5, 3.5, 3.5, 3.5,
Anchor::Center, Anchor::NorthWest,
Anchor::NorthWest Anchor::Center
) )
); );
} }

View File

@ -7,8 +7,8 @@ fn init(state) {
"ui::planet::button", "ui::planet::button",
Rect( Rect(
99.0, 128.0, 73.898, 18.708, 99.0, 128.0, 73.898, 18.708,
Anchor::NorthWest, Anchor::Center,
Anchor::Center Anchor::NorthWest
) )
); );
@ -23,8 +23,8 @@ fn init(state) {
}, },
Rect( Rect(
-180.0, 142.0, 274.0, 135.0, -180.0, 142.0, 274.0, 135.0,
Anchor::NorthWest, Anchor::Center,
Anchor::Center Anchor::NorthWest
) )
); );
sprite::set_mask("landscape", "ui::landscapemask"); sprite::set_mask("landscape", "ui::landscapemask");
@ -40,17 +40,17 @@ fn init(state) {
); );
// If this is not set, the button will // If this is not set, the button will
// not receive events // not receive events
sprite::set_disable_events("frame", true); sprite::disable_events("frame", true);
textbox::add( textbox::add(
"title", 10.0, 10.0, "title", 10.0, 10.0,
Color(1.0, 1.0, 1.0, 1.0),
Rect( Rect(
-70.79, 138.0, 59.867, 10.0, -70.79, 138.0, 59.867, 10.0,
Anchor::NorthWest, Anchor::Center,
Anchor::Center Anchor::NorthWest
), )
Color(1.0, 1.0, 1.0, 1.0)
); );
textbox::align_center("title"); textbox::align_center("title");
textbox::font_serif("title"); textbox::font_serif("title");
@ -61,12 +61,12 @@ fn init(state) {
textbox::add( textbox::add(
"desc", 7.5, 8.0, "desc", 7.5, 8.0,
Color(1.0, 1.0, 1.0, 1.0),
Rect( Rect(
-178.92, -20.3, 343.0, 81.467, -178.92, -20.3, 343.0, 81.467,
Anchor::NorthWest, Anchor::Center,
Anchor::Center Anchor::NorthWest
), )
Color(1.0, 1.0, 1.0, 1.0)
); );
textbox::font_sans("desc"); textbox::font_sans("desc");
if state.player_ship().is_landed() { if state.player_ship().is_landed() {