classicube_sys\graphics/
owned_vertex_buffer.rs1use crate::{bindings::*, std_types::c_int};
2
3pub struct OwnedGfxVertexBuffer {
4 pub resource_id: GfxResourceID,
5}
6
7impl OwnedGfxVertexBuffer {
8 pub fn new(fmt: VertexFormat, max_vertices: c_int) -> Self {
9 let resource_id = unsafe { Gfx_CreateDynamicVb(fmt, max_vertices) };
10
11 assert!(resource_id as usize != 0);
12
13 Self { resource_id }
14 }
15}
16
17impl Drop for OwnedGfxVertexBuffer {
18 fn drop(&mut self) {
19 unsafe {
20 Gfx_DeleteVb(&mut self.resource_id);
21 }
22 }
23}