mirror of
https://github.com/usatiuk/cardboy.git
synced 2025-10-29 07:37:48 +01:00
less template pain
This commit is contained in:
@@ -46,6 +46,8 @@ private:
|
||||
|
||||
class SMDSurface : public Surface<SMDSurface, BwPixel>, public StandardEventQueue<SMDSurface> {
|
||||
public:
|
||||
using PixelType = BwPixel;
|
||||
|
||||
SMDSurface(EventLoop* loop);
|
||||
|
||||
~SMDSurface() override;
|
||||
|
||||
@@ -77,28 +77,28 @@ extern "C" void app_main() {
|
||||
EventLoop loop;
|
||||
SMDSurface surface(&loop);
|
||||
|
||||
surface.set_window<GridWindow<SMDSurface, BwPixel, 2, 2>>();
|
||||
surface.set_window<GridWindow<SMDSurface, 2, 2>>();
|
||||
|
||||
GridWindow<SMDSurface, BwPixel, 2, 2>* window =
|
||||
static_cast<GridWindow<SMDSurface, BwPixel, 2, 2>*>(surface.get_window());
|
||||
window->set_window<TextWindow<SubSurface<SMDSurface, BwPixel>, BwPixel, std::string>>(0, 0, &loop, "hello");
|
||||
window->set_window<TextWindow<SubSurface<SMDSurface, BwPixel>, BwPixel, std::string>>(0, 1, &loop, "hello1");
|
||||
window->set_window<GridWindow<SubSurface<SMDSurface, BwPixel>, BwPixel, 2, 2>>(1, 0);
|
||||
GridWindow<SubSurface<SMDSurface, BwPixel>, BwPixel, 2, 2>* window2 =
|
||||
static_cast<GridWindow<SubSurface<SMDSurface, BwPixel>, BwPixel, 2, 2>*>(
|
||||
GridWindow<SMDSurface, 2, 2>* window =
|
||||
static_cast<GridWindow<SMDSurface, 2, 2>*>(surface.get_window());
|
||||
window->set_window<TextWindow<SubSurface<SMDSurface>, std::string>>(0, 0, &loop, "hello");
|
||||
window->set_window<TextWindow<SubSurface<SMDSurface>, std::string>>(0, 1, &loop, "hello1");
|
||||
window->set_window<GridWindow<SubSurface<SMDSurface>, 2, 2>>(1, 0);
|
||||
GridWindow<SubSurface<SMDSurface>, 2, 2>* window2 =
|
||||
static_cast<GridWindow<SubSurface<SMDSurface>, 2, 2>*>(
|
||||
window->get_subsurface(1, 0).get_window());
|
||||
window->set_window<TextWindow<SubSurface<SMDSurface, BwPixel>, BwPixel, std::string>>(1, 1, &loop, "hello3");
|
||||
window->set_window<TextWindow<SubSurface<SMDSurface>, std::string>>(1, 1, &loop, "hello3");
|
||||
|
||||
window2->set_window<TextWindow<SubSurface<SubSurface<SMDSurface, BwPixel>, BwPixel>, BwPixel, std::string>>(
|
||||
window2->set_window<TextWindow<SubSurface<SMDSurface>, std::string>>(
|
||||
0, 0, &loop, "hello2");
|
||||
window2->set_window<TextWindow<SubSurface<SubSurface<SMDSurface, BwPixel>, BwPixel>, BwPixel, std::string>>(
|
||||
window2->set_window<TextWindow<SubSurface<SMDSurface>, std::string>>(
|
||||
0, 1, &loop, "hello4");
|
||||
window2->set_window<TextWindow<SubSurface<SubSurface<SMDSurface, BwPixel>, BwPixel>, BwPixel, std::string>>(
|
||||
window2->set_window<TextWindow<SubSurface<SMDSurface>, std::string>>(
|
||||
1, 0, &loop, "hello5");
|
||||
window2->set_window<TextWindow<SubSurface<SubSurface<SMDSurface, BwPixel>, BwPixel>, BwPixel, std::string>>(
|
||||
window2->set_window<TextWindow<SubSurface<SMDSurface>, std::string>>(
|
||||
1, 1, &loop, "hello6");
|
||||
|
||||
auto* tl_text = static_cast<TextWindow<SubSurface<SMDSurface, BwPixel>, BwPixel, std::string>*>(
|
||||
auto* tl_text = static_cast<TextWindow<SubSurface<SMDSurface>, std::string>*>(
|
||||
window->get_subsurface(0, 0).get_window());
|
||||
|
||||
surface.handle(SurfaceResizeEvent{DISP_WIDTH, DISP_HEIGHT});
|
||||
|
||||
Reference in New Issue
Block a user