Commit f18ff947 by Jamie Madill Committed by Commit Bot

Minor tweaks to SampleApplication.

Removes an unreferenced function. Also adds the ability for samples to respond to key up and down events. Only implemented on Windows. Bug: angleproject:2830 Change-Id: I44c9f93f0ad07b92923ffc0efa580f97d9b98693 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1908448Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 1abb0dd1
......@@ -191,9 +191,19 @@ int SampleApplication::run()
while (popEvent(&event))
{
// If the application did not catch a close event, close now
if (event.Type == Event::EVENT_CLOSED)
switch (event.Type)
{
exit();
case Event::EVENT_CLOSED:
exit();
break;
case Event::EVENT_KEY_RELEASED:
onKeyUp(event.Key);
break;
case Event::EVENT_KEY_PRESSED:
onKeyDown(event.Key);
break;
default:
break;
}
}
......@@ -226,3 +236,13 @@ bool SampleApplication::popEvent(Event *event)
{
return mOSWindow->popEvent(event);
}
void SampleApplication::onKeyUp(const Event::KeyEvent &keyEvent)
{
// Default no-op.
}
void SampleApplication::onKeyDown(const Event::KeyEvent &keyEvent)
{
// Default no-op.
}
......@@ -45,18 +45,21 @@ class SampleApplication
virtual void swap();
virtual void onKeyUp(const Event::KeyEvent &keyEvent);
virtual void onKeyDown(const Event::KeyEvent &keyEvent);
OSWindow *getWindow() const;
EGLConfig getConfig() const;
EGLDisplay getDisplay() const;
EGLSurface getSurface() const;
EGLContext getContext() const;
bool popEvent(Event *event);
int run();
void exit();
private:
bool popEvent(Event *event);
std::string mName;
uint32_t mWidth;
uint32_t mHeight;
......
......@@ -25,8 +25,8 @@ class ANGLE_UTIL_EXPORT OSWindow
static OSWindow *New();
static void Delete(OSWindow **osWindow);
virtual bool initialize(const std::string &name, int width, int height) = 0;
virtual void destroy() = 0;
virtual bool initialize(const std::string &name, int width, int height) = 0;
virtual void destroy() = 0;
int getX() const;
int getY() const;
......@@ -66,7 +66,6 @@ class ANGLE_UTIL_EXPORT OSWindow
protected:
OSWindow();
virtual ~OSWindow();
friend ANGLE_UTIL_EXPORT void FreeOSWindow(OSWindow *window);
int mX;
int mY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment