2019-11-28 15:20:15 +01:00
|
|
|
//#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();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// vkvm::setMode(vkvm::GraphicMode::RGB);
|
|
|
|
//
|
|
|
|
// vkvm::setPixel(0,0, vkvm::getBackgroundColor());
|
|
|
|
// vkvm::setPixel(5,8, vkvm::getForegroundColor());
|
|
|
|
//
|
|
|
|
// vkvm::Color color = vkvm::getPixel(0,0);
|
|
|
|
// vkvm::log(vkvm::INFO,"color = (", (int)color.getRed(), ", ", (int)color.getGreen(), ", ", (int)color.getBlue(), ")");
|
|
|
|
// color = vkvm::getPixel(5,8);
|
|
|
|
// vkvm::log(vkvm::INFO,"color = (", (int)color.getRed(), ", ", (int)color.getGreen(), ", ", (int)color.getBlue(), ")");
|
|
|
|
//
|
|
|
|
// vkvm::setMode(vkvm::GraphicMode::TwoColors);
|
|
|
|
//
|
|
|
|
// color = vkvm::getPixel(0,0);
|
|
|
|
// vkvm::log(vkvm::INFO,"color = (", (int)color.getRed(), ", ", (int)color.getGreen(), ", ", (int)color.getBlue(), ")");
|
|
|
|
// color = vkvm::getPixel(5,8);
|
|
|
|
// vkvm::log(vkvm::INFO,"color = (", (int)color.getRed(), ", ", (int)color.getGreen(), ", ", (int)color.getBlue(), ")");
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// 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;
|
|
|
|
//}
|
|
|
|
|
2019-11-19 12:15:20 +01:00
|
|
|
#include <iostream>
|
2019-11-28 15:20:15 +01:00
|
|
|
#include "../src/demo.h"
|
2019-11-19 12:15:20 +01:00
|
|
|
#include "internal.hpp"
|
2019-11-19 12:26:31 +01:00
|
|
|
#include "vkvm.hpp"
|
2019-11-28 15:20:15 +01:00
|
|
|
#include "../src/Imagedisplay.hpp"
|
|
|
|
#include <unistd.h>
|
2019-10-16 16:27:14 +02:00
|
|
|
|
2019-11-28 17:14:27 +01:00
|
|
|
void outPutPixel(int windowHeight, int windowWidth);
|
2019-11-19 12:15:20 +01:00
|
|
|
|
2019-11-28 15:20:15 +01:00
|
|
|
int main(){
|
2019-11-26 11:49:55 +01:00
|
|
|
|
2019-11-28 15:20:15 +01:00
|
|
|
vkvm::initialize(0);
|
2019-11-26 11:49:55 +01:00
|
|
|
|
2019-11-28 15:20:15 +01:00
|
|
|
vkvm::setDefaultValues();
|
2019-11-26 13:24:53 +01:00
|
|
|
|
2019-11-28 15:20:15 +01:00
|
|
|
vkvm::registerEvent(vkvm::Timer, [](){
|
|
|
|
std::cout <<"picture" << std::endl;
|
|
|
|
vkvm::Color backgroundColor = vkvm::getBackgroundColor();
|
|
|
|
for(int i = 0; i<1000; i++) {
|
2019-11-28 18:42:38 +01:00
|
|
|
Imagedisplay imagedisplay("../src/P6.bmp");
|
2019-11-28 17:14:27 +01:00
|
|
|
for (int w = 0; w < vkvm::getWidth(); w++) {
|
|
|
|
for (int h = 0; h < vkvm::getHeight(); h++) {
|
2019-11-28 15:20:15 +01:00
|
|
|
unsigned int a ;
|
|
|
|
a = imagedisplay.getPixel(w, h);
|
|
|
|
vkvm::setPixel(w,h,vkvm::Color(a));
|
2019-11-26 13:24:53 +01:00
|
|
|
|
2019-11-28 15:20:15 +01:00
|
|
|
}
|
|
|
|
}
|
2019-11-28 17:14:27 +01:00
|
|
|
outPutPixel(vkvm::getHeight() ,vkvm::getWidth());
|
2019-11-28 15:20:15 +01:00
|
|
|
sleep(5);
|
|
|
|
vkvm::setDefaultValues();
|
2019-11-26 13:24:53 +01:00
|
|
|
|
2019-11-28 18:42:38 +01:00
|
|
|
Imagedisplay imagedisplay2("../src/P8.bmp");
|
2019-11-28 17:14:27 +01:00
|
|
|
|
|
|
|
for (int w = 0; w < vkvm::getWidth(); w++) {
|
|
|
|
for (int h = 0; h < vkvm::getHeight(); h++) {
|
2019-11-28 15:20:15 +01:00
|
|
|
unsigned int a ;
|
|
|
|
a = imagedisplay2.getPixel(w, h);
|
|
|
|
vkvm::setPixel(w,h,vkvm::Color(a));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sleep(5);
|
|
|
|
vkvm::setDefaultValues();
|
2019-11-26 13:24:53 +01:00
|
|
|
|
2019-11-28 18:42:38 +01:00
|
|
|
Imagedisplay imagedisplay3("../src/P9.bmp");
|
|
|
|
for (int w = 0; w < vkvm::getWidth(); w++) {
|
|
|
|
for (int h = 0; h < vkvm::getHeight(); h++){
|
|
|
|
unsigned int a ;
|
|
|
|
a = imagedisplay3.getPixel(w, h);
|
|
|
|
vkvm::setPixel(w,h,vkvm::Color(a));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
sleep(5);
|
|
|
|
vkvm::setDefaultValues();
|
|
|
|
|
|
|
|
Imagedisplay imagedisplay4("../src/P10.bmp");
|
|
|
|
for (int w = 0; w < vkvm::getWidth(); w++) {
|
|
|
|
for (int h = 0; h < vkvm::getHeight(); h++){
|
|
|
|
unsigned int a ;
|
|
|
|
a = imagedisplay4.getPixel(w, h);
|
|
|
|
vkvm::setPixel(w,h,vkvm::Color(a));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
sleep(5);
|
2019-11-19 12:15:20 +01:00
|
|
|
}
|
2019-11-28 15:20:15 +01:00
|
|
|
|
|
|
|
});
|
|
|
|
vkvm::callEvent(vkvm::Timer);
|
|
|
|
|
2019-11-28 17:14:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void outPutPixel(int windowHeight, int windowWidth) {
|
|
|
|
for(int y = 0; y < windowHeight; y++) {
|
|
|
|
for(int x = 0; x < windowWidth; x++) {
|
|
|
|
if(vkvm::getPixel(x, y).getRed() !=0) {
|
|
|
|
std::cout << "*";
|
|
|
|
} else {
|
|
|
|
std::cout << " ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::cout << "\n";
|
|
|
|
}
|
2019-11-28 15:20:15 +01:00
|
|
|
}
|