Mystify Demo, TwoEleven updates & Snake (#21)
* **New Features** * Added Mystify screensaver demo with animated polygons and trails * Added Snake game with multiple difficulties, high-score persistence, and multi-input (touch/keyboard) support * Added CLI tool for building, packaging, and deploying apps (end-to-end build/install/run workflow) * Per-grid-size high-score persistence added to 2048 app; expanded keyboard controls (WASD and device-specific mappings) * **Documentation** * Added Snake README with gameplay, controls, and usage instructions
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <tt_hal_display.h>
|
||||
#include <Tactility/kernel/Kernel.h>
|
||||
|
||||
/**
|
||||
* Wrapper for tt_hal_display_driver_*
|
||||
*/
|
||||
class DisplayDriver {
|
||||
|
||||
DisplayDriverHandle handle = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
explicit DisplayDriver(DeviceId id) {
|
||||
assert(tt_hal_display_driver_supported(id));
|
||||
handle = tt_hal_display_driver_alloc(id);
|
||||
assert(handle != nullptr);
|
||||
}
|
||||
|
||||
~DisplayDriver() {
|
||||
tt_hal_display_driver_free(handle);
|
||||
}
|
||||
|
||||
bool lock(TickType_t timeout = tt::kernel::MAX_TICKS) const {
|
||||
return tt_hal_display_driver_lock(handle, timeout);
|
||||
}
|
||||
|
||||
void unlock() const {
|
||||
tt_hal_display_driver_unlock(handle);
|
||||
}
|
||||
|
||||
uint16_t getWidth() const {
|
||||
return tt_hal_display_driver_get_pixel_width(handle);
|
||||
}
|
||||
|
||||
uint16_t getHeight() const {
|
||||
return tt_hal_display_driver_get_pixel_height(handle);
|
||||
}
|
||||
|
||||
ColorFormat getColorFormat() const {
|
||||
return tt_hal_display_driver_get_colorformat(handle);
|
||||
}
|
||||
|
||||
void drawBitmap(int xStart, int yStart, int xEnd, int yEnd, const void* pixelData) const {
|
||||
tt_hal_display_driver_draw_bitmap(handle, xStart, yStart, xEnd, yEnd, pixelData);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user