Alternating white and black stripes
This commit is contained in:
@@ -19,12 +19,12 @@ impl WlClient {
|
|||||||
self.wl_compositor_create_surface()?;
|
self.wl_compositor_create_surface()?;
|
||||||
self.layer_shell_get_layer_surface()?;
|
self.layer_shell_get_layer_surface()?;
|
||||||
|
|
||||||
self.layer_surface_set_size(800, 800)?;
|
self.layer_surface_set_size(18, 5)?;
|
||||||
self.layer_surface_set_keyboard_interactivity()?;
|
self.layer_surface_set_keyboard_interactivity()?;
|
||||||
self.wl_surface_commit()?;
|
self.wl_surface_commit()?;
|
||||||
|
|
||||||
self.wl_shm_create_pool(800, 800)?;
|
self.wl_shm_create_pool(18, 5)?;
|
||||||
self.wl_shm_pool_create_buffer(0, 800, 800)?;
|
self.wl_shm_pool_create_buffer(0, 18, 5)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ impl WlClient {
|
|||||||
pub fn wl_shm_create_pool(&mut self, width: usize, height: usize) -> Result<(), Box<dyn Error>> {
|
pub fn wl_shm_create_pool(&mut self, width: usize, height: usize) -> Result<(), Box<dyn Error>> {
|
||||||
self.current_id += 1;
|
self.current_id += 1;
|
||||||
self.shm_pool = Some(shm::ShmPool::new(width, height, self.current_id)?);
|
self.shm_pool = Some(shm::ShmPool::new(width, height, self.current_id)?);
|
||||||
self.shm_pool.as_mut().unwrap().write(&vec![0xffff0000; width * height], 0);
|
let mut grid: Vec<u32> = vec![0xffffffff; width * height];
|
||||||
self.shm_pool.as_mut().unwrap().rectangle(50, 50, 50, 50, 0xff00ff00);
|
for (pos, color) in grid.iter_mut().enumerate() {
|
||||||
self.shm_pool.as_mut().unwrap().circle(300, 300, 200, 0xff0000ff);
|
if (pos & 1) == 0 {
|
||||||
self.shm_pool.as_mut().unwrap().rounded_rectangle(450, 400, 60, 40, 16, 0xffffff00);
|
*color = 0xff000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.shm_pool.as_mut().unwrap().write(&grid, 0);
|
||||||
|
|
||||||
let object = self.shm_id.ok_or(UnsetErr("shm_id".to_string()))?;
|
let object = self.shm_id.ok_or(UnsetErr("shm_id".to_string()))?;
|
||||||
const OPCODE: u16 = 0;
|
const OPCODE: u16 = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user