RIP tp::Strings

This commit is contained in:
IlyaShurupov 2024-03-22 14:44:26 +03:00 committed by Ilya Shurupov
parent fa2d0aaa92
commit 1756ca026d
90 changed files with 419 additions and 1475 deletions

View file

@ -11,7 +11,7 @@ file(GLOB HEADERS "./public/*.hpp" "./public/*/*.hpp")
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS})
target_include_directories(${PROJECT_NAME} PUBLIC ./public/ ${BINDINGS_INCLUDE} ./ext/)
target_link_libraries(${PROJECT_NAME} PUBLIC Graphics Connection Widgets Math Strings)
target_link_libraries(${PROJECT_NAME} PUBLIC Graphics Connection Widgets Math)
target_link_libraries(${PROJECT_NAME} PUBLIC ${BINDINGS_LIBS})
### -------------------------- Applications -------------------------- ###

View file

@ -33,15 +33,5 @@ void runApp() {
}
int main() {
tp::ModuleManifest* deps[] = { &tp::gModuleStrings, nullptr };
tp::ModuleManifest binModule("LibViewEntry", nullptr, nullptr, deps);
if (!binModule.initialize()) {
return 1;
}
runApp();
binModule.deinitialize();
}

View file

@ -1,6 +1,5 @@
#include "Strings.hpp"
#include "Buffer.hpp"
#include "LocalConnection.hpp"
#include "Shader.hpp"
@ -96,7 +95,7 @@ void RenderShader::load(const char* pvert, const char* pgeom, const char* pfrag,
if (paths) {
String content;
std::string content;
auto loadFile = [&](const char* path) {
LocalConnection file;
@ -105,26 +104,30 @@ void RenderShader::load(const char* pvert, const char* pgeom, const char* pfrag,
return false;
}
content.resize(file.size());
file.readBytes(content.write(), content.size());
const auto size = file.size();
auto tmp = new char[size + 1];
tmp[size] = 0;
file.readBytes(tmp, size);
content = tmp;
delete[] tmp;
return true;
};
printf("Compiling shader : %s\n", pvert);
if (loadFile(pvert)) {
compile_shader(content.read(), VertexShaderID);
compile_shader(content.c_str(), VertexShaderID);
}
if (GeometryShaderID) {
printf("Compiling shader : %s\n", pgeom);
if (loadFile(pgeom)) {
compile_shader(content.read(), GeometryShaderID);
compile_shader(content.c_str(), GeometryShaderID);
}
}
printf("Compiling shader : %s\n", pfrag);
if (loadFile(pfrag)) {
compile_shader(content.read(), FragmentShaderID);
compile_shader(content.c_str(), FragmentShaderID);
}
}
else {

View file

@ -3,8 +3,6 @@
#include "Map.hpp"
#include "Strings.hpp"
#include "Shader.hpp"
#include "GraphicsApi.hpp"
@ -71,7 +69,7 @@ void RenderTexture::draw(const GLuint& out) {
struct texture_drawer_data {
Map<String, GLuint> textures;
Map<std::string, GLuint> textures;
GLuint quad_VertexArrayID;
GLuint quad_vertexbuffer;
@ -147,7 +145,7 @@ void RenderTexture::draw_texture(uint4 out, uint4 in) {
texdd->shader.unbind();
}
GLuint load_texture(const String& name) {
GLuint load_texture(const std::string& name) {
GLuint tex_2d = 0;
ASSERT(0 && "incomplete compilation - no SOIL support added");

View file

@ -5,7 +5,6 @@
#include "Map.hpp"
#include "Topology.hpp"
#include "Color.hpp"
#include "Strings.hpp"
#include "GraphicsApi.hpp"
#include "FrameBuffer.hpp"
@ -88,7 +87,7 @@ namespace tp {
Layer() = default;
~Layer();
String name = "new layer";
std::string name = "new layer";
List<Stroke*> strokes; // TODO use vector
bool enabled = true;
};
@ -108,13 +107,13 @@ namespace tp {
Camera mCamera;
RGBA mBackgroundColor = { 0.22f, 0.22f, 0.25f, 1.f };
Map<String, Brush*> mBrushes;
String mActiveBrush;
Map<std::string, Brush*> mBrushes;
std::string mActiveBrush;
};
class Brush {
public:
String mType = "equal";
std::string mType = "equal";
Brush() = default;
virtual void sample(Project* proj, Vec2F crs, halnf pressure) {}
virtual void draw(Renderer* render, const Camera* camera) {}