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
77492d9f
authored
Mar 27, 2025
by
Jaime de la Chica Bergillos
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Hisotria aniadida
parent
a2a48f65
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
126 additions
and
7 deletions
ColeccionPantallas.cpp
ColeccionPantallas.h
Executable
Historia.cpp
Historia.h
PantallaInicio.cpp
PantallaMundo.cpp
PantallaMundo.h
PantallaPrincipal.cpp
makefile
ColeccionPantallas.cpp
View file @
77492d9f
#include "ColeccionPantallas.h"
#include "Personaje.h"
#include "PantallaPrincipal.h"
#include "PantallaPrincipal2.h"
#include <iostream>
#include "PantallaInicio.h"
Personaje
Agapito
;
...
...
@@ -14,5 +13,12 @@ vector<shared_ptr<Pantalla>> colPantallas={
make_shared
<
PantallaPrincipal
>
(
pant
),
make_shared
<
PantallaPrincipal2
>
(
pant2
),
make_shared
<
PantallaInicio
>
(
pant3
)
};
shared_ptr
<
PantallaPrincipal
>
getPantalla1
(){
return
std
::
dynamic_pointer_cast
<
PantallaPrincipal
>
(
colPantallas
[
0
]);
}
shared_ptr
<
PantallaPrincipal2
>
getPantalla2
(){
return
std
::
dynamic_pointer_cast
<
PantallaPrincipal2
>
(
colPantallas
[
1
]);
};
ColeccionPantallas.h
View file @
77492d9f
...
...
@@ -3,8 +3,13 @@
#include <memory>
#include "Personaje.h"
#include "GestorPantallas.h"
#include "PantallaPrincipal.h"
#include "PantallaPrincipal2.h"
using
namespace
std
;
extern
Personaje
Agapito
;
extern
vector
<
shared_ptr
<
Pantalla
>>
colPantallas
;
shared_ptr
<
PantallaPrincipal
>
getPantalla1
();
shared_ptr
<
PantallaPrincipal2
>
getPantalla2
();
Executable
View file @
77492d9f
No preview for this file type
Historia.cpp
0 → 100644
View file @
77492d9f
#include "Historia.h"
#include "ColeccionPantallas.h"
#include "PantallaMundo.h"
#include <iostream>
#include <memory>
#include "Objeto.h"
#include "Sprite.h"
#include "Hitbox.h"
void
Historia
::
limpiarEstado
(){
for
(
int
i
=
0
;
i
<
colPantallas
.
size
();
i
++
){
if
(
PantallaMundo
*
p
=
dynamic_cast
<
PantallaMundo
*>
(
colPantallas
[
i
].
get
())){
p
->
borrarElementos
();
}
}
};
static
void
iniciarInicio
()
{
Sprite
sprPlanta
(
"assets/planta.png"
);
Hitbox
hitPlanta
(
900
,
700
,
1200
,
-
1000000000
);
Objeto
Planta
(
sprPlanta
,
sprPlanta
,
sprPlanta
,
hitPlanta
,
1200
,
400
,
300
,
400
,
normal
);
getPantalla1
()
->
anadirObjeto
(
Planta
);
}
void
Historia
::
siguienteEstado
(
Secuencia
estado
){
switch
(
estado
){
case
Inicio
:
iniciarInicio
();
break
;
case
CalendarioVisto
:
break
;
case
CalendarioQuitado
:
break
;
case
PuzlePantallaResuelto
:
break
;
case
CajonAbierto
:
break
;
case
CajaAbierta
:
break
;
case
CarteraRecuperada
:
break
;
case
LlaveConseguida
:
break
;
case
PuedeSalir
:
break
;
}
}
void
Historia
::
pasarDeEstadoA
(
Secuencia
estadoAnterior
,
Secuencia
estadoPosterior
){
if
(
estadoAnterior
==
estadoActual
){
limpiarEstado
();
siguienteEstado
(
estadoPosterior
);
estadoActual
=
estadoPosterior
;
}
}
Historia
::
Historia
(){
siguienteEstado
(
estadoActual
);
}
Historia
historiaPrincipal
;
\ No newline at end of file
Historia.h
0 → 100644
View file @
77492d9f
#pragma once
class
Historia
{
enum
Secuencia
{
Inicio
,
CalendarioVisto
,
CalendarioQuitado
,
PuzlePantallaResuelto
,
CajonAbierto
,
CajaAbierta
,
CarteraRecuperada
,
LlaveConseguida
,
PuedeSalir
};
Secuencia
estadoActual
=
Inicio
;
void
limpiarEstado
();
void
siguienteEstado
(
Secuencia
estado
);
public
:
void
pasarDeEstadoA
(
Secuencia
estadoAnterior
,
Secuencia
estadoPosterior
);
Historia
();
};
extern
Historia
historiaPrincipal
;
\ No newline at end of file
PantallaInicio.cpp
View file @
77492d9f
...
...
@@ -2,6 +2,7 @@
#include "ColeccionPantallas.h"
#include "PantallaInicio.h"
#include "Video.h"
#include "Historia.h"
PantallaInicio
::
PantallaInicio
()
:
...
...
PantallaMundo.cpp
View file @
77492d9f
...
...
@@ -116,3 +116,11 @@ void PantallaMundo::init() {
Agapito
.
setX
(
posicion_inicio_personaje
[
0
]);
Agapito
.
setZ
(
posicion_inicio_personaje
[
1
]);
}
void
PantallaMundo
::
borrarElementos
(){
objetos
.
clear
();
}
void
PantallaMundo
::
anadirObjeto
(
Objeto
nuevo
){
objetos
.
push_back
(
nuevo
);
}
\ No newline at end of file
PantallaMundo.h
View file @
77492d9f
...
...
@@ -51,4 +51,8 @@ public:
bool
transparente
()
override
{
return
false
;
};
void
borrarElementos
();
void
anadirObjeto
(
Objeto
nuevo
);
};
PantallaPrincipal.cpp
View file @
77492d9f
...
...
@@ -12,16 +12,12 @@ PantallaPrincipal::PantallaPrincipal() :
{
300
,
1000
}
)
{
Sprite
sprPlanta
(
"assets/planta.png"
);
Hitbox
hitPlanta
(
900
,
700
,
1200
,
-
1000000000
);
Objeto
Planta
(
sprPlanta
,
sprPlanta
,
sprPlanta
,
hitPlanta
,
1200
,
400
,
300
,
400
,
normal
);
Hitbox
hitFondo
(
1000000
,
-
10000000
,
300
,
0
);
//Hitbox hitCama(1000, 0, 1200,-10000000);
Hitbox
hitDer
(
1000
,
800
,
10000000
,
-
10000000
);
Hitbox
hitIzq
(
300
,
0
,
10000000
,
-
10000000
);
objetos
.
push_back
(
Planta
);
colisionesActivas
.
push_back
(
hitFondo
);
colisionesActivas
.
push_back
(
hitIzq
);
...
...
makefile
View file @
77492d9f
CC
=
g++
CodeFiles
=
main.cpp Personaje.cpp Sprite.cpp Objeto.cpp Hitbox.cpp Texto.cpp GestorPantallas.cpp PantallaPrincipal.cpp PantallaPrincipal2.cpp ColeccionPantallas.cpp Video.cpp PantallaInicio.cpp PantallaMundo.cpp Sonido.cpp
CodeFiles
=
main.cpp Personaje.cpp Sprite.cpp Objeto.cpp Hitbox.cpp Texto.cpp GestorPantallas.cpp PantallaPrincipal.cpp PantallaPrincipal2.cpp ColeccionPantallas.cpp Video.cpp PantallaInicio.cpp PantallaMundo.cpp Sonido.cpp
Historia.cpp
bin
=
Executable
...
...
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