58 Commits

Author SHA1 Message Date
8c293a6b7f Añadido coffee_crisis.icns 2022-11-11 21:38:09 +01:00
a3599d2d3d Actualizado Makefile para crear releases. Ejecutable pasa a estar en la raíz 2022-11-11 18:55:28 +01:00
7ab81eaf29 Actualizado animatedsprite.cpp 2022-10-20 09:18:18 +02:00
4f1a596e46 Arreglos y limpieza de código 2022-10-19 09:53:23 +02:00
b07baa4669 Movidos los archivos de clases comunes a la carpeta common 2022-10-19 09:38:38 +02:00
cf357560b2 Pequeños cambios en las librerias comunes 2022-10-17 19:53:19 +02:00
3d52c45f5c Actualizado Makefile 2022-10-14 10:55:27 +02:00
3276027044 Subido el numero de versión 2022-10-14 10:46:18 +02:00
8041595976 Añadido contador al quitar el menu de pausa del juego 2022-10-14 10:44:50 +02:00
fa53c1b01a Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/coffee_crisis 2022-10-14 09:56:22 +02:00
20b362160e Arreglado el fallo en el sprite de muerte del arounder, tenia pantalón corto 2022-10-14 09:56:04 +02:00
5cabbfc487 Eliminar 'data/config/config.bin' 2022-10-14 09:53:38 +02:00
9f5e001c70 Eliminar 'data/config/score.bin' 2022-10-14 09:53:27 +02:00
112c3afc76 Solucionado el problema de no cerrar el juego durante la demo o las instrucciones 2022-10-14 09:52:15 +02:00
f4215384fe Actualizado Makefile 2022-10-13 10:46:40 +02:00
7796cee51a Actualizado Makefile 2022-10-13 10:41:22 +02:00
f83154c062 Listo para lanzamiento 2022-10-09 14:23:45 +02:00
9e73f7f97d Eliminado todo.txt 2022-10-09 13:02:18 +02:00
742ca02573 Revisados varios pequeños bugs 2022-10-09 12:58:23 +02:00
d77757853d Quitadas las cabezas rojas de powerup y acelerada la animación 2022-10-09 12:01:28 +02:00
ca7ae7418e Arreglado el modo 2P 2022-10-09 11:46:11 +02:00
f880bb7d74 Modificado el ritmo de las numbes i el cambio de color del cielo 2022-10-08 00:14:14 +02:00
9784b5517a Trabajando el menu de game over y el player_fire 2022-10-07 22:44:57 +02:00
88041eba23 Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/coffee_crisis 2022-10-07 18:30:44 +02:00
698721ae03 Trabajando en la pantalla de game over 2022-10-07 18:30:41 +02:00
c7109a46cd Pequeños ajustes y detalles 2022-10-07 13:56:51 +02:00
bb20522172 Arreglados dos fallos del menu 2022-10-06 19:06:39 +02:00
bebc016f3c Las instrucciones ya usan las nuevas texturas de objetos 2022-10-06 13:46:41 +02:00
56c1a1d7f3 Arreglada la animacion de morir. Ya no se usan smartsprites 2022-10-06 13:13:27 +02:00
50d2a5d1c7 Ya va pasando del titulo a las instrucciones, a la demo, etc.. 2022-10-06 10:31:48 +02:00
83103ddfea Arreglados los cambios de lenguaje 2022-10-06 09:39:39 +02:00
f4f7bb52b3 Actualizado makefile 2022-10-06 08:01:23 +02:00
b861f33867 Actualizado Makefile 2022-10-06 07:16:58 +02:00
2576d62002 Optimizados algunos png 2022-10-05 22:37:37 +02:00
02312e1342 Ya precarga todos los recursos del juego 2022-10-05 20:48:55 +02:00
83a34d61bf Trabajando en tener todos los recursos cargados previamente 2022-10-05 19:17:45 +02:00
8076d8a765 Trabajando en la cache de los recursos de los items 2022-10-05 14:02:50 +02:00
901757b9b2 Actualizado .gitignore 2022-10-05 13:02:57 +02:00
f5ba15a4af Renombradas las variables de game.cpp 2022-10-05 12:30:45 +02:00
6eda55cdae Redistribución de los graficos de fondo en varios png 2022-10-05 10:22:38 +02:00
18c36ad3fb Ya se puede continuar al morir 2022-10-04 21:40:33 +02:00
a5adf1ba01 La maquina de cafe no toca el suelo 2022-10-04 19:11:31 +02:00
d5ab7cbe2a Renombradas las variablesde balloon.cpp 2022-10-04 18:27:49 +02:00
adad58ccfa Renombradas las variables de bullet.cpp 2022-10-04 18:11:42 +02:00
33b7c6082e Añadido todo.txt 2022-10-04 17:56:38 +02:00
5fd1ffa865 Retocado el borde de la powerball y quitados los efectos de rebote 2022-10-04 16:58:10 +02:00
9f93de1d06 Resuelto un bug en la colision de balas con globos 2022-10-04 14:16:22 +02:00
c3fd348a61 Optimizada la carga de las animaciones de los globos. Cacheada 2022-10-04 12:13:47 +02:00
ddb70c8c85 Fallo parcial en la carga de animaciones desde streams 2022-10-04 07:09:28 +02:00
95d6396dfa Resueltos los dos últimos problemas 2022-10-03 17:14:33 +02:00
99b61c4b2d Los items ya parecen funcionar. revisar power ball y los puntos al coger items 2022-10-03 14:11:13 +02:00
91b868572e trabajando los items 2022-10-03 11:45:09 +02:00
9c35fadd55 Trabajando en los globos 2022-10-03 04:15:04 +02:00
80ca04fd64 Balas funcionales 2022-10-03 03:02:46 +02:00
4ac7496eff Trabajando en la sección de juego y el jugador 2022-10-02 20:23:06 +02:00
b6225d2d2f Trabajando en el jugador 2022-09-29 20:15:41 +02:00
a148c38ef8 Modificados ficheros .ani del jugador 2022-09-29 19:07:39 +02:00
902d901698 Trabajando en el jugador 2022-09-29 18:17:30 +02:00
122 changed files with 6231 additions and 4632 deletions

14
.gitignore vendored
View File

@@ -1,5 +1,13 @@
.vscode .vscode
*config.txt
*.DS_Store *.DS_Store
bin thumbs.db
data/config.bin *.exe
data/score.bin *_macos
*_linux
*.dmg
*.tar.gz
*.zip
*.app
*config.bin
*score.bin

123
Makefile
View File

@@ -1,13 +1,118 @@
executable = coffee_crisis executable = coffee_crisis
source = source/*.cpp source/common/*.cpp
appName = Coffee Crisis
releaseFolder = cc_release
version = v2.1b
windows:
@echo off
powershell if (Test-Path data\config\config.bin) {Remove-Item data\config\config.bin -Recurse -Force}
powershell if (Test-Path data\config\score.bin) {Remove-Item data\config\score.bin -Recurse -Force}
g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o $(executable).exe
strip -s -R .comment -R .gnu.version $(executable).exe --strip-unneeded
windows_release:
@echo off
# Remove data
powershell if (Test-Path data\config\config.bin) {Remove-Item data\config\config.bin -Recurse -Force}
powershell if (Test-Path data\config\score.bin) {Remove-Item data\config\score.bin -Recurse -Force}
powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force}
# Create folders
powershell if (-not (Test-Path $(releaseFolder))) {New-Item $(releaseFolder) -ItemType Directory}
# Copy data
powershell Copy-Item -Path "data" -Destination "$(releaseFolder)" -recurse -Force
powershell Copy-Item "LICENSE" -Destination "$(releaseFolder)"
powershell Copy-Item "README.md" -Destination "$(releaseFolder)"
powershell Copy-Item "release/SDL2.dll" -Destination "$(releaseFolder)"
# Build
g++ $(source) -D RELEASE -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(releaseFolder)/$(executable).exe"
strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable).exe" --strip-unneeded
# Create ZIP
powershell if (Test-Path $(executable)_win_$(version).zip) {Remove-Item $(executable)_win_$(version).zip}
powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(executable)_win_$(version).zip
# Remove folder
powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force}
macos: macos:
mkdir -p bin rm -f data/config/config.bin
g++ -std=c++11 -Wall -O2 source/*.cpp -o bin/$(executable)_macos -lSDL2 rm -f data/config/score.bin
clang++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o $(executable)_macos -target arm64-apple-macos11
macos_release:
# Remove data
rm -f data/config/config.bin
rm -f data/config/score.bin
rm -rdf "$(releaseFolder)"
# Create folders
mkdir -p "$(releaseFolder)/$(appName).app/Contents/Frameworks"
mkdir -p "$(releaseFolder)/$(appName).app/Contents/MacOS"
mkdir -p "$(releaseFolder)/$(appName).app/Contents/Resources"
mkdir -p Frameworks
# Copy folders
cp -R data "$(releaseFolder)/$(appName).app/Contents/Resources"
cp -R /Library/Frameworks/SDL2.framework "$(releaseFolder)/$(appName).app/Contents/Frameworks"
cp -R /Library/Frameworks/SDL2.framework Frameworks
# Copy files
cp release/*.icns "$(releaseFolder)/$(appName).app/Contents/Resources"
cp release/Info.plist "$(releaseFolder)/$(appName).app/Contents"
# Build INTEL
clang++ $(source) -D RELEASE -D MACOS_BUNDLE -std=c++11 -Wall -Os -framework SDL2 -F ./Frameworks -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12
# Build INTEL DMG
rm -f "$(executable)_macos_intel_$(version).dmg"
hdiutil create tmp.dmg -ov -volname "$(appName)" -fs HFS+ -srcfolder "$(releaseFolder)"
hdiutil convert tmp.dmg -format UDZO -o "$(executable)_macos_intel_$(version).dmg"
rm tmp.dmg
# Build APPLE SILICON
clang++ $(source) -D RELEASE -D MACOS_BUNDLE -std=c++11 -Wall -Os -framework SDL2 -F ./Frameworks -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11
# Build APPLE SILICON DMG
rm -f "$(executable)_macos_apple_silicon_$(version).dmg"
hdiutil create tmp.dmg -ov -volname "$(appName)" -fs HFS+ -srcfolder "$(releaseFolder)"
hdiutil convert tmp.dmg -format UDZO -o "$(executable)_macos_apple_silicon_$(version).dmg"
rm tmp.dmg
# Remove data
rm -rdf Frameworks
rm -rdf "$(releaseFolder)"
linux: linux:
mkdir -p bin rm -f data/config/config.bin
g++ source/*.cpp -std=c++11 -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o bin/$(executable)_linux rm -f data/config/score.bin
strip -s -R .comment -R .gnu.version bin/$(executable)_linux --strip-unneeded g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(executable)_linux
opendingux: strip -s -R .comment -R .gnu.version $(executable)_linux --strip-unneeded
mkdir -p bin
/opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc -D GCWZERO -O2 -std=c++11 -I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL2 -D_GNU_SOURCE=1 -D_REENTRANT -lSDL2 -lSDL2_mixer -lstdc++ source/*.cpp -o bin/$(executable)_opendingux linux_release:
/opt/gcw0-toolchain/usr/bin/mksquashfs ./default.gcw0.desktop ./icon.png ./bin ./data ./media coffee_crisis.opk -all-root -noappend -no-exports -no-xattrs # Remove data
rm -f data/config/config.bin
rm -f data/config/score.bin
rm -rdf $(releaseFolder)
# Create folders
mkdir -p $(releaseFolder)
# Copy data
cp -R data $(releaseFolder)
cp LICENSE $(releaseFolder)
cp README.md $(releaseFolder)
# Build
g++ $(source) -D RELEASE -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(releaseFolder)/$(executable)
strip -s -R .comment -R .gnu.version $(releaseFolder)/$(executable) --strip-unneeded
# Pack files
cd $(releaseFolder) && tar -czvf ../$(executable)_linux_$(version).tar.gz *
# Remove data
rm -rdf $(releaseFolder)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

37
data/gfx/balloon1.ani Normal file
View File

@@ -0,0 +1,37 @@
frameWidth=8
frameHeight=8
[animation]
name=orange
speed=10
loop=0
frames=0,1,2,3,4,5,6,7,8,9
[/animation]
[animation]
name=blue
speed=20
loop=0
frames=12,13,14,15,16,17,18,19,20,21
[/animation]
[animation]
name=green
speed=10
loop=0
frames=24,25,26,27,28,29,30,31,32,33
[/animation]
[animation]
name=red
speed=20
loop=0
frames=36,37,38,39,40,41,42,43,44,45
[/animation]
[animation]
name=pop
speed=5
loop=-1
frames=48,49,50,51,52,53,54,55,56,57,58,59
[/animation]

BIN
data/gfx/balloon1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

37
data/gfx/balloon2.ani Normal file
View File

@@ -0,0 +1,37 @@
frameWidth=13
frameHeight=13
[animation]
name=orange
speed=10
loop=0
frames=0,1,2,3,4,5,6,7,8,9
[/animation]
[animation]
name=blue
speed=20
loop=0
frames=12,13,14,15,16,17,18,19,20,21
[/animation]
[animation]
name=green
speed=10
loop=0
frames=24,25,26,27,28,29,30,31,32,33
[/animation]
[animation]
name=red
speed=20
loop=0
frames=36,37,38,39,40,41,42,43,44,45
[/animation]
[animation]
name=pop
speed=5
loop=-1
frames=48,49,50,51,52,53,54,55,56,57,58,59
[/animation]

BIN
data/gfx/balloon2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

37
data/gfx/balloon3.ani Normal file
View File

@@ -0,0 +1,37 @@
frameWidth=21
frameHeight=21
[animation]
name=orange
speed=10
loop=0
frames=0,1,2,3,4,5,6,7,8,9
[/animation]
[animation]
name=blue
speed=20
loop=0
frames=12,13,14,15,16,17,18,19,20,21
[/animation]
[animation]
name=green
speed=10
loop=0
frames=24,25,26,27,28,29,30,31,32,33
[/animation]
[animation]
name=red
speed=20
loop=0
frames=36,37,38,39,40,41,42,43,44,45
[/animation]
[animation]
name=pop
speed=5
loop=-1
frames=48,49,50,51,52,53,54,55,56,57,58,59
[/animation]

BIN
data/gfx/balloon3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

44
data/gfx/balloon4.ani Normal file
View File

@@ -0,0 +1,44 @@
frameWidth=37
frameHeight=37
[animation]
name=orange
speed=10
loop=0
frames=0,1,2,3,4,5,6,7,8,9
[/animation]
[animation]
name=blue
speed=20
loop=0
frames=12,13,14,15,16,17,18,19,20,21
[/animation]
[animation]
name=green
speed=10
loop=0
frames=24,25,26,27,28,29,30,31,32,33
[/animation]
[animation]
name=red
speed=20
loop=0
frames=36,37,38,39,40,41,42,43,44,45
[/animation]
[animation]
name=powerball
speed=10
loop=0
frames=10
[/animation]
[animation]
name=pop
speed=5
loop=-1
frames=48,49,50,51,52,53,54,55,56,57,58,59
[/animation]

BIN
data/gfx/balloon4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
data/gfx/game_buildings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
data/gfx/game_clouds.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

BIN
data/gfx/game_grass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 795 B

After

Width:  |  Height:  |  Size: 438 B

View File

@@ -3,7 +3,7 @@ frameHeight=16
[animation] [animation]
name=default name=default
speed=8 speed=10
loop=-1 loop=0
frames=0,1,2,3,4,5,6 frames=0,1
[/animation] [/animation]

BIN
data/gfx/item_clock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

View File

@@ -3,7 +3,7 @@ frameHeight=16
[animation] [animation]
name=default name=default
speed=8 speed=10
loop=-1 loop=0
frames=0,1,2,3,4,5,6 frames=0,1
[/animation] [/animation]

BIN
data/gfx/item_coffee.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

View File

@@ -0,0 +1,9 @@
frameWidth=23
frameHeight=29
[animation]
name=default
speed=10
loop=0
frames=0,1,2,3
[/animation]

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

View File

@@ -3,7 +3,7 @@ frameHeight=16
[animation] [animation]
name=default name=default
speed=8 speed=10
loop=-1 loop=0
frames=0,1,2,3,4,5,6 frames=0,1
[/animation] [/animation]

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

View File

@@ -3,7 +3,7 @@ frameHeight=16
[animation] [animation]
name=default name=default
speed=8 speed=10
loop=-1 loop=0
frames=0,1,2,3,4,5,6 frames=0,1
[/animation] [/animation]

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

View File

@@ -0,0 +1,9 @@
frameWidth=16
frameHeight=16
[animation]
name=default
speed=10
loop=0
frames=0,1
[/animation]

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
data/gfx/menu_game_over.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 529 B

176
data/gfx/player_body.ani Normal file
View File

@@ -0,0 +1,176 @@
frameWidth=24
frameHeight=24
[animation]
name=walk
speed=5
loop=0
frames=0,1,2,3
[/animation]
[animation]
name=stand
speed=10
loop=0
frames=4,5,6,7
[/animation]
[animation]
name=walk_1C
speed=5
loop=0
frames=8,9,10,11
[/animation]
[animation]
name=stand_1C
speed=10
loop=0
frames=12,13,14,15
[/animation]
[animation]
name=walk_2C
speed=5
loop=0
frames=16,17,18,19
[/animation]
[animation]
name=stand_2C
speed=10
loop=0
frames=20,21,22,23
[/animation]
[animation]
name=sideshoot
speed=5
loop=0
frames=24,25,26,27
[/animation]
[animation]
name=centershoot
speed=5
loop=0
frames=28,29,30,31
[/animation]
[animation]
name=sideshoot_1C
speed=5
loop=0
frames=32,33,34,35
[/animation]
[animation]
name=centershoot_1C
speed=5
loop=0
frames=36,37,38,39
[/animation]
[animation]
name=sideshoot_2C
speed=5
loop=0
frames=40,41,42,43
[/animation]
[animation]
name=centershoot_2C
speed=5
loop=0
frames=44,45,46,47
[/animation]
[animation]
name=walk_pwr
speed=3
loop=0
frames=0,1,2,3
[/animation]
[animation]
name=stand_pwr
speed=5
loop=0
frames=4,5,6,7
[/animation]
[animation]
name=walk_1C_pwr
speed=3
loop=0
frames=8,9,10,11
[/animation]
[animation]
name=stand_1C_pwr
speed=5
loop=0
frames=12,13,14,15
[/animation]
[animation]
name=walk_2C_pwr
speed=3
loop=0
frames=16,17,18,19
[/animation]
[animation]
name=stand_2C_pwr
speed=5
loop=0
frames=20,21,22,23
[/animation]
[animation]
name=sideshoot_pwr
speed=2
loop=0
frames=24,25,26,27
[/animation]
[animation]
name=centershoot_pwr
speed=2
loop=0
frames=28,29,30,31
[/animation]
[animation]
name=sideshoot_1C_pwr
speed=2
loop=0
frames=32,33,34,35
[/animation]
[animation]
name=centershoot_1C_pwr
speed=2
loop=0
frames=36,37,38,39
[/animation]
[animation]
name=sideshoot_2C_pwr
speed=2
loop=0
frames=40,41,42,43
[/animation]
[animation]
name=centershoot_2C_pwr
speed=2
loop=0
frames=44,45,46,47
[/animation]

View File

@@ -0,0 +1,9 @@
frameWidth=24
frameHeight=24
[animation]
name=default
speed=5
loop=0
frames=0,1,2,3
[/animation]

9
data/gfx/player_fire.ani Normal file
View File

@@ -0,0 +1,9 @@
frameWidth=28
frameHeight=32
[animation]
name=default
speed=5
loop=0
frames=0,1,2,3
[/animation]

114
data/gfx/player_head.ani Normal file
View File

@@ -0,0 +1,114 @@
frameWidth=24
frameHeight=24
[animation]
name=walk
speed=5
loop=0
frames=0,1,2,3
[/animation]
[animation]
name=stand
speed=10
loop=0
frames=4,5,6,7
[/animation]
[animation]
name=walk_1C
speed=5
loop=0
frames=8,9,10,11
[/animation]
[animation]
name=stand_1C
speed=10
loop=0
frames=12,13,14,15
[/animation]
[animation]
name=walk_pwr
speed=5
loop=0
frames=16,17,18,19
[/animation]
[animation]
name=stand_pwr
speed=10
loop=0
frames=20,21,22,23
[/animation]
[animation]
name=walk_1C_pwr
speed=5
loop=0
frames=24,25,26,27
[/animation]
[animation]
name=stand_1C_pwr
speed=10
loop=0
frames=28,29,30,31
[/animation]
[animation]
name=sideshoot
speed=5
loop=0
frames=16,17,18,19
[/animation]
[animation]
name=centershoot
speed=5
loop=0
frames=20,21,22,23
[/animation]
[animation]
name=sideshoot_1C
speed=5
loop=0
frames=24,25,26,27
[/animation]
[animation]
name=centershoot_1C
speed=5
loop=0
frames=28,29,30,31
[/animation]
[animation]
name=sideshoot_pwr
speed=2
loop=0
frames=16,17,18,19
[/animation]
[animation]
name=centershoot_pwr
speed=2
loop=0
frames=20,21,22,23
[/animation]
[animation]
name=sideshoot_1C_pwr
speed=2
loop=0
frames=24,25,26,27
[/animation]
[animation]
name=centershoot_1C_pwr
speed=2
loop=0
frames=28,29,30,31
[/animation]

16
data/gfx/player_legs.ani Normal file
View File

@@ -0,0 +1,16 @@
frameWidth=24
frameHeight=24
[animation]
name=walk
speed=5
loop=0
frames=0,1,2,3
[/animation]
[animation]
name=stand
speed=10
loop=0
frames=4,5,6,7
[/animation]

View File

@@ -1,160 +1,239 @@
## 0 - MENU DEL TITULO ## 0 - MENU DEL TITULO
JUGAR JUGAR
## 1 - MENU DEL TITULO ## 1 - MENU DEL TITULO
OPCIONS OPCIONS
## 2 - MENU DEL TITULO ## 2 - MENU DEL TITULO
INSTRUCCIONS INSTRUCCIONS
## 3 - MENU DEL TITULO ## 3 - MENU DEL TITULO
EIXIR EIXIR
## 4 - MENU DE OPCIONES ## 4 - MENU DE OPCIONES
FINESTRA FINESTRA
## 5 - MENU DE OPCIONES ## 5 - MENU DE OPCIONES
PANTALLA COMPLETA PANTALLA COMPLETA
## 6 - MENU DE OPCIONES ## 6 - MENU DE OPCIONES
PANTALLA COMPLETA FALSA PANTALLA COMPLETA FALSA
## 7 - MENU DE OPCIONES ## 7 - MENU DE OPCIONES
TAMANY DE FINESTRA TAMANY DE FINESTRA
## 8 - MENU DE OPCIONES ## 8 - MENU DE OPCIONES
IDIOMA IDIOMA
## 9 - MENU DE OPCIONES ## 9 - MENU DE OPCIONES
[ ACEPTAR ] [ ACEPTAR ]
## 10 - MENU DE OPCIONES ## 10 - MENU DE OPCIONES
[ CANCELAR ] [ CANCELAR ]
## 11 - INSTRUCCIONES ## 11 - INSTRUCCIONES
OBJECTIU OBJECTIU
## 12 - INSTRUCCIONES ## 12 - INSTRUCCIONES
HAS D'EXPLOTAR HAS D'EXPLOTAR
## 13 - INSTRUCCIONES ## 13 - INSTRUCCIONES
TANTS GLOBUS COM PUGUES TANTS GLOBUS COM PUGUES
## 14 - INSTRUCCIONES ## 14 - INSTRUCCIONES
LA DIFICULTAT AUGMENTA LA DIFICULTAT AUGMENTA
## 15 - INSTRUCCIONES ## 15 - INSTRUCCIONES
A MESURA QUE VAS PUNTUANT A MESURA QUE VAS PUNTUANT
## 16 - INSTRUCCIONES ## 16 - INSTRUCCIONES
OBJECTES OBJECTES
## 17 - INSTRUCCIONES ## 17 - INSTRUCCIONES
1.000 PUNTS 1.000 PUNTS
## 18 - INSTRUCCIONES ## 18 - INSTRUCCIONES
2.500 PUNTS 2.500 PUNTS
## 19 - INSTRUCCIONES ## 19 - INSTRUCCIONES
5.000 PUNTS 5.000 PUNTS
## 20 - INSTRUCCIONES ## 20 - INSTRUCCIONES
PARA EL TEMPS PARA EL TEMPS
## 21 - INSTRUCCIONES ## 21 - INSTRUCCIONES
VIDA EXTRA VIDA EXTRA
## 22 - INSTRUCCIONES ## 22 - INSTRUCCIONES
PREM UNA TECLA PER A TORNAR PREM UNA TECLA PER A TORNAR
## 23 - TITULO ## 23 - TITULO
PREM QUALSEVOL TECLA PREM QUALSEVOL TECLA
## 24 - MENU SELECCION DE IDIOMA ## 24 - MENU SELECCION DE IDIOMA
ESPA{OL (ESPANYOL) ESPA{OL (ESPANYOL)
## 25 - MENU SELECCION DE IDIOMA ## 25 - MENU SELECCION DE IDIOMA
BALOONCIA BALOONCIA
## 26 - MENU SELECCION DE IDIOMA ## 26 - MENU SELECCION DE IDIOMA
ENGLISH (ANGLES) ENGLISH (ANGLES)
## 27 - INTRO ## 27 - INTRO
Un dia qualsevol de l'any 2000 Un dia qualsevol de l'any 2000
## 28 - INTRO ## 28 - INTRO
Tot esta tranquil a la UPV Tot esta tranquil a la UPV
## 29 - INTRO ## 29 - INTRO
Fins que un desaprensiu... Fins que un desaprensiu...
## 30 - INTRO ## 30 - INTRO
HEY! ME ANE A FERME UN CORTAET... HEY! ME ANE A FERME UN CORTAET...
## 31 - INTRO ## 31 - INTRO
UAAAAAAAAAAAAA!!! UAAAAAAAAAAAAA!!!
## 32 - INTRO ## 32 - INTRO
Espera un moment... Espera un moment...
## 33 - INTRO ## 33 - INTRO
Si resulta que no tinc solt! Si resulta que no tinc solt!
## 34 - INTRO ## 34 - INTRO
MERDA DE MAQUINA! MERDA DE MAQUINA!
## 35 - INTRO ## 35 - INTRO
Blop... blop... blop... Blop... blop... blop...
## 36 - TEXTOS DEL JUEGO ## 36 - TEXTOS DEL JUEGO
Temps detes: Temps detes:
## 37 - TEXTOS DEL JUEGO ## 37 - TEXTOS DEL JUEGO
D E M O D E M O
## 38 - TEXTOS DEL JUEGO ## 38 - TEXTOS DEL JUEGO
fases mes! fases mes!
## 39 -
## 40 - ## 39 - MENU SELECCION DE JUGADOR
Selecciona personatge
## 41 - ## 40 - MENU SELECCION DE JUGADOR
Enrere
## 41 - MENU DE PAUSA
Menu de pausa
## 42 - ## 42 -
-
## 43 - PANTALLA DE GAME OVER ## 43 - PANTALLA DE GAME OVER
FI DEL JOC FI DEL JOC
## 44 - PANTALLA DE GAME OVER ## 44 - PANTALLA DE GAME OVER
ELS TEUS PUNTS: ELS TEUS PUNTS:
## 45 - PANTALLA DE GAME OVER ## 45 - PANTALLA DE GAME OVER
CONTINUAR? CONTINUAR?
## 46 - MENU DE PAUSA ## 46 - MENU DE PAUSA
CONTINUAR CONTINUAR
## 47 - MENU DE PAUSA ## 47 - MENU DE PAUSA
EIXIR DEL JOC EIXIR DEL JOC
## 48 - MENU GAME OVER ## 48 - MENU GAME OVER
SI SI
## 49 - MENU GAME OVER ## 49 - MENU GAME OVER
NO NO
## 50 - TEXTO DE COMPLETAR EL JUEGO ## 50 - TEXTO DE COMPLETAR EL JUEGO
Felicitats!! Felicitats!!
## 51 - MENU DEL TITULO ## 51 - MENU DEL TITULO
1 JUGADOR 1 JUGADOR
## 52 - MENU DEL TITULO ## 52 - MENU DEL TITULO
2 JUGADORS 2 JUGADORS
## 53 MARCADOR ## 53 MARCADOR
jugador 1 jugador 1
## 54 MARCADOR ## 54 MARCADOR
jugador 2 jugador 2
## 55 MARCADOR ## 55 MARCADOR
mult mult
## 56 MARCADOR ## 56 MARCADOR
max. puntuacio max. puntuacio
## 57 MARCADOR ## 57 MARCADOR
fase fase
## 58 - MENU DE OPCIONES ## 58 - MENU DE OPCIONES
MODE DE VISUALITZACIO MODE DE VISUALITZACIO
## 59 - MENU DE OPCIONES ## 59 - MENU DE OPCIONES
DIFICULTAT DIFICULTAT
## 60 - MENU DE OPCIONES ## 60 - MENU DE OPCIONES
FILTRE FILTRE
## 61 - MENU DE OPCIONES ## 61 - MENU DE OPCIONES
SINC. VERTICAL SINC. VERTICAL
## 62 - MENU DE OPCIONES ## 62 - MENU DE OPCIONES
CONTROLS DEL JUGADOR 1 CONTROLS DEL JUGADOR 1
## 63 - MENU DE OPCIONES ## 63 - MENU DE OPCIONES
CONTROLS DEL JUGADOR 2 CONTROLS DEL JUGADOR 2
## 64 - ## 64 -
-
## 65 - ## 65 -
-
## 66 - MENU DE OPCIONES ## 66 - MENU DE OPCIONES
FACIL FACIL
## 67 - MENU DE OPCIONES ## 67 - MENU DE OPCIONES
NORMAL NORMAL
## 68 - MENU DE OPCIONES ## 68 - MENU DE OPCIONES
DIFICIL DIFICIL
## 69 - MENU DE OPCIONES ## 69 - MENU DE OPCIONES
TECLAT TECLAT
## 70 - MENU DE OPCIONES ## 70 - MENU DE OPCIONES
MANDO MANDO
## 71 - MENU DE OPCIONES ## 71 - MENU DE OPCIONES
LINEAL LINEAL
## 72 - MENU DE OPCIONES ## 72 - MENU DE OPCIONES
NEAREST NEAREST
## 73 - MENU DE OPCIONES ## 73 - MENU DE OPCIONES
ACTIVADA ACTIVADA
## 74 - MENU DE OPCIONES ## 74 - MENU DE OPCIONES
DESACTIVADA DESACTIVADA
## 75 - JUEGO ## 75 - JUEGO
Endavant! Endavant!
## 76 - JUEGO ## 76 - JUEGO
1.000.000 de punts! 1.000.000 de punts!
## 77 - PANTALLA DE GAME OVER ## 77 - PANTALLA DE GAME OVER
PUNTS J1: PUNTS J1:
## 78 - PANTALLA DE GAME OVER ## 78 - PANTALLA DE GAME OVER
PUNTS J2: PUNTS J2:
## 79 - TEXTOS DEL JUEGO ## 79 - TEXTOS DEL JUEGO
Ultima fase! Ultima fase!

View File

@@ -1,160 +1,239 @@
## 0 - MENU DEL TITULO ## 0 - MENU DEL TITULO
PLAY PLAY
## 1 - MENU DEL TITULO ## 1 - MENU DEL TITULO
OPTIONS OPTIONS
## 2 - MENU DEL TITULO ## 2 - MENU DEL TITULO
HOW TO PLAY HOW TO PLAY
## 3 - MENU DEL TITULO ## 3 - MENU DEL TITULO
QUIT QUIT
## 4 - MENU DE OPCIONES ## 4 - MENU DE OPCIONES
WINDOW WINDOW
## 5 - MENU DE OPCIONES ## 5 - MENU DE OPCIONES
FULLSCREEN FULLSCREEN
## 6 - MENU DE OPCIONES ## 6 - MENU DE OPCIONES
FAKE FULLSCREEN FAKE FULLSCREEN
## 7 - MENU DE OPCIONES ## 7 - MENU DE OPCIONES
WINDOW SIZE WINDOW SIZE
## 8 - MENU DE OPCIONES ## 8 - MENU DE OPCIONES
LANGUAGE LANGUAGE
## 9 - MENU DE OPCIONES ## 9 - MENU DE OPCIONES
[ ACCEPT ] [ ACCEPT ]
## 10 - MENU DE OPCIONES ## 10 - MENU DE OPCIONES
[ CANCEL ] [ CANCEL ]
## 11 - INSTRUCCIONES ## 11 - INSTRUCCIONES
OBJECTIVE OBJECTIVE
## 12 - INSTRUCCIONES ## 12 - INSTRUCCIONES
YOU HAVE TO POP AS MANY YOU HAVE TO POP AS MANY
## 13 - INSTRUCCIONES ## 13 - INSTRUCCIONES
BALLOONS AS YOU CAN BALLOONS AS YOU CAN
## 14 - INSTRUCCIONES ## 14 - INSTRUCCIONES
DIFFICULTY WILL BE INCREASED DIFFICULTY WILL BE INCREASED
## 15 - INSTRUCCIONES ## 15 - INSTRUCCIONES
AS YOU SCORE POINTS AS YOU SCORE POINTS
## 16 - INSTRUCCIONES ## 16 - INSTRUCCIONES
ITEMS ITEMS
## 17 - INSTRUCCIONES ## 17 - INSTRUCCIONES
1.000 POINTS 1.000 POINTS
## 18 - INSTRUCCIONES ## 18 - INSTRUCCIONES
2.500 POINTS 2.500 POINTS
## 19 - INSTRUCCIONES ## 19 - INSTRUCCIONES
5.000 POINTS 5.000 POINTS
## 20 - INSTRUCCIONES ## 20 - INSTRUCCIONES
TIME STOPPER TIME STOPPER
## 21 - INSTRUCCIONES ## 21 - INSTRUCCIONES
EXTRA HIT EXTRA HIT
## 22 - INSTRUCCIONES ## 22 - INSTRUCCIONES
PRESS ANY KEY TO RETURN PRESS ANY KEY TO RETURN
## 23 - TITULO ## 23 - TITULO
PRESS ANY KEY PRESS ANY KEY
## 24 - MENU SELECCION DE IDIOMA ## 24 - MENU SELECCION DE IDIOMA
ESPA{OL (SPANISH) ESPA{OL (SPANISH)
## 25 - MENU SELECCION DE IDIOMA ## 25 - MENU SELECCION DE IDIOMA
BALOONCIA (VALENCIAN) BALOONCIA (VALENCIAN)
## 26 - MENU SELECCION DE IDIOMA ## 26 - MENU SELECCION DE IDIOMA
ENGLISH ENGLISH
## 27 - INTRO ## 27 - INTRO
Any day of the year 2000 Any day of the year 2000
## 28 - INTRO ## 28 - INTRO
Everything is quiet at the UPV Everything is quiet at the UPV
## 29 - INTRO ## 29 - INTRO
Until a bastard arrives... Until a bastard arrives...
## 30 - INTRO ## 30 - INTRO
YO! GONNA TAKE A CAFELITO... YO! GONNA TAKE A CAFELITO...
## 31 - INTRO ## 31 - INTRO
AAAAAAAARGHHHH!!! AAAAAAAARGHHHH!!!
## 32 - INTRO ## 32 - INTRO
Wait a moment... Wait a moment...
## 33 - INTRO ## 33 - INTRO
I don't have any loose! I don't have any loose!
## 34 - INTRO ## 34 - INTRO
FUCKING MACHINE! FUCKING MACHINE!
## 35 - INTRO ## 35 - INTRO
Blop... blop... blop... Blop... blop... blop...
## 36 - TEXTOS DEL JUEGO ## 36 - TEXTOS DEL JUEGO
Time stopped: Time stopped:
## 37 - TEXTOS DEL JUEGO ## 37 - TEXTOS DEL JUEGO
D E M O D E M O
## 38 - TEXTOS DEL JUEGO ## 38 - TEXTOS DEL JUEGO
stages left! stages left!
## 39 -
## 40 - ## 39 - MENU SELECCION DE JUGADOR
Select Player
## 41 - ## 40 - MENU SELECCION DE JUGADOR
Back
## 41 - MENU DE PAUSA
Pause Menu
## 42 - ## 42 -
-
## 43 - PANTALLA DE GAME OVER ## 43 - PANTALLA DE GAME OVER
GAME OVER GAME OVER
## 44 - PANTALLA DE GAME OVER ## 44 - PANTALLA DE GAME OVER
YOUR SCORE: YOUR SCORE:
## 45 - PANTALLA DE GAME OVER ## 45 - PANTALLA DE GAME OVER
CONTINUE? CONTINUE?
## 46 - MENU DE PAUSA ## 46 - MENU DE PAUSA
CONTINUE CONTINUE
## 47 - MENU DE PAUSA ## 47 - MENU DE PAUSA
LEAVE GAME LEAVE GAME
## 48 - MENU GAME OVER ## 48 - MENU GAME OVER
YES YES
## 49 - MENU GAME OVER ## 49 - MENU GAME OVER
NO NO
## 50 - TEXTO DE COMPLETAR EL JUEGO ## 50 - TEXTO DE COMPLETAR EL JUEGO
Congratulations!! Congratulations!!
## 51 - MENU DEL TITULO ## 51 - MENU DEL TITULO
1 PLAYER 1 PLAYER
## 52 - MENU DEL TITULO ## 52 - MENU DEL TITULO
2 PLAYERS 2 PLAYERS
## 53 - MARCADOR ## 53 - MARCADOR
player 1 player 1
## 54 - MARCADOR ## 54 - MARCADOR
player 2 player 2
## 55 - MARCADOR ## 55 - MARCADOR
mult mult
## 56 - MARCADOR ## 56 - MARCADOR
high score high score
## 57 - MARCADOR ## 57 - MARCADOR
stage stage
## 58 - MENU DE OPCIONES ## 58 - MENU DE OPCIONES
DISPLAY MODE DISPLAY MODE
## 59 - MENU DE OPCIONES ## 59 - MENU DE OPCIONES
DIFFICULTY DIFFICULTY
## 60 - MENU DE OPCIONES ## 60 - MENU DE OPCIONES
FILTER FILTER
## 61 - MENU DE OPCIONES ## 61 - MENU DE OPCIONES
VSYNC VSYNC
## 62 - MENU DE OPCIONES ## 62 - MENU DE OPCIONES
PLAYER 1 CONTROLS PLAYER 1 CONTROLS
## 63 - MENU DE OPCIONES ## 63 - MENU DE OPCIONES
PLAYER 2 CONTROLS PLAYER 2 CONTROLS
## 64 - ## 64 -
-
## 65 - ## 65 -
-
## 66 - MENU DE OPCIONES ## 66 - MENU DE OPCIONES
EASY EASY
## 67 - MENU DE OPCIONES ## 67 - MENU DE OPCIONES
NORMAL NORMAL
## 68 - MENU DE OPCIONES ## 68 - MENU DE OPCIONES
HARD HARD
## 69 - MENU DE OPCIONES ## 69 - MENU DE OPCIONES
KEYBOARD KEYBOARD
## 70 - MENU DE OPCIONES ## 70 - MENU DE OPCIONES
GAME CONTROLLER GAME CONTROLLER
## 71 - MENU DE OPCIONES ## 71 - MENU DE OPCIONES
LINEAL LINEAL
## 72 - MENU DE OPCIONES ## 72 - MENU DE OPCIONES
NEAREST NEAREST
## 73 - MENU DE OPCIONES ## 73 - MENU DE OPCIONES
ON ON
## 74 - MENU DE OPCIONES ## 74 - MENU DE OPCIONES
OFF OFF
## 75 - JUEGO ## 75 - JUEGO
Get Ready! Get Ready!
## 76 - JUEGO ## 76 - JUEGO
1.000.000 points! 1.000.000 points!
## 77 - PANTALLA DE GAME OVER ## 77 - PANTALLA DE GAME OVER
PLAYER1 SCORE: PLAYER1 SCORE:
## 78 - PANTALLA DE GAME OVER ## 78 - PANTALLA DE GAME OVER
PLAYER2 SCORE: PLAYER2 SCORE:
## 79 - TEXTOS DEL JUEGO ## 79 - TEXTOS DEL JUEGO
Last stage! Last stage!

View File

@@ -1,160 +1,239 @@
## 0 - MENU DEL TITULO ## 0 - MENU DEL TITULO
JUGAR JUGAR
## 1 - MENU DEL TITULO ## 1 - MENU DEL TITULO
OPCIONES OPCIONES
## 2 - MENU DEL TITULO ## 2 - MENU DEL TITULO
INSTRUCCIONES INSTRUCCIONES
## 3 - MENU DEL TITULO ## 3 - MENU DEL TITULO
SALIR SALIR
## 4 - MENU DE OPCIONES ## 4 - MENU DE OPCIONES
VENTANA VENTANA
## 5 - MENU DE OPCIONES ## 5 - MENU DE OPCIONES
PANTALLA COMPLETA PANTALLA COMPLETA
## 6 - MENU DE OPCIONES ## 6 - MENU DE OPCIONES
PANTALLA COMPLETA FALSA PANTALLA COMPLETA FALSA
## 7 - MENU DE OPCIONES ## 7 - MENU DE OPCIONES
TAMA{O DE VENTANA TAMA{O DE VENTANA
## 8 - MENU DE OPCIONES ## 8 - MENU DE OPCIONES
IDIOMA IDIOMA
## 9 - MENU DE OPCIONES ## 9 - MENU DE OPCIONES
[ ACEPTAR ] [ ACEPTAR ]
## 10 - MENU DE OPCIONES ## 10 - MENU DE OPCIONES
[ CANCELAR ] [ CANCELAR ]
## 11 - INSTRUCCIONES ## 11 - INSTRUCCIONES
OBJETIVO OBJETIVO
## 12 - INSTRUCCIONES ## 12 - INSTRUCCIONES
TIENES QUE EXPLOTAR TIENES QUE EXPLOTAR
## 13 - INSTRUCCIONES ## 13 - INSTRUCCIONES
TANTOS GLOBOS COMO PUEDAS TANTOS GLOBOS COMO PUEDAS
## 14 - INSTRUCCIONES ## 14 - INSTRUCCIONES
LA DIFICULTAD SE INCREMENTA LA DIFICULTAD SE INCREMENTA
## 15 - INSTRUCCIONES ## 15 - INSTRUCCIONES
A MEDIDA QUE VAS PUNTUANDO A MEDIDA QUE VAS PUNTUANDO
## 16 - INSTRUCCIONES ## 16 - INSTRUCCIONES
OBJETOS OBJETOS
## 17 - INSTRUCCIONES ## 17 - INSTRUCCIONES
1.000 PUNTOS 1.000 PUNTOS
## 18 - INSTRUCCIONES ## 18 - INSTRUCCIONES
2.500 PUNTOS 2.500 PUNTOS
## 19 - INSTRUCCIONES ## 19 - INSTRUCCIONES
5.000 PUNTOS 5.000 PUNTOS
## 20 - INSTRUCCIONES ## 20 - INSTRUCCIONES
DETIENE EL TIEMPO DETIENE EL TIEMPO
## 21 - INSTRUCCIONES ## 21 - INSTRUCCIONES
VIDA EXTRA VIDA EXTRA
## 22 - INSTRUCCIONES ## 22 - INSTRUCCIONES
PULSA UNA TECLA PARA VOLVER PULSA UNA TECLA PARA VOLVER
## 23 - TITULO ## 23 - TITULO
PULSA CUALQUIER TECLA PULSA CUALQUIER TECLA
## 24 - MENU SELECCION DE IDIOMA ## 24 - MENU SELECCION DE IDIOMA
ESPA{OL ESPA{OL
## 25 - MENU SELECCION DE IDIOMA ## 25 - MENU SELECCION DE IDIOMA
BALOONCIA (VALENCIANO) BALOONCIA (VALENCIANO)
## 26 - MENU SELECCION DE IDIOMA ## 26 - MENU SELECCION DE IDIOMA
ENGLISH (INGLES) ENGLISH (INGLES)
## 27 - INTRO ## 27 - INTRO
Un dia cualquiera del a{o 2000 Un dia cualquiera del a{o 2000
## 28 - INTRO ## 28 - INTRO
Todo esta tranquilo en la UPV Todo esta tranquilo en la UPV
## 29 - INTRO ## 29 - INTRO
Hasta que un desaprensivo... Hasta que un desaprensivo...
## 30 - INTRO ## 30 - INTRO
HEY! VOY A SACARME UN TALLADET... HEY! VOY A SACARME UN TALLADET...
## 31 - INTRO ## 31 - INTRO
UAAAAAAAAAAAAA!!! UAAAAAAAAAAAAA!!!
## 32 - INTRO ## 32 - INTRO
Espera un momento... Espera un momento...
## 33 - INTRO ## 33 - INTRO
Si no llevo suelto encima! Si no llevo suelto encima!
## 34 - INTRO ## 34 - INTRO
MIERDA DE MAQUINA! MIERDA DE MAQUINA!
## 35 - INTRO ## 35 - INTRO
Blop... blop... blop... Blop... blop... blop...
## 36 - TEXTOS DEL JUEGO ## 36 - TEXTOS DEL JUEGO
Tiempo: Tiempo:
## 37 - TEXTOS DEL JUEGO ## 37 - TEXTOS DEL JUEGO
D E M O D E M O
## 38 - TEXTOS DEL JUEGO ## 38 - TEXTOS DEL JUEGO
fases mas! fases mas!
## 39 -
## 40 - ## 39 - MENU SELECCION DE JUGADOR
Selecciona jugador
## 41 - ## 40 - MENU SELECCION DE JUGADOR
Volver
## 41 - MENU DE PAUSA
Menu de pausa
## 42 - ## 42 -
-
## 43 - PANTALLA DE GAME OVER ## 43 - PANTALLA DE GAME OVER
FIN DE JUEGO FIN DE JUEGO
## 44 - PANTALLA DE GAME OVER ## 44 - PANTALLA DE GAME OVER
TU PUNTUACION: TU PUNTUACION:
## 45 - PANTALLA DE GAME OVER ## 45 - PANTALLA DE GAME OVER
CONTINUAR? CONTINUAR?
## 46 - MENU DE PAUSA ## 46 - MENU DE PAUSA
CONTINUAR CONTINUAR
## 47 - MENU DE PAUSA ## 47 - MENU DE PAUSA
SALIR DEL JUEGO SALIR DEL JUEGO
## 48 - MENU GAME OVER ## 48 - MENU GAME OVER
SI SI
## 49 - MENU GAME OVER ## 49 - MENU GAME OVER
NO NO
## 50 - TEXTO DE COMPLETAR EL JUEGO ## 50 - TEXTO DE COMPLETAR EL JUEGO
Felicidades!! Felicidades!!
## 51 - MENU DEL TITULO ## 51 - MENU DEL TITULO
1 JUGADOR 1 JUGADOR
## 52 - MENU DEL TITULO ## 52 - MENU DEL TITULO
2 JUGADORES 2 JUGADORES
## 53 - MARCADOR ## 53 - MARCADOR
jugador 1 jugador 1
## 54 - MARCADOR ## 54 - MARCADOR
jugador 2 jugador 2
## 55 - MARCADOR ## 55 - MARCADOR
mult mult
## 56 - MARCADOR ## 56 - MARCADOR
max. puntuacion max. puntuacion
## 57 - MARCADOR ## 57 - MARCADOR
FASE FASE
## 58 - MENU DE OPCIONES ## 58 - MENU DE OPCIONES
MODO DE VISUALIZACION MODO DE VISUALIZACION
## 59 - MENU DE OPCIONES ## 59 - MENU DE OPCIONES
DIFICULTAD DIFICULTAD
## 60 - MENU DE OPCIONES ## 60 - MENU DE OPCIONES
FILTRO FILTRO
## 61 - MENU DE OPCIONES ## 61 - MENU DE OPCIONES
SINC. VERTICAL SINC. VERTICAL
## 62 - MENU DE OPCIONES ## 62 - MENU DE OPCIONES
CONTROLES DEL JUGADOR 1 CONTROLES DEL JUGADOR 1
## 63 - MENU DE OPCIONES ## 63 - MENU DE OPCIONES
CONTROLES DEL JUGADOR 2 CONTROLES DEL JUGADOR 2
## 64 - ## 64 -
-
## 65 - ## 65 -
-
## 66 - MENU DE OPCIONES ## 66 - MENU DE OPCIONES
FACIL FACIL
## 67 - MENU DE OPCIONES ## 67 - MENU DE OPCIONES
NORMAL NORMAL
## 68 - MENU DE OPCIONES ## 68 - MENU DE OPCIONES
DIFICIL DIFICIL
## 69 - MENU DE OPCIONES ## 69 - MENU DE OPCIONES
TECLADO TECLADO
## 70 - MENU DE OPCIONES ## 70 - MENU DE OPCIONES
MANDO MANDO
## 71 - MENU DE OPCIONES ## 71 - MENU DE OPCIONES
LINEAL LINEAL
## 72 - MENU DE OPCIONES ## 72 - MENU DE OPCIONES
NEAREST NEAREST
## 73 - MENU DE OPCIONES ## 73 - MENU DE OPCIONES
ACTIVADA ACTIVADA
## 74 - MENU DE OPCIONES ## 74 - MENU DE OPCIONES
DESACTIVADA DESACTIVADA
## 75 - JUEGO ## 75 - JUEGO
Adelante! Adelante!
## 76 - JUEGO ## 76 - JUEGO
1.000.000 de puntos! 1.000.000 de puntos!
## 77 - PANTALLA DE GAME OVER ## 77 - PANTALLA DE GAME OVER
PUNTUACION J1: PUNTUACION J1:
## 78 - PANTALLA DE GAME OVER ## 78 - PANTALLA DE GAME OVER
PUNTUACION J2: PUNTUACION J2:
## 79 - TEXTOS DEL JUEGO ## 79 - TEXTOS DEL JUEGO
Ultima fase! Ultima fase!

29
data/menu/gameover.men Normal file
View File

@@ -0,0 +1,29 @@
font_png=smb2.png
font_txt=smb2.txt
sound_move=menu_move.wav
sound_accept=menu_select.wav
name=GAME OVER
x=0
y=120
backgroundType=0
backgroundColor=128,64,0,0
areElementsCenteredOnX=true
isCenteredOnX=true
centerX=199
selector_color=255,122,0,255
selector_text_color=255,255,235
defaultActionWhenCancel=1
[item]
text=SI
hPaddingDown=2
[/item]
[item]
text=NO
[/item]

View File

@@ -1,9 +1,8 @@
font_png=smb2.png font_png=smb2.png
font_txt=smb2.txt font_txt=smb2.txt
sound_cancel=menu_cancel.wav
sound_accept=menu_select.wav
sound_move=menu_move.wav sound_move=menu_move.wav
sound_accept=menu_select.wav
name=OPTIONS name=OPTIONS
x=0 x=0
@@ -20,7 +19,7 @@ isCenteredOnY=true
centerY=96 centerY=96
selector_color=229,28,35,255 selector_color=229,28,35,255
selector_text_color=255,180,0 selector_text_color=255,241,118
defaultActionWhenCancel=13 defaultActionWhenCancel=13

35
data/menu/pause.men Normal file
View File

@@ -0,0 +1,35 @@
font_png=smb2.png
font_txt=smb2.txt
sound_move=menu_move.wav
sound_accept=menu_select.wav
name=PAUSE
x=0
y=80
backgroundType=1
backgroundColor=41,57,65,240
areElementsCenteredOnX=true
isCenteredOnX=true
centerX=128
selector_color=255,122,0,255
selector_text_color=255,255,255
defaultActionWhenCancel=1
[item]
text=PAUSE MENU
hPaddingDown=7
selectable=false
[/item]
[item]
text=CONTINUE
hPaddingDown=2
[/item]
[item]
text=LEAVE GAME
[/item]

View File

@@ -0,0 +1,40 @@
font_png=smb2.png
font_txt=smb2.txt
sound_move=menu_move.wav
sound_accept=menu_select.wav
name=PLAYER_SELECT
x=0
y=116
backgroundType=0
backgroundColor=48,48,64,192
areElementsCenteredOnX=true
isCenteredOnX=true
centerX=128
selector_color=229,28,35,0
selector_text_color=255,180,0
defaultActionWhenCancel=3
[item]
text=SELECT PLAYER
hPaddingDown=7
selectable=false
[/item]
[item]
text=BAL1
hPaddingDown=2
[/item]
[item]
text=AROUNDER
hPaddingDown=7
[/item]
[item]
text=BACK
[/item]

View File

@@ -1,9 +1,8 @@
font_png=smb2.png font_png=smb2.png
font_txt=smb2.txt font_txt=smb2.txt
sound_cancel=menu_cancel.wav
sound_accept=menu_select.wav
sound_move=menu_move.wav sound_move=menu_move.wav
sound_accept=menu_select.wav
name=TITLE name=TITLE
x=0 x=0

Binary file not shown.

42
release/Info.plist Normal file
View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>es</string>
<key>CFBundleDisplayName</key>
<string>coffee_crisis</string>
<key>CFBundleExecutable</key>
<string>coffee_crisis</string>
<key>CFBundleIconFile</key>
<string>coffee_crisis</string>
<key>CFBundleIconName</key>
<string>coffee_crisis</string>
<key>CFBundleIdentifier</key>
<string>org.jailgames.coffee_crisis</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>coffee_crisis</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2022 JailDesigner</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
</dict>
</plist>

BIN
release/SDL2.dll Executable file

Binary file not shown.

BIN
release/coffee_crisis.icns Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,9 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "utils.h" #include "common/animatedsprite.h"
#include "animatedsprite.h" #include "common/utils.h"
#include <sstream>
#include <vector> #include <vector>
#ifndef BALLOON_H #ifndef BALLOON_H
@@ -85,37 +86,39 @@ private:
std::vector<float> h; // Vector con los valores de zoom para el alto del globo std::vector<float> h; // Vector con los valores de zoom para el alto del globo
}; };
float mPosX; // Posición en el eje X // Objetos y punteros
float mPosY; // Posición en el eje Y AnimatedSprite *sprite; // Sprite del objeto globo
Uint8 mWidth; // Ancho
Uint8 mHeight; // Alto // Variables
float mVelX; // Velocidad en el eje X. Cantidad de pixeles a desplazarse float posX; // Posición en el eje X
float mVelY; // Velocidad en el eje Y. Cantidad de pixeles a desplazarse float posY; // Posición en el eje Y
float mGravity; // Aceleración en el eje Y. Modifica la velocidad Uint8 width; // Ancho
float mDefaultVelY; // Velocidad inicial que tienen al rebotar contra el suelo Uint8 height; // Alto
float mMaxVelY; // Máxima velocidad que puede alcanzar el objeto en el eje Y float velX; // Velocidad en el eje X. Cantidad de pixeles a desplazarse
AnimatedSprite *mSprite; // Sprite del objeto globo float velY; // Velocidad en el eje Y. Cantidad de pixeles a desplazarse
bool mBeingCreated; // Indica si el globo se está creando float gravity; // Aceleración en el eje Y. Modifica la velocidad
bool mBlinking; // Indica si el globo está intermitente float defaultVelY; // Velocidad inicial que tienen al rebotar contra el suelo
bool mEnabled; // Indica si el globo esta activo float maxVelY; // Máxima velocidad que puede alcanzar el objeto en el eje Y
bool mInvulnerable; // Indica si el globo es invulnerable bool beingCreated; // Indica si el globo se está creando
bool mPopping; // Indica si el globo está explotando bool blinking; // Indica si el globo está intermitente
bool mStopped; // Indica si el globo está parado bool enabled; // Indica si el globo esta activo
bool mVisible; // Indica si el globo es visible bool invulnerable; // Indica si el globo es invulnerable
circle_t mCollider; // Circulo de colisión del objeto bool popping; // Indica si el globo está explotando
Uint16 mCreationCounter; // Temporizador para controlar el estado "creandose" bool stopped; // Indica si el globo está parado
Uint16 mCreationCounterIni; // Valor inicial para el temporizador para controlar el estado "creandose" bool visible; // Indica si el globo es visible
Uint16 mScore; // Puntos que da el globo al ser destruido circle_t collider; // Circulo de colisión del objeto
Uint16 mStoppedCounter; // Contador para controlar el estado "parado" Uint16 creationCounter; // Temporizador para controlar el estado "creandose"
Uint16 mTimeToLive; // Indica el tiempo de vida que le queda al globo Uint16 creationCounterIni; // Valor inicial para el temporizador para controlar el estado "creandose"
Uint8 mKind; // Tipo de globo Uint16 score; // Puntos que da el globo al ser destruido
Uint8 mMenace; // Cantidad de amenaza que genera el globo Uint16 stoppedCounter; // Contador para controlar el estado "parado"
Uint32 mCounter; // Contador interno Uint8 kind; // Tipo de globo
float mTravelY; // Distancia que ha de recorrer el globo en el eje Y antes de que se le aplique la gravedad Uint8 menace; // Cantidad de amenaza que genera el globo
float mSpeed; // Velocidad a la que se mueven los globos Uint32 counter; // Contador interno
Uint8 mSize; // Tamaño del globo float travelY; // Distancia que ha de recorrer el globo en el eje Y antes de que se le aplique la gravedad
Uint8 mPower; // Cantidad de poder que alberga el globo float speed; // Velocidad a la que se mueven los globos
bouncing mBouncing; // Contiene las variables para el efecto de rebote Uint8 size; // Tamaño del globo
Uint8 power; // Cantidad de poder que alberga el globo
bouncing bouncing; // Contiene las variables para el efecto de rebote
// Alinea el circulo de colisión con la posición del objeto globo // Alinea el circulo de colisión con la posición del objeto globo
void updateColliders(); void updateColliders();
@@ -136,17 +139,11 @@ private:
void updateAnimation(); void updateAnimation();
// Establece el valor de la variable // Establece el valor de la variable
void setBeingCreated(bool state); void setBeingCreated(bool value);
// Establece el valor de la variable
void setTimeToLive(Uint16 time);
// Obtiene del valor de la variable
Uint16 getTimeToLive();
public: public:
// Constructor // Constructor
Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, LTexture *texture, SDL_Renderer *renderer); Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, Texture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer);
// Destructor // Destructor
~Balloon(); ~Balloon();
@@ -203,25 +200,25 @@ public:
Uint8 getClass(); Uint8 getClass();
// Establece el valor de la variable // Establece el valor de la variable
void setStop(bool state); void setStop(bool value);
// Obtiene del valor de la variable // Obtiene del valor de la variable
bool isStopped(); bool isStopped();
// Establece el valor de la variable // Establece el valor de la variable
void setBlink(bool state); void setBlink(bool value);
// Obtiene del valor de la variable // Obtiene del valor de la variable
bool isBlinking(); bool isBlinking();
// Establece el valor de la variable // Establece el valor de la variable
void setVisible(bool state); void setVisible(bool value);
// Obtiene del valor de la variable // Obtiene del valor de la variable
bool isVisible(); bool isVisible();
// Establece el valor de la variable // Establece el valor de la variable
void setInvulnerable(bool state); void setInvulnerable(bool value);
// Obtiene del valor de la variable // Obtiene del valor de la variable
bool isInvulnerable(); bool isInvulnerable();
@@ -230,7 +227,7 @@ public:
bool isBeingCreated(); bool isBeingCreated();
// Establece el valor de la variable // Establece el valor de la variable
void setPopping(bool state); void setPopping(bool value);
// Obtiene del valor de la variable // Obtiene del valor de la variable
bool isPopping(); bool isPopping();

View File

@@ -2,61 +2,73 @@
#include "bullet.h" #include "bullet.h"
// Constructor // Constructor
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, LTexture *texture, SDL_Renderer *renderer) Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, Texture *texture, SDL_Renderer *renderer)
{ {
mSprite = new Sprite({x,y,10,10},texture, renderer); sprite = new Sprite({x, y, 10, 10}, texture, renderer);
// Posición inicial del objeto // Posición inicial del objeto
mPosX = x; posX = x;
mPosY = y; posY = y;
// Alto y ancho del objeto // Alto y ancho del objeto
mWidth = 10; width = 10;
mHeight = mWidth; height = 10;
// Velocidad inicial en el eje Y // Velocidad inicial en el eje Y
mVelY = -3; velY = -3;
// Tipo de bala // Tipo de bala
mKind = kind; this->kind = kind;
// Identificador del dueño del objeto // Identificador del dueño del objeto
mOwner = owner; this->owner = owner;
// Valores especificos según el tipo // Valores especificos según el tipo
switch (kind) switch (kind)
{ {
case BULLET_UP: case BULLET_UP:
// Establece la velocidad inicial // Establece la velocidad inicial
mVelX = 0; velX = 0;
// Rectangulo con los gráficos del objeto // Rectangulo con los gráficos del objeto
if (!poweredUp) if (!poweredUp)
mSprite->setSpriteClip(0 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight()); {
sprite->setSpriteClip(0 * width, 0, sprite->getWidth(), sprite->getHeight());
}
else else
mSprite->setSpriteClip((0 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight()); {
sprite->setSpriteClip((0 + 3) * width, 0, sprite->getWidth(), sprite->getHeight());
}
break; break;
case BULLET_LEFT: case BULLET_LEFT:
// Establece la velocidad inicial // Establece la velocidad inicial
mVelX = -2; velX = -2;
// Rectangulo con los gráficos del objeto // Rectangulo con los gráficos del objeto
if (!poweredUp) if (!poweredUp)
mSprite->setSpriteClip(1 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight()); {
sprite->setSpriteClip(1 * width, 0, sprite->getWidth(), sprite->getHeight());
}
else else
mSprite->setSpriteClip((1 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight()); {
sprite->setSpriteClip((1 + 3) * width, 0, sprite->getWidth(), sprite->getHeight());
}
break; break;
case BULLET_RIGHT: case BULLET_RIGHT:
// Establece la velocidad inicial // Establece la velocidad inicial
mVelX = 2; velX = 2;
// Rectangulo con los gráficos del objeto // Rectangulo con los gráficos del objeto
if (!poweredUp) if (!poweredUp)
mSprite->setSpriteClip(2 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight()); {
sprite->setSpriteClip(2 * width, 0, sprite->getWidth(), sprite->getHeight());
}
else else
mSprite->setSpriteClip((2 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight()); {
sprite->setSpriteClip((2 + 3) * width, 0, sprite->getWidth(), sprite->getHeight());
}
break; break;
default: default:
@@ -64,7 +76,7 @@ Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, LTexture *text
} }
// Establece el tamaño del circulo de colisión // Establece el tamaño del circulo de colisión
mCollider.r = mWidth / 2; collider.r = width / 2;
// Alinea el circulo de colisión con el objeto // Alinea el circulo de colisión con el objeto
shiftColliders(); shiftColliders();
@@ -73,14 +85,13 @@ Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, LTexture *text
// Destructor // Destructor
Bullet::~Bullet() Bullet::~Bullet()
{ {
delete mSprite; delete sprite;
mSprite = nullptr;
} }
// Pinta el objeto en pantalla // Pinta el objeto en pantalla
void Bullet::render() void Bullet::render()
{ {
mSprite->render(); sprite->render();
} }
// Actualiza la posición y estado del objeto en horizontal // Actualiza la posición y estado del objeto en horizontal
@@ -90,34 +101,34 @@ Uint8 Bullet::move()
Uint8 msg = BULLET_MOVE_OK; Uint8 msg = BULLET_MOVE_OK;
// Mueve el objeto a su nueva posición // Mueve el objeto a su nueva posición
mPosX += mVelX; posX += velX;
// Si el objeto se sale del area de juego por los laterales // Si el objeto se sale del area de juego por los laterales
if ((mPosX < PLAY_AREA_LEFT) || (mPosX + mWidth > PLAY_AREA_RIGHT)) if ((posX < PLAY_AREA_LEFT - width) || (posX > PLAY_AREA_RIGHT))
{ {
// Se deshabilita // Se deshabilita
mKind = NO_KIND; kind = NO_KIND;
// Mensaje de salida // Mensaje de salida
msg = BULLET_MOVE_OUT; msg = BULLET_MOVE_OUT;
} }
// Mueve el objeto a su nueva posición en vertical // Mueve el objeto a su nueva posición en vertical
mPosY += int(mVelY); posY += int(velY);
// Si el objeto se sale del area de juego por la parte superior o inferior // Si el objeto se sale del area de juego por la parte superior
if ((mPosY < PLAY_AREA_TOP) || (mPosY + mHeight > PLAY_AREA_BOTTOM)) if (posY < PLAY_AREA_TOP - height)
{ {
// Se deshabilita // Se deshabilita
mKind = NO_KIND; kind = NO_KIND;
// Mensaje de salida // Mensaje de salida
msg = BULLET_MOVE_OUT; msg = BULLET_MOVE_OUT;
} }
// Actualiza la posición del sprite // Actualiza la posición del sprite
mSprite->setPosX(mPosX); sprite->setPosX(posX);
mSprite->setPosY(mPosY); sprite->setPosY(posY);
// Alinea el circulo de colisión con el objeto // Alinea el circulo de colisión con el objeto
shiftColliders(); shiftColliders();
@@ -125,66 +136,76 @@ Uint8 Bullet::move()
return msg; return msg;
} }
// Comprueba si el objeto está activo // Comprueba si el objeto está habilitado
bool Bullet::isActive() bool Bullet::isEnabled()
{ {
if (mKind == NO_KIND) if (kind == NO_KIND)
{
return false; return false;
}
else else
{
return true; return true;
}
}
// Deshabilita el objeto
void Bullet::disable()
{
kind = NO_KIND;
} }
// Obtiene el valor de la variable // Obtiene el valor de la variable
int Bullet::getPosX() int Bullet::getPosX()
{ {
return mPosX; return posX;
} }
// Obtiene el valor de la variable // Obtiene el valor de la variable
int Bullet::getPosY() int Bullet::getPosY()
{ {
return mPosY; return posY;
} }
// Establece el valor de la variable // Establece el valor de la variable
void Bullet::setPosX(int x) void Bullet::setPosX(int x)
{ {
mPosX = x; posX = x;
} }
// Establece el valor de la variable // Establece el valor de la variable
void Bullet::setPosY(int y) void Bullet::setPosY(int y)
{ {
mPosY = y; posY = y;
} }
// Obtiene el valor de la variable // Obtiene el valor de la variable
int Bullet::getVelY() int Bullet::getVelY()
{ {
return mVelY; return velY;
} }
// Obtiene el valor de la variable // Obtiene el valor de la variable
int Bullet::getKind() int Bullet::getKind()
{ {
return mKind; return kind;
} }
// Obtiene el valor de la variable // Obtiene el valor de la variable
int Bullet::getOwner() int Bullet::getOwner()
{ {
return mOwner; return owner;
} }
// Obtiene el circulo de colisión // Obtiene el circulo de colisión
circle_t &Bullet::getCollider() circle_t &Bullet::getCollider()
{ {
return mCollider; return collider;
} }
// Alinea el circulo de colisión con el objeto // Alinea el circulo de colisión con el objeto
void Bullet::shiftColliders() void Bullet::shiftColliders()
{ {
mCollider.x = mPosX + mCollider.r; collider.x = posX + collider.r;
mCollider.y = mPosY + mCollider.r; collider.y = posY + collider.r;
} }

View File

@@ -1,8 +1,8 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "utils.h" #include "common/sprite.h"
#include "sprite.h" #include "common/utils.h"
#ifndef BULLET_H #ifndef BULLET_H
#define BULLET_H #define BULLET_H
@@ -20,23 +20,26 @@
class Bullet class Bullet
{ {
private: private:
int mPosX; // Posición en el eje X // Objetos y punteros
int mPosY; // Posición en el eje Y Sprite *sprite; // Sprite con los graficos y métodos de pintado
Uint8 mWidth; // Ancho del objeto
Uint8 mHeight; // Alto del objeto // Variables
int mVelX; // Velocidad en el eje X int posX; // Posición en el eje X
int mVelY; // Velocidad en el eje Y int posY; // Posición en el eje Y
int mKind; // Tipo de objeto Uint8 width; // Ancho del objeto
int mOwner; // Identificador del dueño del objeto Uint8 height; // Alto del objeto
Sprite *mSprite; // Sprite con los graficos y métodos de pintado int velX; // Velocidad en el eje X
circle_t mCollider; // Circulo de colisión del objeto int velY; // Velocidad en el eje Y
int kind; // Tipo de objeto
int owner; // Identificador del dueño del objeto
circle_t collider; // Circulo de colisión del objeto
// Alinea el circulo de colisión con el objeto // Alinea el circulo de colisión con el objeto
void shiftColliders(); void shiftColliders();
public: public:
// Constructor // Constructor
Bullet(int x, int y, int kind, bool poweredUp, int owner, LTexture *texture, SDL_Renderer *renderer); Bullet(int x, int y, int kind, bool poweredUp, int owner, Texture *texture, SDL_Renderer *renderer);
// Destructor // Destructor
~Bullet(); ~Bullet();
@@ -47,8 +50,11 @@ public:
// Actualiza la posición y estado del objeto // Actualiza la posición y estado del objeto
Uint8 move(); Uint8 move();
// Comprueba si el objeto está activo // Comprueba si el objeto está habilitado
bool isActive(); bool isEnabled();
// Deshabilita el objeto
void disable();
// Obtiene el valor de la variable // Obtiene el valor de la variable
int getPosX(); int getPosX();

15
source/common/Makefile Normal file
View File

@@ -0,0 +1,15 @@
executable = jaildoctors_dilemma
source = source/*.cpp source/common/*.cpp
windows:
@echo off
if not exist bin\ (mkdir bin)
g++ $(source) -std=c++11 -Wall -O2 -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o bin/$(executable).exe
strip -s -R .comment -R .gnu.version bin/$(executable).exe --strip-unneeded
macos:
mkdir -p bin
g++ $(source) -std=c++11 -Wall -O2 -lSDL2 -ffunction-sections -fdata-sections -o bin/$(executable)_macos
linux:
mkdir -p bin
g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o bin/$(executable)_linux
strip -s -R .comment -R .gnu.version bin/$(executable)_linux --strip-unneeded

View File

@@ -1,8 +1,7 @@
#include "animatedsprite.h" #include "animatedsprite.h"
// Constructor // Constructor
AnimatedSprite::AnimatedSprite(LTexture *texture, SDL_Renderer *renderer, std::string file) AnimatedSprite::AnimatedSprite(Texture *texture, SDL_Renderer *renderer, std::string file, std::vector<std::string> *buffer)
{ {
// Copia los punteros // Copia los punteros
setTexture(texture); setTexture(texture);
@@ -11,7 +10,12 @@ AnimatedSprite::AnimatedSprite(LTexture *texture, SDL_Renderer *renderer, std::s
// Carga las animaciones // Carga las animaciones
if (file != "") if (file != "")
{ {
load(file); loadFromFile(file);
}
else if (buffer)
{
loadFromVector(buffer);
} }
// Inicializa variables // Inicializa variables
@@ -84,6 +88,12 @@ void AnimatedSprite::animate()
} }
} }
// Obtiene el numero de frames de la animación actual
int AnimatedSprite::getNumFrames()
{
return (int)animation.at(currentAnimation).frames.size();
}
// Establece el frame actual de la animación // Establece el frame actual de la animación
void AnimatedSprite::setCurrentFrame(int num) void AnimatedSprite::setCurrentFrame(int num)
{ {
@@ -161,7 +171,7 @@ SDL_Rect AnimatedSprite::getAnimationClip(int indexA, Uint8 indexF)
} }
// Carga la animación desde un fichero // Carga la animación desde un fichero
bool AnimatedSprite::load(std::string filePath) bool AnimatedSprite::loadFromFile(std::string filePath)
{ {
int framesPerRow = 0; int framesPerRow = 0;
int frameWidth = 0; int frameWidth = 0;
@@ -179,7 +189,7 @@ bool AnimatedSprite::load(std::string filePath)
if (file.good()) if (file.good())
{ {
// Procesa el fichero linea a linea // Procesa el fichero linea a linea
printf("Reading file %s\n", filename.c_str()); std::cout << "Loading animation from file: " << filePath.c_str() << std::endl;
while (std::getline(file, line)) while (std::getline(file, line))
{ {
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación // Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
@@ -204,14 +214,17 @@ bool AnimatedSprite::load(std::string filePath)
{ {
buffer.name = line.substr(pos + 1, line.length()); buffer.name = line.substr(pos + 1, line.length());
} }
else if (line.substr(0, pos) == "speed") else if (line.substr(0, pos) == "speed")
{ {
buffer.speed = std::stoi(line.substr(pos + 1, line.length())); buffer.speed = std::stoi(line.substr(pos + 1, line.length()));
} }
else if (line.substr(0, pos) == "loop") else if (line.substr(0, pos) == "loop")
{ {
buffer.loop = std::stoi(line.substr(pos + 1, line.length())); buffer.loop = std::stoi(line.substr(pos + 1, line.length()));
} }
else if (line.substr(0, pos) == "frames") else if (line.substr(0, pos) == "frames")
{ {
// Se introducen los valores separados por comas en un vector // Se introducen los valores separados por comas en un vector
@@ -227,6 +240,7 @@ bool AnimatedSprite::load(std::string filePath)
buffer.frames.push_back(rect); buffer.frames.push_back(rect);
} }
} }
else else
{ {
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str()); printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
@@ -286,7 +300,6 @@ bool AnimatedSprite::load(std::string filePath)
} }
// Cierra el fichero // Cierra el fichero
printf("Closing file %s\n\n", filename.c_str());
file.close(); file.close();
} }
// El fichero no se puede abrir // El fichero no se puede abrir
@@ -297,7 +310,145 @@ bool AnimatedSprite::load(std::string filePath)
} }
// Pone un valor por defecto // Pone un valor por defecto
setPos({0, 0, frameWidth, frameHeight}); setRect({0, 0, frameWidth, frameHeight});
return success;
}
// Carga la animación desde un vector
bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
{
// Inicializa variables
int framesPerRow = 0;
int frameWidth = 0;
int frameHeight = 0;
int maxTiles = 0;
// Indicador de éxito en el proceso
bool success = true;
std::string line;
// Recorre todo el vector
int index = 0;
while (index < (int)source->size())
{
// Lee desde el vector
line = source->at(index);
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
if (line == "[animation]")
{
t_animation buffer;
buffer.counter = 0;
buffer.currentFrame = 0;
buffer.completed = false;
do
{
// Aumenta el indice para leer la siguiente linea
index++;
line = source->at(index);
// Encuentra la posición del caracter '='
int pos = line.find("=");
// Procesa las dos subcadenas
if (pos != (int)line.npos)
{
if (line.substr(0, pos) == "name")
{
buffer.name = line.substr(pos + 1, line.length());
}
else if (line.substr(0, pos) == "speed")
{
buffer.speed = std::stoi(line.substr(pos + 1, line.length()));
}
else if (line.substr(0, pos) == "loop")
{
buffer.loop = std::stoi(line.substr(pos + 1, line.length()));
}
else if (line.substr(0, pos) == "frames")
{
// Se introducen los valores separados por comas en un vector
std::stringstream ss(line.substr(pos + 1, line.length()));
std::string tmp;
SDL_Rect rect = {0, 0, frameWidth, frameHeight};
while (getline(ss, tmp, ','))
{
// Comprueba que el tile no sea mayor que el maximo indice permitido
const int numTile = std::stoi(tmp) > maxTiles ? 0 : std::stoi(tmp);
rect.x = (numTile % framesPerRow) * frameWidth;
rect.y = (numTile / framesPerRow) * frameHeight;
buffer.frames.push_back(rect);
}
}
else
{
std::cout << "Warning: unknown parameter " << line.substr(0, pos).c_str() << std::endl;
success = false;
}
}
} while (line != "[/animation]");
// Añade la animación al vector de animaciones
animation.push_back(buffer);
}
// En caso contrario se parsea el fichero para buscar las variables y los valores
else
{
// Encuentra la posición del caracter '='
int pos = line.find("=");
// Procesa las dos subcadenas
if (pos != (int)line.npos)
{
if (line.substr(0, pos) == "framesPerRow")
{
framesPerRow = std::stoi(line.substr(pos + 1, line.length()));
}
else if (line.substr(0, pos) == "frameWidth")
{
frameWidth = std::stoi(line.substr(pos + 1, line.length()));
}
else if (line.substr(0, pos) == "frameHeight")
{
frameHeight = std::stoi(line.substr(pos + 1, line.length()));
}
else
{
std::cout << "Warning: unknown parameter " << line.substr(0, pos).c_str() << std::endl;
success = false;
}
// Normaliza valores
if (framesPerRow == 0 && frameWidth > 0)
{
framesPerRow = texture->getWidth() / frameWidth;
}
if (maxTiles == 0 && frameWidth > 0 && frameHeight > 0)
{
const int w = texture->getWidth() / frameWidth;
const int h = texture->getHeight() / frameHeight;
maxTiles = w * h;
}
}
}
// Una vez procesada la linea, aumenta el indice para pasar a la siguiente
index++;
}
// Pone un valor por defecto
setRect({0, 0, frameWidth, frameHeight});
return success; return success;
} }
@@ -349,3 +500,11 @@ void AnimatedSprite::setAnimationCounter(int value)
a.counter = value; a.counter = value;
} }
} }
// Reinicia la animación
void AnimatedSprite::resetAnimation()
{
animation.at(currentAnimation).currentFrame = 0;
animation.at(currentAnimation).counter = 0;
animation.at(currentAnimation).completed = false;
}

View File

@@ -2,10 +2,11 @@
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "movingsprite.h" #include "movingsprite.h"
#include <vector>
#include <string>
#include <sstream>
#include <fstream> #include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#ifndef ANIMATEDSPRITE_H #ifndef ANIMATEDSPRITE_H
#define ANIMATEDSPRITE_H #define ANIMATEDSPRITE_H
@@ -24,12 +25,14 @@ private:
int currentFrame; // Frame actual int currentFrame; // Frame actual
int counter; // Contador para las animaciones int counter; // Contador para las animaciones
}; };
// Variables
std::vector<t_animation> animation; // Vector con las diferentes animaciones std::vector<t_animation> animation; // Vector con las diferentes animaciones
int currentAnimation; // Animacion activa int currentAnimation; // Animacion activa
public: public:
// Constructor // Constructor
AnimatedSprite(LTexture *texture = nullptr, SDL_Renderer *renderer = nullptr, std::string file = ""); AnimatedSprite(Texture *texture = nullptr, SDL_Renderer *renderer = nullptr, std::string file = "", std::vector<std::string> *buffer = nullptr);
// Destructor // Destructor
~AnimatedSprite(); ~AnimatedSprite();
@@ -37,6 +40,9 @@ public:
// Calcula el frame correspondiente a la animación actual // Calcula el frame correspondiente a la animación actual
void animate(); void animate();
// Obtiene el numero de frames de la animación actual
int getNumFrames();
// Establece el frame actual de la animación // Establece el frame actual de la animación
void setCurrentFrame(int num); void setCurrentFrame(int num);
@@ -66,7 +72,10 @@ public:
int getIndex(std::string name); int getIndex(std::string name);
// Carga la animación desde un fichero // Carga la animación desde un fichero
bool load(std::string filePath); bool loadFromFile(std::string filePath);
// Carga la animación desde un vector
bool loadFromVector(std::vector<std::string> *source);
// Establece la animacion actual // Establece la animacion actual
void setCurrentAnimation(std::string name = "default"); void setCurrentAnimation(std::string name = "default");
@@ -80,6 +89,9 @@ public:
// OLD - Establece el contador para todas las animaciones // OLD - Establece el contador para todas las animaciones
void setAnimationCounter(int value); void setAnimationCounter(int value);
// Reinicia la animación
void resetAnimation();
}; };
#endif #endif

View File

@@ -1,10 +1,10 @@
#include "asset.h" #include "asset.h"
// Constructor // Constructor
Asset::Asset(std::string path) Asset::Asset(std::string executablePath)
{ {
executablePath = path; this->executablePath = executablePath.substr(0, executablePath.find_last_of("\\/"));
longest_name = 0; longestName = 0;
} }
// Destructor // Destructor
@@ -13,7 +13,7 @@ Asset::~Asset()
} }
// Añade un elemento a la lista // Añade un elemento a la lista
void Asset::add(std::string file, enum assetType_e type, bool required) void Asset::add(std::string file, enum assetType type, bool required)
{ {
item_t temp; item_t temp;
temp.file = executablePath + file; temp.file = executablePath + file;
@@ -22,7 +22,7 @@ void Asset::add(std::string file, enum assetType_e type, bool required)
fileList.push_back(temp); fileList.push_back(temp);
const std::string filename = file.substr(file.find_last_of("\\/") + 1); const std::string filename = file.substr(file.find_last_of("\\/") + 1);
longest_name = SDL_max(longest_name, filename.size()); longestName = SDL_max(longestName, filename.size());
} }
// Devuelve el fichero de un elemento de la lista a partir de una cadena // Devuelve el fichero de un elemento de la lista a partir de una cadena
@@ -106,7 +106,7 @@ bool Asset::checkFile(std::string path)
SDL_RWclose(file); SDL_RWclose(file);
} }
const std::string s = "Checking file %-" + std::to_string(longest_name) + "s [" + result + "]\n"; const std::string s = "Checking file %-" + std::to_string(longestName) + "s [" + result + "]\n";
printf(s.c_str(), filename.c_str()); printf(s.c_str(), filename.c_str());
return success; return success;

View File

@@ -7,7 +7,7 @@
#ifndef ASSET_H #ifndef ASSET_H
#define ASSET_H #define ASSET_H
enum assetType_e enum assetType
{ {
t_bitmap, t_bitmap,
t_music, t_music,
@@ -29,11 +29,11 @@ private:
struct item_t struct item_t
{ {
std::string file; // Ruta del fichero desde la raiz del directorio std::string file; // Ruta del fichero desde la raiz del directorio
enum assetType_e type; // Indica el tipo de recurso enum assetType type; // Indica el tipo de recurso
bool required; // Indica si es un fichero que debe de existir bool required; // Indica si es un fichero que debe de existir
}; };
int longest_name; // Contiene la longitud del nombre de fichero mas largo int longestName; // Contiene la longitud del nombre de fichero mas largo
std::vector<item_t> fileList; std::vector<item_t> fileList;
std::string executablePath; std::string executablePath;
@@ -46,13 +46,13 @@ private:
public: public:
// Constructor // Constructor
Asset(std::string path); Asset(std::string executablePath);
// Destructor // Destructor
~Asset(); ~Asset();
// Añade un elemento a la lista // Añade un elemento a la lista
void add(std::string file, enum assetType_e type, bool required = true); void add(std::string file, enum assetType type, bool required = true);
// Devuelve un elemento de la lista a partir de una cadena // Devuelve un elemento de la lista a partir de una cadena
std::string get(std::string text); std::string get(std::string text);

View File

@@ -97,7 +97,7 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
{ {
if (repeat) if (repeat)
{ {
if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings[input].button) != 0) if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings.at(input).button) != 0)
{ {
successGameController = true; successGameController = true;
} }
@@ -108,11 +108,11 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
} }
else else
{ {
if (!gameControllerBindings[input].active) if (!gameControllerBindings.at(input).active)
{ {
if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings[input].button) != 0) if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings.at(input).button) != 0)
{ {
gameControllerBindings[input].active = true; gameControllerBindings.at(input).active = true;
successGameController = true; successGameController = true;
} }
else else
@@ -122,9 +122,9 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
} }
else else
{ {
if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings[input].button) == 0) if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings.at(input).button) == 0)
{ {
gameControllerBindings[input].active = false; gameControllerBindings.at(input).active = false;
successGameController = false; successGameController = false;
} }
else else
@@ -138,6 +138,44 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
return (successKeyboard || successGameController); return (successKeyboard || successGameController);
} }
// Comprueba si hay almenos un input activo
bool Input::checkAnyInput(int device, int index)
{
if (device == INPUT_USE_ANY)
{
index = 0;
}
if (device == INPUT_USE_KEYBOARD || device == INPUT_USE_ANY)
{
const Uint8 *mKeystates = SDL_GetKeyboardState(nullptr);
for (int i = 0; i < (int)keyBindings.size(); ++i)
{
if (mKeystates[keyBindings.at(i).scancode] != 0)
{
return true;
}
}
}
if (gameControllerFound())
{
if (device == INPUT_USE_GAMECONTROLLER || device == INPUT_USE_ANY)
{
for (int i = 0; i < (int)gameControllerBindings.size(); ++i)
{
if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings.at(i).button) != 0)
{
return true;
}
}
}
}
return false;
}
// Comprueba si hay un mando conectado // Comprueba si hay un mando conectado
bool Input::discoverGameController() bool Input::discoverGameController()
{ {

View File

@@ -74,6 +74,9 @@ public:
// Comprueba si un input esta activo // Comprueba si un input esta activo
bool checkInput(Uint8 input, bool repeat, int device = INPUT_USE_ANY, int index = 0); bool checkInput(Uint8 input, bool repeat, int device = INPUT_USE_ANY, int index = 0);
// Comprueba si hay almenos un input activo
bool checkAnyInput(int device, int index);
// Comprueba si hay algun mando conectado // Comprueba si hay algun mando conectado
bool gameControllerFound(); bool gameControllerFound();

View File

@@ -1,4 +1,3 @@
#include "const.h"
#include "menu.h" #include "menu.h"
// Constructor // Constructor
@@ -20,6 +19,7 @@ Menu::Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file)
itemSelected = MENU_NO_OPTION; itemSelected = MENU_NO_OPTION;
x = 0; x = 0;
y = 0; y = 0;
w = 0;
rectBG.rect = {0, 0, 0, 0}; rectBG.rect = {0, 0, 0, 0};
rectBG.color = {0, 0, 0}; rectBG.color = {0, 0, 0};
rectBG.a = 0; rectBG.a = 0;
@@ -57,6 +57,9 @@ Menu::Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file)
{ {
load(file); load(file);
} }
// Deja el cursor en el primer elemento
reset();
} }
Menu::~Menu() Menu::~Menu()
@@ -157,7 +160,7 @@ bool Menu::load(std::string file_path)
} }
// Cierra el fichero // Cierra el fichero
printf("Closing file %s\n\n", filename.c_str()); printf("Closing file %s\n", filename.c_str());
file.close(); file.close();
} }
// El fichero no se puede abrir // El fichero no se puede abrir
@@ -167,9 +170,6 @@ bool Menu::load(std::string file_path)
success = false; success = false;
} }
// Reorganiza el menu con los valores recien cargados
// reorganize();
return success; return success;
} }
@@ -207,6 +207,7 @@ bool Menu::setItem(item_t *item, std::string var, std::string value)
else if ((var == "") || (var == "[/item]")) else if ((var == "") || (var == "[/item]"))
{ {
} }
else else
{ {
success = false; success = false;
@@ -351,11 +352,6 @@ bool Menu::setVars(std::string var, std::string value)
return success; return success;
} }
// Inicializa las variables
void Menu::init()
{
}
// Carga los ficheros de audio // Carga los ficheros de audio
void Menu::loadAudioFile(std::string file, int sound) void Menu::loadAudioFile(std::string file, int sound)
{ {
@@ -408,7 +404,8 @@ void Menu::updateSelector()
selector.moving = false; selector.moving = false;
} }
} }
if (selector.despY < 0) // Va hacia arriba
else if (selector.despY < 0) // Va hacia arriba
{ {
if (selector.y < selector.targetY) // Ha llegado al destino if (selector.y < selector.targetY) // Ha llegado al destino
{ {
@@ -436,7 +433,8 @@ void Menu::updateSelector()
selector.resizing = false; selector.resizing = false;
} }
} }
if (selector.incH < 0) // Decrece
else if (selector.incH < 0) // Decrece
{ {
if (selector.h < selector.targetH) // Ha llegado al destino if (selector.h < selector.targetH) // Ha llegado al destino
{ {
@@ -459,7 +457,7 @@ void Menu::setSelectorPos(int index)
if (index < (int)item.size()) if (index < (int)item.size())
{ {
selector.index = index; selector.index = index;
selector.rect.y = selector.y = selector.originY = selector.targetY = item[selector.index].rect.y; selector.rect.y = selector.y = selector.originY = selector.targetY = item.at(selector.index).rect.y;
selector.rect.w = rectBG.rect.w; selector.rect.w = rectBG.rect.w;
selector.rect.x = rectBG.rect.x; selector.rect.x = rectBG.rect.x;
selector.originH = selector.targetH = selector.rect.h = getSelectorHeight(selector.index); selector.originH = selector.targetH = selector.rect.h = getSelectorHeight(selector.index);
@@ -487,10 +485,17 @@ void Menu::reset()
{ {
itemSelected = MENU_NO_OPTION; itemSelected = MENU_NO_OPTION;
selector.index = 0; selector.index = 0;
selector.originY = selector.targetY = selector.y = item[0].rect.y; selector.originY = selector.targetY = selector.y = item.at(0).rect.y;
selector.originH = selector.targetH = item[0].rect.h; selector.originH = selector.targetH = item.at(0).rect.h;
selector.moving = false; selector.moving = false;
selector.resizing = false; selector.resizing = false;
// Si el primer elemento no es seleccionable, incrementa el selector
if (!item.at(selector.index).selectable)
{
increaseSelectorIndex();
setSelectorPos(selector.index);
}
} }
// Actualiza el menu para recolocarlo correctamente y establecer el tamaño // Actualiza el menu para recolocarlo correctamente y establecer el tamaño
@@ -518,18 +523,18 @@ void Menu::reorganize()
bool Menu::increaseSelectorIndex() bool Menu::increaseSelectorIndex()
{ {
// Obten las coordenadas del elemento actual // Obten las coordenadas del elemento actual
selector.y = selector.originY = item[selector.index].rect.y; selector.y = selector.originY = item.at(selector.index).rect.y;
selector.h = selector.originH = getSelectorHeight(selector.index); selector.h = selector.originH = getSelectorHeight(selector.index);
// Calcula cual es el siguiente elemento // Calcula cual es el siguiente elemento
++selector.index %= item.size(); ++selector.index %= item.size();
while (!item[selector.index].selectable) while (!item.at(selector.index).selectable)
{ {
++selector.index %= item.size(); ++selector.index %= item.size();
} }
// Establece las coordenadas y altura de destino // Establece las coordenadas y altura de destino
selector.targetY = item[selector.index].rect.y; selector.targetY = item.at(selector.index).rect.y;
selector.despY = (selector.targetY - selector.originY) / selector.numJumps; selector.despY = (selector.targetY - selector.originY) / selector.numJumps;
selector.targetH = getSelectorHeight(selector.index); selector.targetH = getSelectorHeight(selector.index);
@@ -548,24 +553,24 @@ bool Menu::increaseSelectorIndex()
bool Menu::decreaseSelectorIndex() bool Menu::decreaseSelectorIndex()
{ {
// Obten las coordenadas del elemento actual // Obten las coordenadas del elemento actual
selector.y = selector.originY = item[selector.index].rect.y; selector.y = selector.originY = item.at(selector.index).rect.y;
selector.h = selector.originH = getSelectorHeight(selector.index); selector.h = selector.originH = getSelectorHeight(selector.index);
// Calcula cual es el siguiente elemento // Calcula cual es el siguiente elemento
if (selector.index == 0) if (selector.index == 0)
{ {
selector.index = item.size(); selector.index = item.size() - 1;
} }
else else
{ {
selector.index--; selector.index--;
} }
while (!item[selector.index].selectable) while (!item.at(selector.index).selectable)
{ {
if (selector.index == 0) if (selector.index == 0)
{ {
selector.index = item.size(); selector.index = item.size() - 1;
} }
else else
{ {
@@ -574,7 +579,7 @@ bool Menu::decreaseSelectorIndex()
} }
// Establece las coordenadas y altura de destino // Establece las coordenadas y altura de destino
selector.targetY = item[selector.index].rect.y; selector.targetY = item.at(selector.index).rect.y;
selector.despY = (selector.targetY - selector.originY) / selector.numJumps; selector.despY = (selector.targetY - selector.originY) / selector.numJumps;
selector.targetH = getSelectorHeight(selector.index); selector.targetH = getSelectorHeight(selector.index);
@@ -608,8 +613,6 @@ void Menu::render()
// Renderiza el rectangulo del selector // Renderiza el rectangulo del selector
const SDL_Rect temp = {selector.rect.x, selector.rect.y - 1, selector.rect.w, selector.rect.h + 1}; const SDL_Rect temp = {selector.rect.x, selector.rect.y - 1, selector.rect.w, selector.rect.h + 1};
// temp.y--;
// temp.h++;
SDL_SetRenderDrawColor(renderer, selector.color.r, selector.color.g, selector.color.b, selector.a); SDL_SetRenderDrawColor(renderer, selector.color.r, selector.color.g, selector.color.b, selector.a);
SDL_RenderFillRect(renderer, &temp); SDL_RenderFillRect(renderer, &temp);
@@ -626,40 +629,74 @@ void Menu::render()
if (i == selector.index) if (i == selector.index)
{ {
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b}; const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color); text->writeColored(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label, color);
} }
else if (item[i].selectable)
else if (item.at(i).selectable)
{ {
text->write(item[i].rect.x, item[i].rect.y, item[i].label); text->write(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label);
} }
else if (item[i].greyed)
else if (item.at(i).greyed)
{ {
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, colorGreyed); text->writeColored(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label, colorGreyed);
} }
else else
// No seleccionable { // No seleccionable
{ if ((item.at(i).linkedUp) && (i == selector.index + 1))
if ((item[i].linkedUp) && (i == selector.index + 1))
{ {
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b}; const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color); text->writeColored(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label, color);
} }
else // No enlazado con el de arriba else // No enlazado con el de arriba
{ {
text->write(item[i].rect.x, item[i].rect.y, item[i].label); text->write(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label);
} }
} }
} }
} }
// Establece el rectangulo de fondo del menu y el selector // Establece el rectangulo de fondo del menu y el selector
void Menu::setRectSize() void Menu::setRectSize(int w, int h)
{ {
rectBG.rect.w = findWidth() + text->getCharacterSize(); // Establece el ancho
rectBG.rect.h = findHeight() + text->getCharacterSize(); if (w == 0)
{ // Si no se pasa un valor, se busca si hay uno prefijado
if (this->w == 0)
{ // Si no hay prefijado, coge el item mas ancho
rectBG.rect.w = findWidth() + text->getCharacterSize();
}
else
{ // Si hay prefijado, coge ese
rectBG.rect.w = this->w;
}
}
else
{ // Si se pasa un valor, se usa y se prefija
rectBG.rect.w = w;
this->w = w;
}
// Establece el alto
if (h == 0)
{ // Si no se pasa un valor, se busca de manera automatica
rectBG.rect.h = findHeight() + text->getCharacterSize();
}
else
{ // Si se pasa un valor, se aplica
rectBG.rect.h = h;
}
// La posición X es la del menú menos medio caracter // La posición X es la del menú menos medio caracter
rectBG.rect.x = x - (text->getCharacterSize() / 2); if (this->w != 0)
{ // Si el ancho esta prefijado, la x coinccide
rectBG.rect.x = x;
}
else
{ // Si el ancho es automatico, se le da un poco de margen
rectBG.rect.x = x - (text->getCharacterSize() / 2);
}
// La posición Y es la del menu menos la altura de medio caracter // La posición Y es la del menu menos la altura de medio caracter
rectBG.rect.y = y - (text->getCharacterSize() / 2); rectBG.rect.y = y - (text->getCharacterSize() / 2);
@@ -692,10 +729,28 @@ void Menu::setSelectorTextColor(color_t color)
void Menu::centerMenuOnX(int value) void Menu::centerMenuOnX(int value)
{ {
isCenteredOnX = true; isCenteredOnX = true;
centerX = value; if (value != 0)
{
centerX = value;
}
else if (centerX == 0)
{
return;
}
// Establece la nueva posición centrada en funcion del elemento más ancho // Establece la nueva posición centrada en funcion del elemento más ancho o del ancho fijo del menu
x = (value) - (findWidth() / 2); if (w != 0)
{ // Si se ha definido un ancho fijo
x = (centerX) - (w / 2);
}
else
{ // Si se actua en función del elemento más ancho
x = (centerX) - (findWidth() / 2);
}
// Actualiza el rectangulo de fondo y del selector
rectBG.rect.x = x;
selector.rect.x = x;
// Reposiciona los elementos del menu // Reposiciona los elementos del menu
for (auto &i : item) for (auto &i : item)
@@ -705,6 +760,12 @@ void Menu::centerMenuOnX(int value)
// Recalcula el rectangulo de fondo // Recalcula el rectangulo de fondo
setRectSize(); setRectSize();
// Vuelve a centrar los elementos si fuera el caso
if (areElementsCenteredOnX)
{
centerMenuElementsOnX();
}
} }
// Centra el menu respecto un punto en el eje Y // Centra el menu respecto un punto en el eje Y
@@ -740,11 +801,11 @@ void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool gre
item_t temp; item_t temp;
if (item.empty()) if (item.empty())
{// Si es el primer item coge la posición en el eje Y del propio menu { // Si es el primer item coge la posición en el eje Y del propio menu
temp.rect.y = y; temp.rect.y = y;
} }
else else
{// En caso contrario, coge la posición en el eje Y a partir del último elemento { // En caso contrario, coge la posición en el eje Y a partir del último elemento
temp.rect.y = item.back().rect.y + item.back().rect.h + item.back().hPaddingDown; temp.rect.y = item.back().rect.y + item.back().rect.h + item.back().hPaddingDown;
} }
@@ -777,9 +838,6 @@ void Menu::setItemCaption(int index, std::string text)
item.at(index).rect.w = this->text->lenght(item.at(index).label); item.at(index).rect.w = this->text->lenght(item.at(index).label);
item.at(index).rect.h = this->text->getCharacterSize(); item.at(index).rect.h = this->text->getCharacterSize();
reorganize(); reorganize();
const std::string t = item.at(index).label + ":" + std::to_string(item.at(index).rect.w);
printf("Adding menu item -> %s\n", t.c_str());
} }
// Establece el indice del itemm que se usará por defecto al cancelar el menu // Establece el indice del itemm que se usará por defecto al cancelar el menu
@@ -855,42 +913,42 @@ int Menu::findHeight()
// Recoloca los elementos del menu en el eje Y // Recoloca los elementos del menu en el eje Y
void Menu::replaceElementsOnY() void Menu::replaceElementsOnY()
{ {
item[0].rect.y = y; item.at(0).rect.y = y;
for (int i = 1; i < (int)item.size(); i++) for (int i = 1; i < (int)item.size(); i++)
{ {
item[i].rect.y = item[i - 1].rect.y + item[i - 1].rect.h + item[i - 1].hPaddingDown; item.at(i).rect.y = item.at(i - 1).rect.y + item.at(i - 1).rect.h + item.at(i - 1).hPaddingDown;
} }
} }
// Establece el estado seleccionable de un item // Establece el estado seleccionable de un item
void Menu::setSelectable(int index, bool value) void Menu::setSelectable(int index, bool value)
{ {
item[index].selectable = value; item.at(index).selectable = value;
} }
// Establece el estado agrisado de un item // Establece el estado agrisado de un item
void Menu::setGreyed(int index, bool value) void Menu::setGreyed(int index, bool value)
{ {
item[index].greyed = value; item.at(index).greyed = value;
} }
// Establece el estado de enlace de un item // Establece el estado de enlace de un item
void Menu::setLinkedDown(int index, bool value) void Menu::setLinkedDown(int index, bool value)
{ {
item[index].linkedDown = value; item.at(index).linkedDown = value;
} }
// Calcula la altura del selector // Calcula la altura del selector
int Menu::getSelectorHeight(int value) int Menu::getSelectorHeight(int value)
{ {
if (item[value].linkedDown) if (item.at(value).linkedDown)
{ {
return item[value].rect.h + item[value].hPaddingDown + item[value + 1].rect.h; return item.at(value).rect.h + item.at(value).hPaddingDown + item.at(value + 1).rect.h;
} }
else else
{ {
return item[value].rect.h; return item.at(value).rect.h;
} }
} }

View File

@@ -1,15 +1,15 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <vector>
#include "sprite.h"
#include "text.h"
#include "asset.h" #include "asset.h"
#include "input.h" #include "input.h"
#include "utils.h"
#include "jail_audio.h" #include "jail_audio.h"
#include <sstream> #include "sprite.h"
#include "text.h"
#include "utils.h"
#include <fstream> #include <fstream>
#include <sstream>
#include <vector>
#ifndef MENU_H #ifndef MENU_H
#define MENU_H #define MENU_H
@@ -68,6 +68,13 @@ private:
int a; // Cantidad de transparencia para el rectangulo del selector int a; // Cantidad de transparencia para el rectangulo del selector
}; };
// Objetos y punteros
SDL_Renderer *renderer; // Puntero al renderizador de la ventana
Text *text; // Texto para poder escribir los items del menu
Input *input; // Gestor de eventos de entrada de teclado o gamepad
Asset *asset; // Objeto para gestionar los ficheros de recursos
// Variables
std::string name; // Nombre del menu std::string name; // Nombre del menu
int x; // Posición en el eje X de la primera letra del primer elemento int x; // Posición en el eje X de la primera letra del primer elemento
int y; // Posición en el eje Y de la primera letra del primer elemento int y; // Posición en el eje Y de la primera letra del primer elemento
@@ -85,10 +92,6 @@ private:
JA_Sound soundAccept; // Sonido al aceptar o elegir una opción del menu JA_Sound soundAccept; // Sonido al aceptar o elegir una opción del menu
JA_Sound soundCancel; // Sonido al cancelar el menu JA_Sound soundCancel; // Sonido al cancelar el menu
JA_Sound soundMove; // Sonido al mover el selector JA_Sound soundMove; // Sonido al mover el selector
SDL_Renderer *renderer; // Puntero al renderizador de la ventana
Text *text; // Texto para poder escribir los items del menu
Input *input; // Gestor de eventos de entrada de teclado o gamepad
Asset *asset; // Objeto para gestionar los ficheros de recursos
color_t colorGreyed; // Color para los elementos agrisados color_t colorGreyed; // Color para los elementos agrisados
rectangle_t rectBG; // Rectangulo de fondo del menu rectangle_t rectBG; // Rectangulo de fondo del menu
std::vector<item_t> item; // Estructura para cada elemento del menu std::vector<item_t> item; // Estructura para cada elemento del menu
@@ -105,12 +108,6 @@ private:
// Asigna variables a partir de dos cadenas // Asigna variables a partir de dos cadenas
bool setItem(item_t *item, std::string var, std::string value); bool setItem(item_t *item, std::string var, std::string value);
// Inicializa las variables
void init();
// Establece el rectangulo de fondo del menu
void setRectSize();
// Actualiza el menu para recolocarlo correctamente y establecer el tamaño // Actualiza el menu para recolocarlo correctamente y establecer el tamaño
void reorganize(); void reorganize();
@@ -143,7 +140,7 @@ private:
public: public:
// Constructor // Constructor
Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file=""); Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file = "");
// Destructor // Destructor
~Menu(); ~Menu();
@@ -179,7 +176,7 @@ public:
void setSelectorTextColor(color_t color); void setSelectorTextColor(color_t color);
// Centra el menu respecto a un punto en el eje X // Centra el menu respecto a un punto en el eje X
void centerMenuOnX(int value); void centerMenuOnX(int value = 0);
// Centra el menu respecto a un punto en el eje Y // Centra el menu respecto a un punto en el eje Y
void centerMenuOnY(int value); void centerMenuOnY(int value);
@@ -219,6 +216,9 @@ public:
// Establece la fuente de texto que se utilizará // Establece la fuente de texto que se utilizará
void setText(std::string font_png, std::string font_txt); void setText(std::string font_png, std::string font_txt);
// Establece el rectangulo de fondo del menu
void setRectSize(int w = 0, int h = 0);
}; };
#endif #endif

View File

@@ -1,8 +1,7 @@
#include "const.h"
#include "movingsprite.h" #include "movingsprite.h"
// Constructor // Constructor
MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, LTexture *texture, SDL_Renderer *renderer) MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, Texture *texture, SDL_Renderer *renderer)
{ {
// Copia los punteros // Copia los punteros
this->texture = texture; this->texture = texture;
@@ -45,17 +44,12 @@ MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vel
spriteClip = {0, 0, w, h}; spriteClip = {0, 0, w, h};
// Establece el centro de rotación // Establece el centro de rotación
center = {0, 0}; center = nullptr;
// Establece el tipo de volteado // Establece el tipo de volteado
currentFlip = SDL_FLIP_NONE; currentFlip = SDL_FLIP_NONE;
}; };
// Destructor
MovingSprite::~MovingSprite()
{
}
// Reinicia todas las variables // Reinicia todas las variables
void MovingSprite::clear() void MovingSprite::clear()
{ {
@@ -73,7 +67,7 @@ void MovingSprite::clear()
angle = 0.0; // Angulo para dibujarlo angle = 0.0; // Angulo para dibujarlo
rotateEnabled = false; // Indica si ha de rotar rotateEnabled = false; // Indica si ha de rotar
center = {0, 0}; // Centro de rotación center = nullptr; // Centro de rotación
rotateSpeed = 0; // Velocidad de giro rotateSpeed = 0; // Velocidad de giro
rotateAmount = 0.0; // Cantidad de grados a girar en cada iteración rotateAmount = 0.0; // Cantidad de grados a girar en cada iteración
counter = 0; // Contador interno counter = 0; // Contador interno
@@ -101,7 +95,9 @@ void MovingSprite::move()
void MovingSprite::render() void MovingSprite::render()
{ {
if (enabled) if (enabled)
texture->render(renderer, (int)x, (int)y, &spriteClip, zoomW, zoomH, angle, &center, currentFlip); {
texture->render(renderer, (int)x, (int)y, &spriteClip, zoomW, zoomH, angle, center, currentFlip);
}
} }
// Obtiene el valor de la variable // Obtiene el valor de la variable
@@ -158,11 +154,13 @@ double MovingSprite::getAngle()
return angle; return angle;
} }
// Establece la posición del objeto // Establece la posición y el tamaño del objeto
void MovingSprite::setPos(SDL_Rect rect) void MovingSprite::setRect(SDL_Rect rect)
{ {
x = (float)rect.x; x = (float)rect.x;
y = (float)rect.y; y = (float)rect.y;
w = rect.w;
h = rect.h;
} }
// Establece el valor de la variable // Establece el valor de la variable
@@ -265,7 +263,14 @@ void MovingSprite::setRotate(bool value)
// Establece el valor de la variable // Establece el valor de la variable
void MovingSprite::setRotateSpeed(int value) void MovingSprite::setRotateSpeed(int value)
{ {
rotateSpeed = value; if (value < 1)
{
rotateSpeed = 1;
}
else
{
rotateSpeed = value;
}
} }
// Establece el valor de la variable // Establece el valor de la variable
@@ -324,15 +329,6 @@ SDL_Rect MovingSprite::getRect()
return rect; return rect;
} }
// Establece los valores de posición y tamaño del sprite
void MovingSprite::setRect(SDL_Rect rect)
{
x = (float)rect.x;
y = (float)rect.y;
w = rect.w;
h = rect.h;
}
// Deshace el último movimiento // Deshace el último movimiento
void MovingSprite::undoMove() void MovingSprite::undoMove()
{ {

View File

@@ -30,15 +30,12 @@ protected:
int rotateSpeed; // Velocidad de giro int rotateSpeed; // Velocidad de giro
double rotateAmount; // Cantidad de grados a girar en cada iteración double rotateAmount; // Cantidad de grados a girar en cada iteración
int counter; // Contador interno int counter; // Contador interno
SDL_Point center; // Centro de rotación SDL_Point *center; // Centro de rotación
SDL_RendererFlip currentFlip; // Indica como se voltea el sprite SDL_RendererFlip currentFlip; // Indica como se voltea el sprite
public: public:
// Constructor // Constructor
MovingSprite(float x = 0, float y = 0, int w = 0, int h = 0, float velx = 0, float vely = 0, float accelx = 0, float accely = 0, LTexture *texture = nullptr, SDL_Renderer *renderer = nullptr); MovingSprite(float x = 0, float y = 0, int w = 0, int h = 0, float velx = 0, float vely = 0, float accelx = 0, float accely = 0, Texture *texture = nullptr, SDL_Renderer *renderer = nullptr);
// Destructor
~MovingSprite();
// Mueve el sprite // Mueve el sprite
void move(); void move();
@@ -88,8 +85,8 @@ public:
// Obtiene el valor de la variable // Obtiene el valor de la variable
Uint16 getRotateSpeed(); Uint16 getRotateSpeed();
// Establece la posición del objeto // Establece la posición y el tamaño del objeto
void setPos(SDL_Rect rect); void setRect(SDL_Rect rect);
// Establece el valor de la variable // Establece el valor de la variable
void setPosX(float value); void setPosX(float value);
@@ -151,9 +148,6 @@ public:
// Devuelve el rectangulo donde está el sprite // Devuelve el rectangulo donde está el sprite
SDL_Rect getRect(); SDL_Rect getRect();
// Establece los valores de posición y tamaño del sprite
void setRect(SDL_Rect rect);
// Deshace el último movimiento // Deshace el último movimiento
void undoMove(); void undoMove();

View File

@@ -21,8 +21,10 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, i
// Crea la textura donde se dibujan los graficos del juego // Crea la textura donde se dibujan los graficos del juego
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight); gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
if (gameCanvas == NULL) if (gameCanvas == nullptr)
{
printf("TitleSurface could not be created!\nSDL Error: %s\n", SDL_GetError()); printf("TitleSurface could not be created!\nSDL Error: %s\n", SDL_GetError());
}
// Establece el modo de video // Establece el modo de video
setVideoMode(options->fullScreenMode); setVideoMode(options->fullScreenMode);
@@ -59,14 +61,14 @@ void Screen::start()
void Screen::blit() void Screen::blit()
{ {
// Vuelve a dejar el renderizador en modo normal // Vuelve a dejar el renderizador en modo normal
SDL_SetRenderTarget(renderer, NULL); SDL_SetRenderTarget(renderer, nullptr);
// Borra el contenido previo // Borra el contenido previo
SDL_SetRenderDrawColor(renderer, borderColor.r, borderColor.g, borderColor.b, 0xFF); SDL_SetRenderDrawColor(renderer, borderColor.r, borderColor.g, borderColor.b, 0xFF);
SDL_RenderClear(renderer); SDL_RenderClear(renderer);
// Copia la textura de juego en el renderizador en la posición adecuada // Copia la textura de juego en el renderizador en la posición adecuada
SDL_RenderCopy(renderer, gameCanvas, NULL, &dest); SDL_RenderCopy(renderer, gameCanvas, nullptr, &dest);
// Muestra por pantalla el renderizador // Muestra por pantalla el renderizador
SDL_RenderPresent(renderer); SDL_RenderPresent(renderer);

View File

@@ -1,14 +1,19 @@
#include "const.h"
#include "smartsprite.h" #include "smartsprite.h"
// Constructor // Constructor
SmartSprite::SmartSprite(LTexture *texture, SDL_Renderer *renderer) SmartSprite::SmartSprite(Texture *texture, SDL_Renderer *renderer)
{ {
// Copia punteros // Copia punteros
setTexture(texture); setTexture(texture);
setRenderer(renderer); setRenderer(renderer);
// Inicializa variables // Inicializa el objeto
init();
}
// Inicializa el objeto
void SmartSprite::init()
{
enabled = false; enabled = false;
enabledCounter = 0; enabledCounter = 0;
onDestination = false; onDestination = false;
@@ -18,11 +23,6 @@ SmartSprite::SmartSprite(LTexture *texture, SDL_Renderer *renderer)
finished = false; finished = false;
} }
// Destructor
SmartSprite::~SmartSprite()
{
}
// Actualiza la posición y comprueba si ha llegado a su destino // Actualiza la posición y comprueba si ha llegado a su destino
void SmartSprite::update() void SmartSprite::update()
{ {

View File

@@ -12,7 +12,7 @@
class SmartSprite : public AnimatedSprite class SmartSprite : public AnimatedSprite
{ {
private: private:
// VAriables // Variables
bool enabled; // Indica si esta habilitado bool enabled; // Indica si esta habilitado
bool onDestination; // Indica si está en el destino bool onDestination; // Indica si está en el destino
int destX; // Posicion de destino en el eje X int destX; // Posicion de destino en el eje X
@@ -28,10 +28,10 @@ private:
public: public:
// Constructor // Constructor
SmartSprite(LTexture *texture, SDL_Renderer *renderer); SmartSprite(Texture *texture, SDL_Renderer *renderer);
// Destructor // Inicializa el objeto
~SmartSprite(); void init();
// Actualiza la posición y comprueba si ha llegado a su destino // Actualiza la posición y comprueba si ha llegado a su destino
void update(); void update();

View File

@@ -1,7 +1,7 @@
#include "sprite.h" #include "sprite.h"
// Constructor // Constructor
Sprite::Sprite(int x, int y, int w, int h, LTexture *texture, SDL_Renderer *renderer) Sprite::Sprite(int x, int y, int w, int h, Texture *texture, SDL_Renderer *renderer)
{ {
// Establece la posición X,Y del sprite // Establece la posición X,Y del sprite
this->x = x; this->x = x;
@@ -18,13 +18,13 @@ Sprite::Sprite(int x, int y, int w, int h, LTexture *texture, SDL_Renderer *rend
this->texture = texture; this->texture = texture;
// Establece el rectangulo de donde coger la imagen // Establece el rectangulo de donde coger la imagen
spriteClip = {x, y, w, h}; spriteClip = {0, 0, w, h};
// Inicializa variables // Inicializa variables
enabled = true; enabled = true;
} }
Sprite::Sprite(SDL_Rect rect, LTexture *texture, SDL_Renderer *renderer) Sprite::Sprite(SDL_Rect rect, Texture *texture, SDL_Renderer *renderer)
{ {
// Establece la posición X,Y del sprite // Establece la posición X,Y del sprite
x = rect.x; x = rect.x;
@@ -41,7 +41,7 @@ Sprite::Sprite(SDL_Rect rect, LTexture *texture, SDL_Renderer *renderer)
this->texture = texture; this->texture = texture;
// Establece el rectangulo de donde coger la imagen // Establece el rectangulo de donde coger la imagen
spriteClip = {x, y, w, h}; spriteClip = {0, 0, w, h};
// Inicializa variables // Inicializa variables
enabled = true; enabled = true;
@@ -137,17 +137,23 @@ void Sprite::setSpriteClip(int x, int y, int w, int h)
} }
// Obten el valor de la variable // Obten el valor de la variable
LTexture *Sprite::getTexture() Texture *Sprite::getTexture()
{ {
return texture; return texture;
} }
// Establece el valor de la variable // Establece el valor de la variable
void Sprite::setTexture(LTexture *texture) void Sprite::setTexture(Texture *texture)
{ {
this->texture = texture; this->texture = texture;
} }
// Obten el valor de la variable
SDL_Renderer *Sprite::getRenderer()
{
return renderer;
}
// Establece el valor de la variable // Establece el valor de la variable
void Sprite::setRenderer(SDL_Renderer *renderer) void Sprite::setRenderer(SDL_Renderer *renderer)
{ {

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "ltexture.h" #include "texture.h"
#ifndef SPRITE_H #ifndef SPRITE_H
#define SPRITE_H #define SPRITE_H
@@ -16,15 +16,15 @@ protected:
int h; // Alto del sprite int h; // Alto del sprite
SDL_Renderer *renderer; // Puntero al renderizador de la ventana SDL_Renderer *renderer; // Puntero al renderizador de la ventana
LTexture *texture; // Textura donde estan todos los dibujos del sprite Texture *texture; // Textura donde estan todos los dibujos del sprite
SDL_Rect spriteClip; // Rectangulo de origen de la textura que se dibujará en pantalla SDL_Rect spriteClip; // Rectangulo de origen de la textura que se dibujará en pantalla
bool enabled; // Indica si el sprite esta habilitado bool enabled; // Indica si el sprite esta habilitado
public: public:
// Constructor // Constructor
Sprite(int x = 0, int y = 0, int w = 0, int h = 0, LTexture *texture = nullptr, SDL_Renderer *renderer = nullptr); Sprite(int x = 0, int y = 0, int w = 0, int h = 0, Texture *texture = nullptr, SDL_Renderer *renderer = nullptr);
Sprite(SDL_Rect rect, LTexture *texture, SDL_Renderer *renderer); Sprite(SDL_Rect rect, Texture *texture, SDL_Renderer *renderer);
// Destructor // Destructor
~Sprite(); ~Sprite();
@@ -69,10 +69,13 @@ public:
void setSpriteClip(int x, int y, int w, int h); void setSpriteClip(int x, int y, int w, int h);
// Obten el valor de la variable // Obten el valor de la variable
LTexture *getTexture(); Texture *getTexture();
// Establece el valor de la variable // Establece el valor de la variable
void setTexture(LTexture *texture); void setTexture(Texture *texture);
// Obten el valor de la variable
SDL_Renderer *getRenderer();
// Establece el valor de la variable // Establece el valor de la variable
void setRenderer(SDL_Renderer *renderer); void setRenderer(SDL_Renderer *renderer);

View File

@@ -10,7 +10,7 @@ Text::Text(std::string bitmapFile, std::string textFile, SDL_Renderer *renderer)
initOffsetFromFile(textFile); initOffsetFromFile(textFile);
// Crea los objetos // Crea los objetos
texture = new LTexture(renderer, bitmapFile); texture = new Texture(renderer, bitmapFile);
sprite = new Sprite({0, 0, boxWidth, boxHeight}, texture, renderer); sprite = new Sprite({0, 0, boxWidth, boxHeight}, texture, renderer);
} }
@@ -143,7 +143,9 @@ void Text::initOffsetFromFile(std::string file)
{ {
// Almacena solo las lineas impares // Almacena solo las lineas impares
if (line_read % 2 == 1) if (line_read % 2 == 1)
{
offset[index++].w = std::stoi(buffer); offset[index++].w = std::stoi(buffer);
}
// Limpia el buffer // Limpia el buffer
buffer.clear(); buffer.clear();
@@ -151,7 +153,7 @@ void Text::initOffsetFromFile(std::string file)
}; };
// Cierra el fichero // Cierra el fichero
printf("Text loaded: %s\n\n", filename.c_str()); printf("Text loaded: %s\n", filename.c_str());
rfile.close(); rfile.close();
} }

View File

@@ -22,9 +22,9 @@ private:
int w; int w;
}; };
// Objetos // Objetos y punteros
Sprite *sprite; // Objeto con los graficos para el texto Sprite *sprite; // Objeto con los graficos para el texto
LTexture *texture; // Textura con los bitmaps del texto Texture *texture; // Textura con los bitmaps del texto
// Variables // Variables
int boxWidth; // Anchura de la caja de cada caracter en el png int boxWidth; // Anchura de la caja de cada caracter en el png

View File

@@ -1,10 +1,10 @@
#include "ltexture.h" #include "texture.h"
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"
// Constructor // Constructor
LTexture::LTexture(SDL_Renderer *renderer, std::string path) Texture::Texture(SDL_Renderer *renderer, std::string path)
{ {
// Copia punteros // Copia punteros
this->renderer = renderer; this->renderer = renderer;
@@ -23,14 +23,14 @@ LTexture::LTexture(SDL_Renderer *renderer, std::string path)
} }
// Destructor // Destructor
LTexture::~LTexture() Texture::~Texture()
{ {
// Libera memoria // Libera memoria
unload(); unload();
} }
// Carga una imagen desde un fichero // Carga una imagen desde un fichero
bool LTexture::loadFromFile(std::string path, SDL_Renderer *renderer) bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer)
{ {
const std::string filename = path.substr(path.find_last_of("\\/") + 1); const std::string filename = path.substr(path.find_last_of("\\/") + 1);
int req_format = STBI_rgb_alpha; int req_format = STBI_rgb_alpha;
@@ -98,7 +98,7 @@ bool LTexture::loadFromFile(std::string path, SDL_Renderer *renderer)
} }
// Crea una textura en blanco // Crea una textura en blanco
bool LTexture::createBlank(SDL_Renderer *renderer, int width, int height, SDL_TextureAccess access) bool Texture::createBlank(SDL_Renderer *renderer, int width, int height, SDL_TextureAccess access)
{ {
// Crea una textura sin inicializar // Crea una textura sin inicializar
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, access, width, height); texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, access, width, height);
@@ -116,7 +116,7 @@ bool LTexture::createBlank(SDL_Renderer *renderer, int width, int height, SDL_Te
} }
// Libera la memoria de la textura // Libera la memoria de la textura
void LTexture::unload() void Texture::unload()
{ {
// Libera la textura si existe // Libera la textura si existe
if (texture != nullptr) if (texture != nullptr)
@@ -129,27 +129,27 @@ void LTexture::unload()
} }
// Establece el color para la modulacion // Establece el color para la modulacion
void LTexture::setColor(Uint8 red, Uint8 green, Uint8 blue) void Texture::setColor(Uint8 red, Uint8 green, Uint8 blue)
{ {
SDL_SetTextureColorMod(texture, red, green, blue); SDL_SetTextureColorMod(texture, red, green, blue);
} }
// Establece el blending // Establece el blending
void LTexture::setBlendMode(SDL_BlendMode blending) void Texture::setBlendMode(SDL_BlendMode blending)
{ {
SDL_SetTextureBlendMode(texture, blending); SDL_SetTextureBlendMode(texture, blending);
} }
// Establece el alpha para la modulación // Establece el alpha para la modulación
void LTexture::setAlpha(Uint8 alpha) void Texture::setAlpha(Uint8 alpha)
{ {
SDL_SetTextureAlphaMod(texture, alpha); SDL_SetTextureAlphaMod(texture, alpha);
} }
// Renderiza la textura en un punto específico // Renderiza la textura en un punto específico
void LTexture::render(SDL_Renderer *renderer, int x, int y, SDL_Rect *clip, float zoomW, float zoomH, double angle, SDL_Point *center, SDL_RendererFlip flip) void Texture::render(SDL_Renderer *renderer, int x, int y, SDL_Rect *clip, float zoomW, float zoomH, double angle, SDL_Point *center, SDL_RendererFlip flip)
{ {
// Establece el destini de renderizado en la pantalla // Establece el destino de renderizado en la pantalla
SDL_Rect renderQuad = {x, y, width, height}; SDL_Rect renderQuad = {x, y, width, height};
// Obtiene las dimesiones del clip de renderizado // Obtiene las dimesiones del clip de renderizado
@@ -167,25 +167,25 @@ void LTexture::render(SDL_Renderer *renderer, int x, int y, SDL_Rect *clip, floa
} }
// Establece la textura como objetivo de renderizado // Establece la textura como objetivo de renderizado
void LTexture::setAsRenderTarget(SDL_Renderer *renderer) void Texture::setAsRenderTarget(SDL_Renderer *renderer)
{ {
SDL_SetRenderTarget(renderer, texture); SDL_SetRenderTarget(renderer, texture);
} }
// Obtiene el ancho de la imagen // Obtiene el ancho de la imagen
int LTexture::getWidth() int Texture::getWidth()
{ {
return width; return width;
} }
// Obtiene el alto de la imagen // Obtiene el alto de la imagen
int LTexture::getHeight() int Texture::getHeight()
{ {
return height; return height;
} }
// Recarga la textura // Recarga la textura
bool LTexture::reLoad() bool Texture::reLoad()
{ {
return loadFromFile(path, renderer); return loadFromFile(path, renderer);
} }

View File

@@ -4,25 +4,27 @@
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#ifndef LTEXTURE_H #ifndef TEXTURE_H
#define LTEXTURE_H #define TEXTURE_H
// Clase LTexture class Texture
class LTexture
{ {
private: private:
// Objetos y punteros
SDL_Texture *texture; // La textura SDL_Texture *texture; // La textura
SDL_Renderer *renderer; // Renderizador donde dibujar la textura SDL_Renderer *renderer; // Renderizador donde dibujar la textura
int width; // Ancho de la imagen
int height; // Alto de la imagen // Variables
std::string path; // Ruta de la imagen de la textura int width; // Ancho de la imagen
int height; // Alto de la imagen
std::string path; // Ruta de la imagen de la textura
public: public:
// Constructor // Constructor
LTexture(SDL_Renderer *renderer, std::string path = ""); Texture(SDL_Renderer *renderer, std::string path = "");
// Destructor // Destructor
~LTexture(); ~Texture();
// Carga una imagen desde un fichero // Carga una imagen desde un fichero
bool loadFromFile(std::string path, SDL_Renderer *renderer); bool loadFromFile(std::string path, SDL_Renderer *renderer);

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "ltexture.h" #include "texture.h"
#include <string> #include <string>
#include <vector> #include <vector>
@@ -87,6 +87,7 @@ struct input_t
struct options_t struct options_t
{ {
Uint8 difficulty; // Dificultad del juego Uint8 difficulty; // Dificultad del juego
Uint8 playerSelected; // Jugador seleccionado para el modo 1P
std::vector<input_t> input; // Modo de control (teclado o mando) std::vector<input_t> input; // Modo de control (teclado o mando)
Uint8 language; // Idioma usado en el juego Uint8 language; // Idioma usado en el juego
Uint32 fullScreenMode; // Contiene el valor del modo de pantalla completa Uint32 fullScreenMode; // Contiene el valor del modo de pantalla completa

Some files were not shown because too many files have changed in this diff Show More