Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
netrunner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sharinigma
netrunner
Commits
7f5f4345
Commit
7f5f4345
authored
7 years ago
by
Odilitime
Browse files
Options
Downloads
Patches
Plain Diff
minor note, moved macro
parent
6963de42
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/graphics/components/TextComponent.cpp
+7
-4
7 additions, 4 deletions
src/graphics/components/TextComponent.cpp
with
7 additions
and
4 deletions
src/graphics/components/TextComponent.cpp
+
7
−
4
View file @
7f5f4345
...
...
@@ -2,8 +2,6 @@
#include
<iostream>
#include
<ctime>
#define posMac(p) (p * (3 + 4 + 2)) // 3 positions + 4 color channels + 2 S&T (texture mapping)
extern
TextRasterizerCache
*
rasterizerCache
;
TextComponent
::
TextComponent
(
const
std
::
string
&
rawText
,
const
int
rawX
,
const
int
rawY
,
const
unsigned
int
size
,
const
bool
bolded
,
const
unsigned
int
hexColor
,
const
int
passedWindowWidth
,
const
int
passedWindowHeight
)
{
...
...
@@ -88,6 +86,8 @@ TextComponent::~TextComponent() {
}
}
#define posMac(p) (p * (3 + 4 + 2)) // 3 positions + 4 color channels + 2 S&T (texture mapping)
inline
void
setVerticesColor
(
std
::
unique_ptr
<
float
[]
>
&
vertices
,
int
p
,
unsigned
int
color
)
{
vertices
[
static_cast
<
size_t
>
(
posMac
(
p
)
+
2
)]
=
0.0
f
;
vertices
[
static_cast
<
size_t
>
(
posMac
(
p
)
+
3
)]
=
(
static_cast
<
float
>
((
color
>>
24
)
&
0xFF
))
/
255
;
...
...
@@ -154,7 +154,7 @@ void TextComponent::rasterize(const int rawX, const int rawY) {
//std::cout << "glyph x from: " << (int)glyph.x0 << " to " << (int)glyph.x1 << std::endl;
float
vx1
=
startX
+
(
response
->
x1
-
response
->
x0
);
float
vy1
=
response
->
y1
+
rawY
;
//std::cout << "
t
ext
c
omponent at " << (int)vx0 << "," << (int)vy0 << " to " << (int)vx1 << "," << (int)vy1 << std::endl;
//std::cout << "
T
ext
C
omponent
::rasterize - placing
at " << (int)vx0 << "," << (int)vy0 << " to " << (int)vx1 << "," << (int)vy1 << std::endl;
// convert our local x,y,w,h into actual ogl coords
...
...
@@ -165,7 +165,7 @@ void TextComponent::rasterize(const int rawX, const int rawY) {
pointToViewport
(
vx0
,
vy0
);
pointToViewport
(
vx1
,
vy1
);
//std::cout << "
t
ext
c
omponent at GL" <<
(int)
vx0 << "," <<
(int)
vy0 << " to GL" <<
(int)
vx1 << "," <<
(int)
vy1 << std::endl;
//std::cout << "
T
ext
C
omponent
::rasterize - placing
at GL" << vx0 << "," << vy0 << " to GL" << vx1 << "," << vy1 << std::endl;
std
::
unique_ptr
<
float
[]
>
vertices
=
std
::
make_unique
<
float
[]
>
(
36
);
vertices
[
posMac
(
0
)
+
0
]
=
vx0
;
...
...
@@ -242,7 +242,10 @@ void TextComponent::resize(const int passedWindowWidth, const int passedWindowHe
availableWidth
=
passedAvailableWidth
;
//std::cout << "TextComponent::resize" << std::endl;
//std::cout << "TextComponent::resize - rasterizing at " << (int)x << "x" << (int)y << " size: " << (int)width << "x" << (int)height << std::endl;
// update the vertices and any wrapping
rasterize
(
x
,
y
);
//std::cout << "TextComponent::resize - rasterized at " << (int)x << "x" << (int)y << " size: " << (int)width << "x" << (int)height << std::endl;
// make sure we have glyphs
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment