src/polygoncache.h

Sun, 09 Apr 2023 15:59:08 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sun, 09 Apr 2023 15:59:08 +0300
changeset 362
e1d646a4cbd8
parent 338
719b909a7d2b
permissions
-rw-r--r--

Extracted the state of the program into a MainState structure, and extracted local functions of main() into static functions.
I was planning to make the core logic and state of the program into a Main class, which would be a QObject that would
have lots of signals and slots, but it looks like this works even without it

#pragma once
#include <QTextDocument>
#include "src/basics.h"
#include "src/model.h"
#include "src/gl/common.h"

template<typename T>
struct WithId : T
{
	std::int32_t linenumber;
};

struct PolygonCache
{
	using vector_type = std::vector<WithId<PolygonElement>>;
	vector_type polygons;
	bool needRecache = true;
};

void recacheIfNeeded(
	PolygonCache* cache,
	QTextDocument* model,
	class DocumentManager* documents);
PolygonCache* findPolygonCacheForModel(QTextDocument* model, DocumentManager* context);

mercurial