-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cla-137: added support for center layers (#104)
- Loading branch information
Showing
8 changed files
with
125 additions
and
16 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
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,24 @@ | ||
// This file belongs to the Classeine project | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// SPDX-FileCopyrightText: © 2024-2025 Ernesto Bascón Pantoja | ||
|
||
#include <clsn/draw/draw_utils.h> | ||
|
||
#include <clsn/draw/dimension.h> | ||
|
||
namespace clsn::draw | ||
{ | ||
auto draw_utils::calculate_position_at_center( | ||
const dimension& target, | ||
const dimension& element_to_center) -> point | ||
{ | ||
const auto center = draw::point{ target.get_width() / 2, target.get_height() / 2 }; | ||
|
||
return { | ||
center.get_x() - element_to_center.get_width() / 2, | ||
center.get_y() - element_to_center.get_height() / 2 | ||
}; | ||
|
||
} | ||
} |
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 @@ | ||
// This file belongs to the Classeine project | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// SPDX-FileCopyrightText: © 2024-2025 Ernesto Bascón Pantoja | ||
|
||
#pragma once | ||
|
||
#include <clsn/core/non_instantiable.h> | ||
|
||
#include <clsn/draw/point.h> | ||
|
||
namespace clsn::draw | ||
{ | ||
class dimension; | ||
|
||
class draw_utils : public core::non_instantiable | ||
{ | ||
public: | ||
static auto calculate_position_at_center( | ||
const dimension& target, | ||
const dimension& element_to_center) -> point; | ||
}; | ||
} |
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