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
ab314d2a
Commit
ab314d2a
authored
7 years ago
by
Odilitime
Browse files
Options
Downloads
Patches
Plain Diff
renderDocumentComponents(), if not boundToPage reset textProgram scroll position
parent
2af214c0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/graphics/components/MultiComponent.cpp
+38
-1
38 additions, 1 deletion
src/graphics/components/MultiComponent.cpp
src/graphics/components/MultiComponent.h
+4
-0
4 additions, 0 deletions
src/graphics/components/MultiComponent.h
with
42 additions
and
1 deletion
src/graphics/components/MultiComponent.cpp
+
38
−
1
View file @
ab314d2a
...
...
@@ -180,9 +180,24 @@ void MultiComponent::resize(const int passedWindowWidth, const int passedWindowH
void
MultiComponent
::
render
()
{
//std::cout << "MultiComponent::render" << std::endl;
glUseProgram
(
win
->
fontProgram
);
renderDocumentComponents
(
rootComponent
);
glUseProgram
(
win
->
textureProgram
);
renderBoxComponents
(
rootComponent
);
// if we flip, we can't put tab labels on top of the tab
glUseProgram
(
win
->
fontProgram
);
if
(
!
boundToPage
)
{
GLint
transformLocation
=
glGetUniformLocation
(
win
->
fontProgram
,
"transform"
);
GLenum
glErr
=
glGetError
();
if
(
glErr
!=
GL_NO_ERROR
)
{
std
::
cout
<<
"InputComponent::render - glGetUniformLocation not ok: "
<<
glErr
<<
std
::
endl
;
}
glUniformMatrix4fv
(
transformLocation
,
1
,
GL_FALSE
,
win
->
transformMatrix
);
glErr
=
glGetError
();
if
(
glErr
!=
GL_NO_ERROR
)
{
std
::
cout
<<
"InputComponent::render - glUniformMatrix4fv not ok: "
<<
glErr
<<
std
::
endl
;
}
}
renderComponents
(
rootComponent
);
}
...
...
@@ -192,10 +207,12 @@ void MultiComponent::renderComponents(std::shared_ptr<Component> component) {
std
::
cout
<<
"DocumentComponent::renderComponents - got null passed"
<<
std
::
endl
;
return
;
}
/*
DocumentComponent *docComponent = dynamic_cast<DocumentComponent*>(component.get());
if (docComponent) {
docComponent->render();
}
*/
TextComponent
*
textComponent
=
dynamic_cast
<
TextComponent
*>
(
component
.
get
());
if
(
textComponent
)
{
textComponent
->
render
();
...
...
@@ -209,6 +226,26 @@ void MultiComponent::renderComponents(std::shared_ptr<Component> component) {
}
}
void
MultiComponent
::
renderDocumentComponents
(
std
::
shared_ptr
<
Component
>
component
)
{
if
(
!
component
)
{
std
::
cout
<<
"MultiComponent::renderBoxComponents - got null passed"
<<
std
::
endl
;
return
;
}
//std::cout << "MultiComponent::renderBoxComponents - renderering: " << component->name << std::endl;
// render non-text components too
DocumentComponent
*
docComponent
=
dynamic_cast
<
DocumentComponent
*>
(
component
.
get
());
if
(
docComponent
)
{
docComponent
->
render
();
}
// is this needed?
if
(
component
->
children
.
empty
())
{
return
;
}
for
(
std
::
shared_ptr
<
Component
>
&
child
:
component
->
children
)
{
this
->
renderDocumentComponents
(
child
);
}
}
void
MultiComponent
::
renderBoxComponents
(
std
::
shared_ptr
<
Component
>
component
)
{
if
(
!
component
)
{
std
::
cout
<<
"MultiComponent::renderBoxComponents - got null passed"
<<
std
::
endl
;
...
...
@@ -225,7 +262,7 @@ void MultiComponent::renderBoxComponents(std::shared_ptr<Component> component) {
return
;
}
for
(
std
::
shared_ptr
<
Component
>
&
child
:
component
->
children
)
{
renderBoxComponents
(
child
);
this
->
renderBoxComponents
(
child
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/graphics/components/MultiComponent.h
+
4
−
0
View file @
ab314d2a
...
...
@@ -7,14 +7,18 @@
// we're a control with our own componentTree
// we can relay events down to these components
// can be used for documents, tabs and menus
//
// this component is not scrollable
class
MultiComponent
:
public
Component
{
public:
MultiComponent
(
const
float
rawX
,
const
float
rawY
,
const
float
rawWidth
,
const
float
rawHeight
,
const
int
passedWindowWidth
,
const
int
passedWindowHeight
);
void
render
();
void
renderComponents
(
std
::
shared_ptr
<
Component
>
component
);
void
renderDocumentComponents
(
std
::
shared_ptr
<
Component
>
component
);
void
renderBoxComponents
(
std
::
shared_ptr
<
Component
>
component
);
void
resize
(
const
int
passedWindowWidth
,
const
int
passedWindowHeight
);
std
::
shared_ptr
<
Component
>
searchComponentTree
(
const
std
::
shared_ptr
<
Component
>
&
component
,
const
int
passedX
,
const
int
passedY
);
std
::
vector
<
std
::
shared_ptr
<
Component
>>
layers
;
std
::
shared_ptr
<
Component
>
rootComponent
=
std
::
make_shared
<
Component
>
();
Window
*
win
;
bool
tabbed
=
false
;
...
...
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