Demo/main/main.cpp

43 lines
1.1 KiB
C++
Raw Normal View History

2019-11-19 12:15:20 +01:00
#include <iostream>
#include "internal.hpp"
2019-11-19 12:26:31 +01:00
#include "vkvm.hpp"
int main() {
2019-11-19 12:15:20 +01:00
vkvm::initialize(0);
vkvm::registerEvent(vkvm::EventType::Redraw, [](){
vkvm::log(vkvm::INFO, "redraw event callback");
});
vkvm::registerEvent(vkvm::EventType::Timer, [](){
vkvm::log(vkvm::INFO, "timer event callback");
});
2019-11-26 11:49:55 +01:00
vkvm::buttonPressed(vkvm::KeyCode::A);
vkvm::buttonPressed(vkvm::KeyCode::D);
vkvm::buttonPressed(vkvm::KeyCode::Z);
vkvm::buttonPressed(vkvm::KeyCode::Backspcce);
vkvm::KeyCode code = vkvm::getLastPressedKey();
while(code != 0){
vkvm::log(vkvm::INFO, "keyCode: ", code);
code = vkvm::getLastPressedKey();
}
2019-11-19 12:15:20 +01:00
std::string input;
while(input != "exit"){
std::cout << "type r for redraw and t for timer (exit to exit)" << std::endl;
std::cout << "> ";
std::getline(std::cin, input);
if(input == "r"){
vkvm::callEvent(vkvm::Redraw);
}
if(input == "t"){
vkvm::callEvent(vkvm::Timer);
}
}
return 0;
}