Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
José Pardo Madera
/
ProjectoMultimeda2025
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
387fd592
authored
Apr 03, 2025
by
José Pardo Madera
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Transición calendario visto -> calendario quitado
parent
3b7f7153
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
0 deletions
Executable
GestorPantallas.cpp
GestorPantallas.h
Historia.cpp
PantallaMundo.cpp
PantallaMundo.h
Executable
View file @
387fd592
No preview for this file type
GestorPantallas.cpp
View file @
387fd592
...
...
@@ -20,6 +20,13 @@ void Handle::removeAll(){
gestor
.
pantallas
.
clear
();
}
bool
Handle
::
pantallaMinimizada
()
{
Uint32
flags
=
SDL_GetWindowFlags
(
gestor
.
window
);
return
(
flags
&
SDL_WINDOW_MINIMIZED
)
!=
0
||
(
flags
&
SDL_WINDOW_HIDDEN
)
!=
0
;
}
void
cambiar_buffers
(
SDL_Renderer
*
renderer
)
{
SDL_RenderPresent
(
renderer
);
}
...
...
GestorPantallas.h
View file @
387fd592
...
...
@@ -26,6 +26,7 @@ class Handle{
void
removeAll
();
int
getTamX
(){
return
tamx
;}
int
getTamY
(){
return
tamy
;}
bool
pantallaMinimizada
();
};
...
...
Historia.cpp
View file @
387fd592
...
...
@@ -35,13 +35,29 @@ static void iniciarInicio() {
static
void
iniciarCalendarioVisto
(){
Sprite
sprPantalla
(
"assets/pantalla.png"
);
Hitbox
hitPantalla
(
300
,
200
,
500
,
-
1000000
);
auto
funcionPantalla
=
[](
Objeto
*
Pantalla
)
->
bool
{
play_video
(
"assets/MiedoCalendario2"
,
"es"
);
return
false
;
};
Objeto
Pantalla
(
sprPantalla
,
sprPantalla
,
sprPantalla
,
hitPantalla
,
0
,
100
,
400
,
400
,
normal
,
funcionPantalla
);
getPantalla1
()
->
anadirObjeto
(
Pantalla
);
auto
funcionComprobarPantallaMinimizada
=
[]
(
Handle
&
handle
)
->
bool
{
std
::
cout
<<
"Calling hook"
<<
std
::
endl
;
if
(
handle
.
pantallaMinimizada
())
{
historiaPrincipal
.
pasarDeEstadoA
(
Historia
::
Secuencia
::
CalendarioVisto
,
Historia
::
Secuencia
::
CalendarioQuitado
);
std
::
cout
<<
"Minimini"
<<
std
::
endl
;
return
true
;
}
std
::
cout
<<
"No minimini"
<<
std
::
endl
;
return
false
;
};
getPantalla1
()
->
anadirHook
(
funcionComprobarPantallaMinimizada
);
}
void
Historia
::
siguienteEstado
(
Secuencia
estado
){
...
...
PantallaMundo.cpp
View file @
387fd592
...
...
@@ -90,6 +90,12 @@ void PantallaMundo::manejarEntrada(Handle &handle) {
handle
.
removeAll
();
}
}
for
(
int
i
=
0
;
i
<
hooks
.
size
();
i
++
)
{
if
(
hooks
[
i
](
handle
))
{
hooks
.
erase
(
hooks
.
begin
()
+
i
);
i
--
;
}
}
}
void
PantallaMundo
::
renderizar
(
SDL_Renderer
*
renderer
,
int
tamx
,
int
tamy
)
{
...
...
@@ -124,3 +130,7 @@ void PantallaMundo::borrarElementos(){
void
PantallaMundo
::
anadirObjeto
(
Objeto
nuevo
){
objetos
.
push_back
(
nuevo
);
}
void
PantallaMundo
::
anadirHook
(
Hook
hook
)
{
hooks
.
push_back
(
hook
);
}
PantallaMundo.h
View file @
387fd592
...
...
@@ -31,6 +31,10 @@ class PantallaMundo : public Pantalla {
std
::
array
<
int
,
2
>
posicion_inicio_personaje
;
typedef
bool
(
*
Hook
)(
Handle
&
);
std
::
vector
<
Hook
>
hooks
;
protected
:
vector
<
Objeto
>
objetos
;
vector
<
Hitbox
>
colisionesActivas
;
...
...
@@ -57,4 +61,6 @@ public:
void
borrarElementos
();
void
anadirObjeto
(
Objeto
nuevo
);
void
anadirHook
(
Hook
);
};
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