Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
José Pardo Madera
/
pag_practicas_2025
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
af56ddc9
authored
Sep 11, 2025
by
José Pardo Madera
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Al desplazar la rueda del ratón cambia el color de fondo de la ventana
parent
2443606f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
main.cpp
main.cpp
View file @
af56ddc9
...
@@ -45,10 +45,33 @@ void mouse_button_callback(GLFWwindow *window, int button, int action, int mods)
...
@@ -45,10 +45,33 @@ void mouse_button_callback(GLFWwindow *window, int button, int action, int mods)
}
}
}
}
const
double
gradient_step
=
0.05
;
const
double
gradient_colors
[][
3
]
=
{{
0.6
,
0.6
,
0.6
},
{
1
,
0.65
,
0
}};
void
scroll_callback
(
GLFWwindow
*
window
,
double
xoffset
,
double
yoffset
)
{
void
scroll_callback
(
GLFWwindow
*
window
,
double
xoffset
,
double
yoffset
)
{
static
double
position_in_gradient
=
0
;
std
::
cout
<<
"Movida la rueda del raton "
std
::
cout
<<
"Movida la rueda del raton "
<<
xoffset
<<
" unidades en horizontal y "
<<
xoffset
<<
" unidades en horizontal y "
<<
yoffset
<<
" unidades en vertical"
<<
std
::
endl
;
<<
yoffset
<<
" unidades en vertical"
<<
std
::
endl
;
position_in_gradient
+=
yoffset
*
gradient_step
;
if
(
position_in_gradient
>
1
)
{
position_in_gradient
=
1
;
}
else
if
(
position_in_gradient
<
0
)
{
position_in_gradient
=
0
;
}
double
a
=
(
1
-
position_in_gradient
);
double
b
=
position_in_gradient
;
glClearColor
(
gradient_colors
[
0
][
0
]
*
a
+
gradient_colors
[
1
][
0
]
*
b
,
gradient_colors
[
0
][
1
]
*
a
+
gradient_colors
[
1
][
1
]
*
b
,
gradient_colors
[
0
][
2
]
*
a
+
gradient_colors
[
1
][
2
]
*
b
,
1.0
);
}
}
int
main
()
{
int
main
()
{
...
...
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