--- a/rust/lib-hwengine-future/src/lib.rs Mon Jan 02 15:59:26 2023 +0100
+++ b/rust/lib-hwengine-future/src/lib.rs Tue Jan 03 12:05:59 2023 +0100
@@ -23,6 +23,16 @@
}
#[no_mangle]
+pub extern "C" fn land_set(game_field: &mut GameField, x: i32, y: i32, value: u16) {
+ game_field.collision.map(y, x, |p| *p = value);
+}
+
+#[no_mangle]
+pub extern "C" fn land_row(game_field: &mut GameField, row: i32) -> *mut u16 {
+ game_field.collision[row as usize].as_mut_ptr()
+}
+
+#[no_mangle]
pub extern "C" fn land_fill(
game_field: &mut GameField,
x: i32,
@@ -36,11 +46,6 @@
}
#[no_mangle]
-pub extern "C" fn land_set(game_field: &mut GameField, x: i32, y: i32, value: u16) {
- game_field.collision.map(y, x, |p| *p = value);
-}
-
-#[no_mangle]
pub extern "C" fn land_pixel_get(game_field: &mut GameField, x: i32, y: i32) -> u32 {
game_field.pixels.map(y, x, |p| *p)
}
@@ -51,6 +56,11 @@
}
#[no_mangle]
+pub extern "C" fn land_pixel_row(game_field: &mut GameField, row: i32) -> *mut u32 {
+ game_field.pixels[row as usize].as_mut_ptr()
+}
+
+#[no_mangle]
pub extern "C" fn dispose_game_field(game_field: *mut GameField) {
unsafe { drop(Box::from_raw(game_field)) };
}