#include"internal.hpp"#include"vkvm.hpp"#include"../src/Bitmap.hpp"#include"../src/MathFunctions.hpp"#include<unistd.h>//time to sleep for in seconds
constexprintsleepTime=10;voiddisplayImage(conststd::string&file,vkvm::GraphicModegraphicMode){vkvm::setMode(graphicMode);Bitmapimage(file);vkvm::setWidth(image.getWidth());vkvm::setHeight(image.getHeight());for(intx=0;x<vkvm::getWidth();x++){for(inty=0;y<vkvm::getHeight();y++){unsignedinthex=image.getPixel(x,y);vkvm::Colorcolor=vkvm::Color(hex);vkvm::setPixel(x,y,color);}}}voidsetColor(vkvm::Colorcolor){for(intx=0;x<vkvm::getWidth();++x){for(inty=0;y<vkvm::getHeight();++y){vkvm::setPixel(x,y,color);}}}voiddisplayImage(conststd::string&file){displayImage(file,vkvm::GraphicMode::RGB);vkvm::callEvent(vkvm::EventType::Redraw);sleep(sleepTime);vkvm::setMode(vkvm::GraphicMode::Gray_256);vkvm::callEvent(vkvm::EventType::Redraw);sleep(sleepTime);vkvm::setMode(vkvm::GraphicMode::TwoColors);vkvm::callEvent(vkvm::EventType::Redraw);sleep(sleepTime);}intmain(){boolrunning=true;vkvm::initialize(0);while(running){displayImage("../res/P6.bmp");sleep(sleepTime);vkvm::setBackgroundColor(vkvm::red);vkvm::setForegroundColor(vkvm::blue);vkvm::callEvent(vkvm::EventType::Redraw);sleep(sleepTime);vkvm::setBackgroundColor(vkvm::black);vkvm::setForegroundColor(vkvm::white);vkvm::callEvent(vkvm::EventType::Redraw);displayImage("../res/P8.bmp");displayImage("../res/P9.bmp");displayImage("../res/P10.bmp");vkvm::setText("Hello World");sleep(sleepTime);vkvm::setFont(vkvm::FontType::FuturisticBlack);vkvm::callEvent(vkvm::EventType::RenderText);sleep(sleepTime);vkvm::setText("Hello World, lorem ipsum dolor sit amet");sleep(sleepTime);vkvm::setFont(vkvm::FontType::ProFontIIX);vkvm::callEvent(vkvm::EventType::RenderText);sleep(sleepTime);mandelbrot();sleep(sleepTime);sleep(sleepTime);setColor(vkvm::black);sleep(sleepTime);}}