mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2026-02-04 09:19:19 +01:00
Fix precompiled headers
Added edge detection (if it works :/)
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
<ClCompile Include="SoundStream.cpp" />
|
||||
<ClCompile Include="structs.cpp" />
|
||||
<ClCompile Include="SVGParser.cpp" />
|
||||
<ClCompile Include="Text.cpp" />
|
||||
<ClCompile Include="Texture.cpp" />
|
||||
<ClCompile Include="utils.cpp" />
|
||||
<ClCompile Include="Vector2f.cpp" />
|
||||
@@ -58,6 +59,7 @@
|
||||
<ClInclude Include="SoundStream.h" />
|
||||
<ClInclude Include="structs.h" />
|
||||
<ClInclude Include="SVGParser.h" />
|
||||
<ClInclude Include="Text.h" />
|
||||
<ClInclude Include="Texture.h" />
|
||||
<ClInclude Include="Transform.h" />
|
||||
<ClInclude Include="utils.h" />
|
||||
|
||||
17
Engine/Text.cpp
Normal file
17
Engine/Text.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "Text.h"
|
||||
|
||||
#include <iostream>
|
||||
Text::Text(const std::string& text, const std::string& fontPath, int size, const Color4f& color): m_Text(text), m_FontPath(fontPath), m_Color(color) {
|
||||
m_Texture = new Texture(text, fontPath, size, color);
|
||||
m_IsCreatedOk = m_Texture->IsCreationOk();
|
||||
if(!m_IsCreatedOk) {
|
||||
std::cout << "Error creating text texture, Text: " << text << std::endl;
|
||||
}
|
||||
}
|
||||
Text::~Text() {
|
||||
if(m_IsCreatedOk && m_Texture->IsCreationOk()) {
|
||||
}
|
||||
}
|
||||
void Text::Draw(const Point2f& pos) const {
|
||||
m_Texture->Draw(pos);
|
||||
}
|
||||
24
Engine/Text.h
Normal file
24
Engine/Text.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include "Texture.h"
|
||||
#include "../Game/TextureManager.h"
|
||||
|
||||
class Text
|
||||
{
|
||||
public:
|
||||
Text(const std::string& text, const std::string& fontPath, int size, const Color4f& color);
|
||||
Text() = default;
|
||||
~Text();
|
||||
|
||||
void Draw(const Point2f& pos) const;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
std::string m_Text;
|
||||
std::string m_FontPath;
|
||||
Color4f m_Color;
|
||||
Texture* m_Texture;
|
||||
bool m_IsCreatedOk{ false };
|
||||
};
|
||||
Reference in New Issue
Block a user