This repository has been archived on 2022-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
glyphs-juke/main.cc

45 lines
861 B
C++
Raw Normal View History

2021-08-21 08:29:58 +00:00
#include <iostream>
#include <string>
2021-08-23 05:22:56 +00:00
#define NOMINMAX
2021-08-21 08:29:58 +00:00
#include <windows.h>
2021-08-23 05:22:56 +00:00
#undef NOMINMAX
2021-08-21 08:29:58 +00:00
#include "common.h"
#include "Font.h"
2021-08-23 05:22:56 +00:00
#include "Game.h"
2021-08-21 08:29:58 +00:00
#include "LinearAllocator.h"
#include "Win32Console.h"
constexpr size_t kHeapSize = 1024*1024*64;
constexpr uint32_t kWidth = 96;
constexpr uint32_t kHeight = 28;
int main() {
auto memory = std::make_unique<uint8_t[]>(kHeapSize);
gj::LinearAllocator alloc(memory.get(), kHeapSize);
gj::Win32Console console(&alloc, kWidth, kHeight);
console.Show();
2021-08-23 05:22:56 +00:00
gj::Game game(kWidth, kHeight);
2021-08-21 08:29:58 +00:00
while (true) {
2021-08-23 05:22:56 +00:00
game.Update();
2021-08-21 08:29:58 +00:00
{
2021-08-23 05:22:56 +00:00
auto& fb = console.TakeColorbuffer();
fb.Clear();
game.Draw(fb);
console.SwapColorbuffer();
2021-08-21 08:29:58 +00:00
}
{
2021-08-23 05:22:56 +00:00
auto& fb = console.TakeTextbuffer();
fb.Clear();
game.Write(fb);
console.SwapTextbuffer();
2021-08-21 08:29:58 +00:00
}
2021-08-23 05:22:56 +00:00
Sleep(100);
2021-08-21 08:29:58 +00:00
}
}