Skip to content

Commit 0c4574c

Browse files
SiegeLordExSiegeLord
authored andcommitted
Bind vertex/index buffers.
1 parent 4946a87 commit 0c4574c

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

  • allegro_primitives-sys/src

allegro_primitives-sys/src/lib.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ pub mod allegro_primitives
6262
pub const ALLEGRO_LINE_CAP_TRIANGLE: c_uint = 3;
6363
pub const ALLEGRO_LINE_CAP_CLOSED: c_uint = 4;
6464

65+
pub const ALLEGRO_PRIM_BUFFER_STREAM: c_uint = 0x01;
66+
pub const ALLEGRO_PRIM_BUFFER_STATIC: c_uint = 0x02;
67+
pub const ALLEGRO_PRIM_BUFFER_DYNAMIC: c_uint = 0x04;
68+
pub const ALLEGRO_PRIM_BUFFER_READWRITE: c_uint = 0x08;
69+
6570
#[repr(C)]
6671
#[derive(Copy, Clone)]
6772
pub struct ALLEGRO_VERTEX_ELEMENT
@@ -87,6 +92,9 @@ pub mod allegro_primitives
8792
pub color: ALLEGRO_COLOR,
8893
}
8994

95+
opaque!(ALLEGRO_VERTEX_BUFFER);
96+
opaque!(ALLEGRO_INDEX_BUFFER);
97+
9098
extern "C" {
9199
pub fn al_get_allegro_primitives_version() -> u32;
92100
pub fn al_init_primitives_addon() -> c_bool;
@@ -228,5 +236,34 @@ pub mod allegro_primitives
228236
pub fn al_draw_filled_polygon_with_holes(
229237
vertices: *const c_float, vertex_counts: *const c_int, color: ALLEGRO_COLOR,
230238
);
239+
240+
pub fn al_create_vertex_buffer(
241+
decl: *mut ALLEGRO_VERTEX_DECL, initial_data: *const c_void, num_vertices: c_int,
242+
flags: c_int,
243+
) -> *mut ALLEGRO_VERTEX_BUFFER;
244+
245+
pub fn al_destroy_vertex_buffer(buffer: *mut ALLEGRO_VERTEX_BUFFER);
246+
247+
pub fn al_lock_vertex_buffer(
248+
buffer: *mut ALLEGRO_VERTEX_BUFFER, offset: c_int, length: c_int, flags: c_int,
249+
) -> *mut c_void;
250+
251+
pub fn al_unlock_vertex_buffer(buffer: *mut ALLEGRO_VERTEX_BUFFER);
252+
253+
pub fn al_get_vertex_buffer_size(buffer: *mut ALLEGRO_VERTEX_BUFFER) -> c_int;
254+
255+
pub fn al_create_index_buffer(
256+
index_size: c_int, initial_data: *const c_void, num_indices: c_int, flags: c_int,
257+
) -> *mut ALLEGRO_INDEX_BUFFER;
258+
259+
pub fn al_destroy_index_buffer(buffer: *mut ALLEGRO_INDEX_BUFFER);
260+
261+
pub fn al_lock_index_buffer(
262+
buffer: *mut ALLEGRO_INDEX_BUFFER, offset: c_int, length: c_int, flags: c_int,
263+
) -> *mut c_void;
264+
265+
pub fn al_unlock_index_buffer(buffer: *mut ALLEGRO_INDEX_BUFFER);
266+
267+
pub fn al_get_index_buffer_size(buffer: *mut ALLEGRO_INDEX_BUFFER) -> c_int;
231268
}
232269
}

0 commit comments

Comments
 (0)