+ more text in new unifont
This commit is contained in:
parent
047a9a7fa5
commit
65f10f7df7
@ -1 +1 @@
|
||||
#include "internal.hpp"
#include "vkvm.hpp"
#include "../src/Bitmap.hpp"
#include "../src/MathFunctions.hpp"
#include <unistd.h>
//time to sleep for in seconds
constexpr int sleepTime = 10;
void displayImage(const std::string &file, vkvm::GraphicMode graphicMode) {
vkvm::setMode(graphicMode);
Bitmap image(file);
vkvm::setWidth(image.getWidth());
vkvm::setHeight(image.getHeight());
for (int x = 0; x < vkvm::getWidth(); x++) {
for (int y = 0; y < vkvm::getHeight(); y++) {
unsigned int hex = image.getPixel(x, y);
vkvm::Color color = vkvm::Color(hex);
vkvm::setPixel(x, y, color);
}
}
}
void setColor(vkvm::Color color) {
for (int x = 0; x < vkvm::getWidth(); ++x) {
for (int y = 0; y < vkvm::getHeight(); ++y) {
vkvm::setPixel(x, y, color);
}
}
}
void displayImage(const std::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);
}
int main() {
bool running = 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);
vkvm::setMode(vkvm::GraphicMode::RGB);
mandelbrot();
sleep(sleepTime);
sleep(sleepTime);
setColor(vkvm::black);
sleep(sleepTime);
}
}
|
||||
#include "internal.hpp"
#include "vkvm.hpp"
#include "../src/Bitmap.hpp"
#include "../src/MathFunctions.hpp"
#include <unistd.h>
//time to sleep for in seconds
constexpr int sleepTime = 10;
void displayImage(const std::string &file, vkvm::GraphicMode graphicMode) {
vkvm::setMode(graphicMode);
Bitmap image(file);
vkvm::setWidth(image.getWidth());
vkvm::setHeight(image.getHeight());
for (int x = 0; x < vkvm::getWidth(); x++) {
for (int y = 0; y < vkvm::getHeight(); y++) {
unsigned int hex = image.getPixel(x, y);
vkvm::Color color = vkvm::Color(hex);
vkvm::setPixel(x, y, color);
}
}
}
void setColor(vkvm::Color color) {
for (int x = 0; x < vkvm::getWidth(); ++x) {
for (int y = 0; y < vkvm::getHeight(); ++y) {
vkvm::setPixel(x, y, color);
}
}
}
void displayImage(const std::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);
}
int main() {
bool running = 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);
vkvm::setFont(vkvm::FontType::Unifont);
vkvm::callEvent(vkvm::EventType::RenderText);
sleep(sleepTime);
vkvm::setText("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
sleep(sleepTime);
vkvm::setMode(vkvm::GraphicMode::RGB);
mandelbrot();
sleep(sleepTime);
sleep(sleepTime);
setColor(vkvm::black);
sleep(sleepTime);
}
}
|
@ -19,11 +19,12 @@ long double map(long double value, long double inputMin, long double inputMax, l
|
||||
}
|
||||
|
||||
void mandelbrot() {
|
||||
vkvm::setWidth(600);
|
||||
vkvm::setHeight(800);
|
||||
|
||||
int width = vkvm::getWidth();
|
||||
int height = vkvm::getHeight();
|
||||
int width = 800;
|
||||
int height = 600;
|
||||
|
||||
vkvm::setWidth(width);
|
||||
vkvm::setHeight(height);
|
||||
|
||||
long double min = -2.84;
|
||||
long double max = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user