nous grafics

This commit is contained in:
2024-07-25 22:09:24 +02:00
parent 18eab9fe0d
commit 98caefb085
13 changed files with 81 additions and 14 deletions

View File

@@ -18,8 +18,10 @@ scoreboard.w 320
scoreboard.h 40
# TITLE
pressStart 160
pressStart 170
titleCounter 800
arcadeEdition 123
titleCC 80
# BACKGROUND
backgroundAttenuateColor.r 255

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -223,3 +223,42 @@ hiScoreEntry_t sortHiScoreTable(hiScoreEntry_t entry1, hiScoreEntry_t entry2)
return entry2;
}
// Dibuja un circulo
void DrawCircle(SDL_Renderer * renderer, int32_t centerX, int32_t centerY, int32_t radius)
{
const int32_t diameter = (radius * 2);
int32_t x = (radius - 1);
int32_t y = 0;
int32_t tx = 1;
int32_t ty = 1;
int32_t error = (tx - diameter);
while (x >= y)
{
// Each of the following renders an octant of the circle
SDL_RenderDrawPoint(renderer, centerX + x, centerY - y);
SDL_RenderDrawPoint(renderer, centerX + x, centerY + y);
SDL_RenderDrawPoint(renderer, centerX - x, centerY - y);
SDL_RenderDrawPoint(renderer, centerX - x, centerY + y);
SDL_RenderDrawPoint(renderer, centerX + y, centerY - x);
SDL_RenderDrawPoint(renderer, centerX + y, centerY + x);
SDL_RenderDrawPoint(renderer, centerX - y, centerY - x);
SDL_RenderDrawPoint(renderer, centerX - y, centerY + x);
if (error <= 0)
{
++y;
error += ty;
ty += 2;
}
if (error > 0)
{
--x;
tx += 2;
error += (tx - diameter);
}
}
}

View File

@@ -194,8 +194,10 @@ struct param_t
SDL_Rect scoreboard; // Posición y tamaño del marcador
// TITLE
int pressStart; // Posición del texto para empezar a jugar
int titleCounter; // Tiempo de inactividad del titulo
int pressStart; // Posición del texto para empezar a jugar
int titleCounter; // Tiempo de inactividad del titulo
int arcadeEdition; // Posición del bitmap
int titleCC; // Posición del bitmap
// BACKGROUND
color_t backgroundAttenuateColor;
@@ -249,4 +251,7 @@ JA_Music_t *getMusic(std::vector<music_file_t> music, std::string name);
// Ordena las entradas de la tabla de records
hiScoreEntry_t sortHiScoreTable(hiScoreEntry_t entry1, hiScoreEntry_t entry2);
// Dibuja un circulo
void DrawCircle(SDL_Renderer *renderer, int32_t centerX, int32_t centerY, int32_t radius);
#endif

View File

@@ -360,6 +360,7 @@ bool Director::setFileList()
asset->add(prefix + "/data/gfx/title_bg_tile.png", t_bitmap);
asset->add(prefix + "/data/gfx/title_coffee.png", t_bitmap);
asset->add(prefix + "/data/gfx/title_crisis.png", t_bitmap);
asset->add(prefix + "/data/gfx/title_arcade_edition.png", t_bitmap);
asset->add(prefix + "/data/gfx/title_dust.png", t_bitmap);
asset->add(prefix + "/data/gfx/title_dust.ani", t_data);

View File

@@ -15,9 +15,11 @@ GameLogo::GameLogo(SDL_Renderer *renderer, Screen *screen, Asset *asset, param_t
dustTexture = new Texture(renderer, asset->get("title_dust.png"));
coffeeTexture = new Texture(renderer, asset->get("title_coffee.png"));
crisisTexture = new Texture(renderer, asset->get("title_crisis.png"));
arcadeEditionTexture = new Texture(renderer, asset->get("title_arcade_edition.png"));
coffeeBitmap = new SmartSprite(coffeeTexture, renderer);
crisisBitmap = new SmartSprite(crisisTexture, renderer);
arcadeEditionBitmap = new Sprite((param->gameWidth - arcadeEditionTexture->getWidth()) / 2, param->arcadeEdition, arcadeEditionTexture->getWidth(), arcadeEditionTexture->getHeight(), arcadeEditionTexture, renderer);
dustBitmapL = new AnimatedSprite(dustTexture, renderer, asset->get("title_dust.ani"));
dustBitmapR = new AnimatedSprite(dustTexture, renderer, asset->get("title_dust.ani"));
@@ -31,17 +33,14 @@ GameLogo::GameLogo(SDL_Renderer *renderer, Screen *screen, Asset *asset, param_t
// Destructor
GameLogo::~GameLogo()
{
dustTexture->unload();
delete dustTexture;
coffeeTexture->unload();
delete coffeeTexture;
crisisTexture->unload();
delete crisisTexture;
delete arcadeEditionTexture;
delete coffeeBitmap;
delete crisisBitmap;
delete arcadeEditionBitmap;
delete dustBitmapL;
delete dustBitmapR;
@@ -117,6 +116,9 @@ void GameLogo::render()
coffeeBitmap->render();
crisisBitmap->render();
if (status == finished)
arcadeEditionBitmap->render();
// Dibuja el polvillo del logo
dustBitmapR->render();
dustBitmapL->render();

View File

@@ -19,15 +19,18 @@ private:
Screen *screen; // Objeto encargado de dibujar en pantalla
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
Texture *dustTexture; // Textura con los graficos del polvo
Texture *coffeeTexture; // Textura con los graficos de la palabra coffee
Texture *crisisTexture; // Textura con los graficos de la plabra crisis
Texture *dustTexture; // Textura con los graficos del polvo
Texture *coffeeTexture; // Textura con los graficos de la palabra "COFFEE"
Texture *crisisTexture; // Textura con los graficos de la plabra "CRISIS"
Texture *arcadeEditionTexture; // Textura con los graficos de "Arcade Edition"
AnimatedSprite *dustBitmapL; // Sprite con la el polvo que aparece al colisionar el texto de la pantalla de titulo
AnimatedSprite *dustBitmapR; // Sprite con la el polvo que aparece al colisionar el texto de la pantalla de titulo
SmartSprite *coffeeBitmap; // Sprite con la palabra COFFEE para la pantalla de titulo
SmartSprite *crisisBitmap; // Sprite con la palabra CRISIS para la pantalla de titulo
SmartSprite *coffeeBitmap; // Sprite con la palabra "COFFEE" para la pantalla de titulo
SmartSprite *crisisBitmap; // Sprite con la palabra "CRISIS" para la pantalla de titulo
Sprite *arcadeEditionBitmap; // Sprite con los graficos de "Arcade Edition"
JA_Sound_t *crashSound; // Sonido con el impacto del título
param_t *param; // Puntero con todos los parametros del programa

View File

@@ -27,6 +27,8 @@ void initParam(param_t *param)
// TITLE
param->pressStart = 160;
param->titleCounter = 800;
param->arcadeEdition = 123;
param->titleCC = 11;
// BACKGROUND
param->backgroundAttenuateColor = {255, 255, 255};
@@ -205,6 +207,16 @@ bool setOptions(param_t *param, std::string var, std::string value)
param->titleCounter = std::stoi(value);
}
else if (var == "arcadeEdition")
{
param->arcadeEdition = std::stoi(value);
}
else if (var == "titleCC")
{
param->titleCC = std::stoi(value);
}
// BACKGROUND
else if (var == "backgroundAttenuateColor.r")
{

View File

@@ -161,6 +161,9 @@ void Player::render()
}
playerSprite->render();
//SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
//DrawCircle(renderer, collider.x, collider.y, collider.r);
}
// Establece el estado del jugador cuando camina

View File

@@ -33,7 +33,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
tiledbg = new Tiledbg(renderer, screen, asset, {0, 0, param->gameWidth, param->gameHeight}, TILED_MODE_RANDOM);
gameLogo = new GameLogo(renderer, screen, asset, param, GAMECANVAS_CENTER_X, GAMECANVAS_FIRST_QUARTER_Y + 20);
gameLogo = new GameLogo(renderer, screen, asset, param, GAMECANVAS_CENTER_X, param->titleCC);
gameLogo->enable();
defineButtons = new DefineButtons(renderer, input, text2, param, options, section);