Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bbguimaraes
college
Commits
2bef88f3
Commit
2bef88f3
authored
Jul 23, 2016
by
bbguimaraes
Browse files
sms: option to hide simulations
parent
963e6b2a
Changes
3
Hide whitespace changes
Inline
Side-by-side
sms/sms/include/simulation.h
View file @
2bef88f3
...
...
@@ -9,6 +9,7 @@ class Simulation {
std
::
vector
<
SpringMassSystem
*>
m_systems
;
double
m_update_rate
;
bool
m_paused
;
bool
m_visible
;
bool
m_draw_masses
;
bool
m_textured
;
bool
m_texturable
;
...
...
@@ -19,6 +20,7 @@ class Simulation {
public:
Simulation
()
:
m_paused
(
false
),
m_visible
(
true
),
m_draw_masses
(
true
),
m_textured
(
false
),
m_texturable
(
false
),
...
...
@@ -30,6 +32,7 @@ class Simulation {
{
return
&
this
->
m_systems
;}
double
update_rate
()
const
{
return
this
->
m_update_rate
;}
bool
paused
()
const
{
return
this
->
m_paused
;}
bool
visible
()
const
{
return
this
->
m_visible
;}
bool
draw_masses
()
const
{
return
this
->
m_draw_masses
;}
bool
textured
()
const
{
return
this
->
m_textured
;}
bool
texturable
()
const
{
return
this
->
m_texturable
;}
...
...
@@ -41,6 +44,7 @@ class Simulation {
{
this
->
m_systems
=
v
;}
void
set_update_rate
(
double
r
)
{
this
->
m_update_rate
=
r
;}
void
set_paused
(
bool
p
)
{
this
->
m_paused
=
p
;}
void
set_visible
(
bool
v
)
{
this
->
m_visible
=
v
;}
void
set_draw_masses
(
bool
d
)
{
this
->
m_draw_masses
=
d
;}
void
set_textured
(
bool
t
)
{
this
->
m_textured
=
t
;}
void
set_texturable
(
bool
t
)
{
this
->
m_texturable
=
t
;}
...
...
sms/sms/src/display.cpp
View file @
2bef88f3
...
...
@@ -57,7 +57,8 @@ void Display::paintGL() {
glPopMatrix
();
}
for
(
auto
x
:
this
->
m_simulations
)
this
->
draw_simulation
(
x
);
if
(
x
->
visible
())
this
->
draw_simulation
(
x
);
this
->
update_fps
();
Rendering
::
draw_hud
(
this
->
m_fps
);
}
...
...
@@ -173,6 +174,12 @@ void Display::keyPressEvent(QKeyEvent * event) {
this
->
m_ctrl_key_down
=
true
;
break
;
}
if
(
'0'
<=
event
->
key
()
&&
event
->
key
()
<=
'9'
)
{
unsigned
int
i
=
event
->
key
()
-
'0'
;
if
(
i
<
this
->
m_simulations
.
size
())
this
->
m_simulations
[
i
]
->
set_visible
(
!
this
->
m_simulations
[
i
]
->
visible
());
}
}
void
Display
::
keyReleaseEvent
(
QKeyEvent
*
event
)
{
...
...
sms/sms/src/main.cpp
View file @
2bef88f3
...
...
@@ -29,6 +29,7 @@ int main(int argc, char ** argv) {
init_simulations
(
&
simulations
,
&
systems
);
for
(
auto
&
x
:
simulations
)
{
x
.
set_paused
(
true
);
x
.
set_visible
(
false
);
x
.
set_update_rate
(
UPDATE_RATE
);
}
Display
display
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment