-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
123 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#include "label.hpp" | ||
|
||
using namespace graphics; | ||
|
||
label::label(std::shared_ptr<font> font, const std::string &text, const geometry::point &position) | ||
: _font(font), _text(text), _position(position) {} | ||
|
||
std::shared_ptr<label> label::create(std::shared_ptr<font> font, const std::string &text, const geometry::point &position) { | ||
return std::make_shared<label>(font, text, position); | ||
} | ||
|
||
void label::set(const std::string &text) { | ||
_text = text; | ||
} | ||
|
||
void label::set(const std::string &text, const geometry::point &position) { | ||
_text = text; | ||
_position = position; | ||
} | ||
|
||
void label::draw() const { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
#include "common.hpp" | ||
|
||
#include "font.hpp" | ||
#include "point.hpp" | ||
|
||
namespace graphics { | ||
class label : protected std::enable_shared_from_this<label> { | ||
public: | ||
label() = delete; | ||
label(std::shared_ptr<font> font, const std::string &text, const geometry::point &position); | ||
~label() = default; | ||
|
||
static std::shared_ptr<label> create(std::shared_ptr<font> font, const std::string &text, const geometry::point &position); | ||
|
||
void set(const std::string &text); | ||
|
||
void set(const std::string &text, const geometry::point &position); | ||
|
||
void draw() const; | ||
|
||
void dispose(); // ??? | ||
|
||
private: | ||
std::shared_ptr<font> _font; | ||
std::string _text; | ||
geometry::point _position; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters