Demo/main/main.cpp

43 lines
1.1 KiB
C++

#include <iostream>
#include "internal.hpp"
#include "vkvm.hpp"
int main() {
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");
});
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();
}
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;
}