-
Notifications
You must be signed in to change notification settings - Fork 2
/
event_control.h
executable file
·39 lines (31 loc) · 1015 Bytes
/
event_control.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <kvs/Version> //KVS2
#include <kvs/Scene> //KVS2
#include <kvs/InitializeEventListener>
#include <kvs/KeyPressEventListener>
#include <kvs/Key>
#include <kvs/glut/Screen>
#include <kvs/ColorImage>
#include <kvs/Camera>
#include "Input.h"
class KeyPressEvent : public kvs::KeyPressEventListener
{
void update( kvs::KeyEvent* e )
{
switch ( e->key() )
{
case kvs::Key::s:
{
std::cerr << "\n** Snapshot (BMP)" << std::endl;
kvs::ColorImage snapshot_image = static_cast<kvs::glut::Screen*>( screen() )->scene()->camera()->snapshot();
char str[256];
extern size_t nPeels;
snprintf(str, sizeof str, "%zu", nPeels);
std::string npeel = str;
snapshot_image.write( "./IMAGE_DATA/Layer" + npeel + ".bmp" );
}
default:
break;
} // end switch
}
};