Update packages, having issue with Text-width with new packages, not quite sure.
This commit is contained in:
@@ -64,7 +64,7 @@ CPMAddPackage(
|
||||
|
||||
CPMAddPackage(
|
||||
NAME JGL
|
||||
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-55.zip
|
||||
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-57.zip
|
||||
)
|
||||
|
||||
target_include_directories(JUI PUBLIC ${Event_SOURCE_DIR}/include)
|
||||
|
@@ -16,7 +16,7 @@ namespace JUI {
|
||||
public:
|
||||
|
||||
void RenderDataPoints() {
|
||||
J2D::Begin(canvas, true);
|
||||
J2D::Begin(canvas, nullptr, true);
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace JUI {
|
||||
prev = data_pt;
|
||||
}
|
||||
float target_line_height = (1.f / 60.f) * 1000;
|
||||
J2D::DrawString(Colors::Black, "60 FPS / 16.7ms (Target)", 0, 100 - target_line_height, 1.f, 10);
|
||||
J2D::DrawString(Colors::Black, "60 FPS / 16.7ms (Target)", 0, 100 - target_line_height, 10, 1.f);
|
||||
J2D::DrawLine(Colors::White, {0, 100 - target_line_height}, {GetAbsoluteSize().x, 100 - target_line_height}, 1);
|
||||
J2D::End();
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ namespace JUI
|
||||
Vector2 GetAbsoluteSize() const override;
|
||||
Vector2 GetAbsolutePosition() const override;
|
||||
void Draw() override;
|
||||
void InnerDraw() override;
|
||||
void Update(float delta) override;
|
||||
protected:
|
||||
private:
|
||||
|
@@ -48,18 +48,12 @@ void TextBase::Draw(const Vector2& abs_pos, const Vector2& abs_size, const std::
|
||||
std::string start = content;
|
||||
std::vector<std::string> lines;
|
||||
|
||||
|
||||
/*for (int i = 0; i < start.length(); i++) {
|
||||
std::string substr = start.substr(0, i);
|
||||
auto sub_bounds = this->GetFont().MeasureString(substr, size);
|
||||
|
||||
if (sub_bounds.x > abs_size.x)
|
||||
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
auto bounds = TextStyler::Font().MeasureString(content, size);
|
||||
// Do nothing if there is no text.
|
||||
if (bounds.x == 0 || bounds.y == 0)
|
||||
@@ -93,8 +87,9 @@ void TextBase::Draw(const Vector2& abs_pos, const Vector2& abs_size, const std::
|
||||
// if Render Target needs updating.
|
||||
if (state_redraw) {
|
||||
text_canvas->Resize({(int) bounds.x, (int) bounds.y});
|
||||
J2D::Begin(text_canvas, true);
|
||||
J2D::DrawString(color, content, 0, 0, scale, size, this->font);
|
||||
J2D::Begin(text_canvas, nullptr, true);
|
||||
//J2D::FillRect(Colors::Red, {0,0}, bounds);
|
||||
J2D::DrawString(color, content, 0, 0, size, scale, this->font);
|
||||
J2D::End();
|
||||
state_redraw = false;
|
||||
}
|
||||
@@ -105,7 +100,7 @@ void TextBase::Draw(const Vector2& abs_pos, const Vector2& abs_size, const std::
|
||||
//J2D::Begin();
|
||||
//J2D::OutlineRect(color, text_pos, bounds); // Draw bounding box for debugging.
|
||||
use_render_target ? J2D::DrawRenderTarget(text_canvas, {align_x, align_y})
|
||||
: J2D::DrawString(color, content, align_x, align_y, scale, size, this->font);
|
||||
: J2D::DrawString(color, content, align_x, align_y, size, scale, this->font);
|
||||
//J2D::End();
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,7 @@ Vector2 ScrollingRect::CanvasPosition() const {
|
||||
// Wouldn't inner draw actually render everything onto the RenderTarget?
|
||||
void ScrollingRect::InnerDraw() {
|
||||
|
||||
J2D::Begin(canvas, true);
|
||||
J2D::Begin(canvas, nullptr, true);
|
||||
auto saved_pos = position;
|
||||
auto saved_size = size;
|
||||
|
||||
|
@@ -26,7 +26,8 @@ namespace JUI {
|
||||
//return {0, 0};
|
||||
}
|
||||
|
||||
void Text::Draw() {
|
||||
void Text::InnerDraw()
|
||||
{
|
||||
auto abs_pos = this->GetAbsolutePosition();
|
||||
auto abs_size = this->GetAbsoluteSize();
|
||||
|
||||
@@ -35,6 +36,9 @@ namespace JUI {
|
||||
|
||||
TextBase::Draw(abs_pos+pos_pad, abs_size-size_pad);
|
||||
|
||||
}
|
||||
|
||||
void Text::Draw() {
|
||||
Widget::Draw();
|
||||
}
|
||||
|
||||
|
@@ -55,24 +55,37 @@ namespace JUI {
|
||||
auto* exb_rt = new RenderTarget(exb_tex);
|
||||
|
||||
if (exb_rt->SetMSAAEnabled(JGL::SampleRate::X8)) {/* using msaa to make the circle nicer. */}
|
||||
std::array<Color4, 2> exb_circle_colors {
|
||||
|
||||
/*std::array<Color4, 2> exb_circle_colors {
|
||||
Colors::White,//Color4(168, 28, 28, 255),
|
||||
Colors::White//Color4(212, 25, 25, 255)
|
||||
};
|
||||
|
||||
std::array<Vector2, 2> exb_circle_positions {
|
||||
Vector2(exb_rt->GetDimensions()) / 2,
|
||||
Vector2(exb_rt->GetDimensions()) / 2
|
||||
};
|
||||
Vector2(exb_rt->GetDimensions()) / 2,
|
||||
Vector2(exb_rt->GetDimensions()) / 2
|
||||
};
|
||||
|
||||
std::array<float, 2> exb_circle_radii {
|
||||
(float) (exb_rt->GetDimensions().x * 0.33),
|
||||
(float) (exb_rt->GetDimensions().x * 0.28)
|
||||
};
|
||||
(float) (exb_rt->GetDimensions().x * 0.33),
|
||||
(float) (exb_rt->GetDimensions().x * 0.28)
|
||||
};*/
|
||||
|
||||
J2D::Begin(exb_rt, true);
|
||||
J2D::BatchFillCircle(exb_circle_colors.data(), exb_circle_positions.data(), exb_circle_radii.data(), 24, 2);
|
||||
Instance2D exb_circle_data[2];
|
||||
exb_circle_data[0].color = Colors::White;
|
||||
exb_circle_data[1].color = Colors::White;
|
||||
exb_circle_data[0].position = Vector2(exb_rt->GetDimensions()) / 2.f;
|
||||
exb_circle_data[1].position = Vector2(exb_rt->GetDimensions()) / 2.f;
|
||||
exb_circle_data[0].scale = Vector2((float) (exb_rt->GetDimensions().x * 0.33));
|
||||
exb_circle_data[1].scale = Vector2((float) (exb_rt->GetDimensions().x * 0.28));
|
||||
|
||||
|
||||
|
||||
J2D::Begin(exb_rt, nullptr, true);
|
||||
J2D::BatchFillCircle(exb_circle_data, 24, 2);
|
||||
//J2D::BatchFillCircle(exb_circle_colors.data(), exb_circle_positions.data(), exb_circle_radii.data(), 24, 2);
|
||||
J2D::End();
|
||||
|
||||
delete exb_rt;
|
||||
|
||||
exit_btn = new ImageButton(Topbar);
|
||||
|
Reference in New Issue
Block a user