Gamp: RedSquareES2.cpp (original) (raw)

This C++ example stub showcases the simple Launcher01.hpp mainloop framework integration.

This C++ example stub showcases the simple Launcher01.hpp mainloop framework integration. It creates a window, provides keyboard interaction and uses RedSquareES2 gamp::wt::RenderListener for rendering.

#include

#include

#include

#include "../demos/RedSquareES2.hpp"

#include "../demos/GLLauncher01.hpp"

private:

private:

public:

if( win ) {

win->dispose(e.when());

}

jau::fprintf_td(e.when().to_ms(), stdout, "Source: %s\n", win ? win->toString().c_str() : "null");

}

}

}

};

public:

m_kl(std::make_shared(*this)) { }

return false;

}

win->addKeyListener(m_kl);

return true;

}

win->removeKeyListener(m_kl);

}

};

int main(int argc, char *argv[])

{

return launch("RedSquareES2.hpp",

std::make_shared(), argc, argv);

}

int launch(std::string_view sfile, GLLaunchProps props, const RenderListenerSRef &demo, int argc, char *argv[])

int main(int argc, char *argv[])

std::shared_ptr< MyKeyListener > MyKeyListenerRef

void dispose(const WindowSRef &win, const jau::fraction_timespec &when) override

Notifies the listener to perform the release of all renderer resources per context,...

void dispose(const WindowSRef &, const jau::fraction_timespec &) override

Notifies the listener to perform the release of all renderer resources per context,...

bool init(const WindowSRef &, const jau::fraction_timespec &when) override

Called by the drawable immediately after the render context is initialized.

bool animating() const noexcept

std::string toString() const noexcept

constexpr VKeyCode keySym() const noexcept

Returns the virtual key symbol reflecting the current keyboard layout.

Listener for multiple KeyEvent.

virtual const PressedKeyCodes & pressedKeyCodes() const noexcept=0

constexpr const WindowWeakPtr & source() const noexcept

constexpr const jau::fraction_timespec & when() const noexcept

size_type count() const noexcept

@ verbose

Verbose operations (debugging).

std::shared_ptr< Window > WindowSRef

@ VK_ESCAPE

Constant for the ESCAPE function key.

@ VK_PAUSE

Constant for the PAUSE function key.

ssize_t fprintf_td(const uint64_t elapsed_ms, FILE *stream, std::string_view format, const Args &...args) noexcept

Convenient secure fprintf() invocation, prepending the given elapsed_ms timestamp and using jau:forma...

Timespec structure using int64_t for its components in analogy to struct timespec_t on 64-bit platfor...

constexpr uint64_t to_ms() const noexcept

Returns time in milliseconds.