gong & theme
This commit is contained in:
parent
797047caf7
commit
339b363b24
2
makefile
2
makefile
@ -3,7 +3,7 @@ CFLAGS=-Wall -g -std=c99 -c
|
||||
#-lm `sdl-config --cflags --libs` -lSDL_ttf
|
||||
LDFLAGS=-std=c99 -lm `sdl-config --cflags --libs` -lSDL_ttf -lSDL_gfx -lSDL_mixer
|
||||
EXEC=bin/hex
|
||||
SRC=src/hex.c src/affichage_plateau.c src/action_plateau.c src/affichage_menu_principal.c src/window.c src/param.c src/en_jeu.c src/menu_principal.c src/draw.c src/action_menu_principal.c
|
||||
SRC=src/hex.c src/affichage_plateau.c src/action_plateau.c src/affichage_menu_principal.c src/window.c src/param.c src/en_jeu.c src/menu_principal.c src/draw.c src/action_menu_principal.c src/sound.c
|
||||
#$(wildcard src/*.c)
|
||||
OBJ=$(SRC:.c=.o)
|
||||
|
||||
|
Binary file not shown.
BIN
ressources/Gong.wav
Normal file
BIN
ressources/Gong.wav
Normal file
Binary file not shown.
@ -10,7 +10,7 @@
|
||||
#include <math.h>
|
||||
#include "globals.h"
|
||||
#include "affichage_menu_principal.h"
|
||||
#include "param.h"
|
||||
#include "sound.h"
|
||||
|
||||
void deplacement_menu (menu_t m, SDL_Event* event)
|
||||
{
|
||||
@ -79,7 +79,7 @@ void deplacement_menu (menu_t m, SDL_Event* event)
|
||||
m->cur.x = hex.x;
|
||||
m->cur.y = hex.y;
|
||||
Affiche_entry(m, entries [hex.x][hex.y], POINTE);
|
||||
Mix_PlayMusic (param->click, 1);
|
||||
play_clik();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -121,7 +121,7 @@ void deplacement_menu (menu_t m, SDL_Event* event)
|
||||
if (m->cur.y < 0)
|
||||
m->cur.y = 2;
|
||||
Affiche_entry(m, entries [m->cur.x][m->cur.y], POINTE);
|
||||
Mix_PlayMusic (param->click, 1);
|
||||
play_clik();
|
||||
SDL_Delay (200);
|
||||
}
|
||||
break;
|
||||
@ -137,6 +137,7 @@ bool selection_menu (menu_t m, int* r)
|
||||
return false;
|
||||
case 10:
|
||||
*r = M_JOUER;
|
||||
play_gong();
|
||||
return true;
|
||||
case 11:
|
||||
*r = M_HEX;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "affichage_plateau.h"
|
||||
#include "globals.h"
|
||||
#include "param.h"
|
||||
#include "sound.h"
|
||||
|
||||
void selection (plateau_t p, curseur_t c)
|
||||
{
|
||||
@ -90,7 +90,7 @@ void deplacement (plateau_t p, SDL_Event* event, curseur_t* c)
|
||||
if (0 <= hex.x && hex.x < NBSIDE && 0 <= hex.y && hex.y < NBSIDE)
|
||||
{
|
||||
Affiche_hexagon(p, c->x, c->y, PLAYER(p->player));
|
||||
Mix_PlayMusic (param->click, 1);
|
||||
play_clik();
|
||||
}
|
||||
|
||||
}
|
||||
@ -130,7 +130,7 @@ void deplacement (plateau_t p, SDL_Event* event, curseur_t* c)
|
||||
if (c->y < 0)
|
||||
c->y = NBSIDE - 1;
|
||||
Affiche_hexagon(p, c->x, c->y, PLAYER(p->player));
|
||||
Mix_PlayMusic (param->click, 1);
|
||||
play_clik();
|
||||
SDL_Delay (100);
|
||||
}
|
||||
break;
|
||||
|
@ -7,7 +7,14 @@
|
||||
#include "param.h"
|
||||
#include "draw.h"
|
||||
|
||||
#define NBOPTIONS 4
|
||||
#define NBOPTIONS 5
|
||||
|
||||
#define LEFT 0
|
||||
#define RIGHT 1
|
||||
|
||||
|
||||
/* Menu */
|
||||
/* Interne */
|
||||
|
||||
void Redim_entry (SDL_Surface** entry, int rayon, int l)
|
||||
{
|
||||
@ -81,7 +88,6 @@ void Case_menu (menu_t m, int rayon)
|
||||
}
|
||||
|
||||
/* Externes */
|
||||
/* Menu */
|
||||
|
||||
void Affiche_menu_principal (menu_t m)
|
||||
{
|
||||
@ -126,15 +132,15 @@ void Affiche_entry (menu_t m, char* entry, bool pointe)
|
||||
}
|
||||
|
||||
/* Menu options */
|
||||
/* Interne */
|
||||
|
||||
void Affiche_menu_options (SDL_Surface* window, int rayon, int l)
|
||||
void print_arrow (SDL_Surface* window, bool side, )
|
||||
{
|
||||
SDL_Surface* arrow = SDL_CreateRGBSurface (SDL_HWSURFACE, 2*m->r, 2*m->r, window->format->BitsPerPixel, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
SDL_Rect cadre_options (SDL_Surface* window, int l)
|
||||
{
|
||||
SDL_Surface* hex = SDL_CreateRGBSurface (SDL_HWSURFACE, rayon * 2, rayon * 2, window->format->BitsPerPixel, 0, 0, 0, 0);
|
||||
Hexagon_single (hex, rayon, SDL_MapRGB(hex->format, 0, 0, 0), &l);
|
||||
int dx = (window->w - 4 * (l + 1)) / 2 - rayon + l/2 + 1 + (l + 1);
|
||||
SDL_Rect pos_hex = {dx + 2 * (l + 1) / 2, 2 * (1.5 * rayon)};
|
||||
SDL_BlitSurface (hex, NULL, window, &pos_hex);
|
||||
SDL_FreeSurface (hex);
|
||||
SDL_Rect pos = {(window->w - 4 * (l + 1)) / 2 + (l + 1) / 2, 0, 2 * l + 1, window->h * 11. /12};
|
||||
SDL_FillRect (window, &pos, param->ex);
|
||||
pos.x += 10;
|
||||
@ -142,24 +148,25 @@ void Affiche_menu_options (SDL_Surface* window, int rayon, int l)
|
||||
pos.w -= 20;
|
||||
pos.h -= 20;
|
||||
SDL_FillRect (window, &pos, param->in);
|
||||
int size = pos.h * 2 / 3. / NBOPTIONS;
|
||||
int margev = pos.h / 3. / (NBOPTIONS + 1);
|
||||
|
||||
char* entry_name [NBOPTIONS] = {"Musique : ", "Couleurs : ", "Taille : ", "Retour"};
|
||||
|
||||
pos.y += margev;
|
||||
pos.w -= 40;
|
||||
pos.x += 10;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int create_options_surfaces (SDL_Surface* entry [NBOPTIONS])
|
||||
{
|
||||
char* entry_name [NBOPTIONS] = {"Musique : ", "Son : ", "Couleurs : ", "Taille : ", "Retour"};
|
||||
// Also modify NBOPTIONS
|
||||
int maxw = 0;
|
||||
SDL_Surface* entry [NBOPTIONS];
|
||||
for (int i = 0; i < NBOPTIONS; ++i)
|
||||
{
|
||||
entry [i] = TTF_RenderUTF8_Blended (param->font, entry_name [i], param->rgb_ex);
|
||||
if (maxw < entry[i]->w)
|
||||
maxw = entry[i]->w;
|
||||
}
|
||||
return maxw;
|
||||
}
|
||||
|
||||
SDL_Rect blit_redim_options (SDL_Surface* window, SDL_Surface* entry [NBOPTIONS], SDL_Rect pos, int maxw, int size, int margev)
|
||||
{
|
||||
for (int i = 0; i < NBOPTIONS - 1; ++i)
|
||||
{
|
||||
SDL_Surface* entry_dim;
|
||||
@ -178,11 +185,16 @@ void Affiche_menu_options (SDL_Surface* window, int rayon, int l)
|
||||
|
||||
SDL_Rect pos_entry = {pos.x + (pos.w / 2 - entry_dim->w) / 2, pos.y + (size - entry_dim->h) / 2, 0, 0};
|
||||
SDL_BlitSurface (entry_dim, NULL, window, &pos_entry);
|
||||
putPixel(window, pos_entry.x + pos_entry.w, pos_entry.y, SDL_MapRGB (window->format, 0, 255, 0));
|
||||
|
||||
pos.y += size + margev;
|
||||
|
||||
SDL_FreeSurface (entry_dim);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
SDL_Rect blit_redim_retour (SDL_Surface* window, SDL_Surface* entry [NBOPTIONS], SDL_Rect pos, int maxw, int size)
|
||||
{
|
||||
SDL_Surface* entry_dim;
|
||||
if (pos.w / 2 < entry[NBOPTIONS-1]->w)
|
||||
{
|
||||
@ -207,10 +219,38 @@ void Affiche_menu_options (SDL_Surface* window, int rayon, int l)
|
||||
SDL_FillRect (window, &pos_cadre, param->in);
|
||||
SDL_BlitSurface (entry_dim, NULL, window, &pos_entry);
|
||||
|
||||
pos.y += size + margev;
|
||||
|
||||
SDL_FreeSurface (entry_dim);
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
/* Externe */
|
||||
|
||||
void Affiche_menu_options (SDL_Surface* window, int rayon, int l)
|
||||
{
|
||||
SDL_Surface* hex = SDL_CreateRGBSurface (SDL_HWSURFACE, rayon * 2, rayon * 2, window->format->BitsPerPixel, 0, 0, 0, 0);
|
||||
Hexagon_single (hex, rayon, SDL_MapRGB(hex->format, 0, 0, 0), &l);
|
||||
int dx = (window->w - 4 * (l + 1)) / 2 - rayon + l/2 + 1 + (l + 1);
|
||||
SDL_Rect pos_hex = {dx + 2 * (l + 1) / 2, 2 * (1.5 * rayon)};
|
||||
SDL_BlitSurface (hex, NULL, window, &pos_hex);
|
||||
SDL_FreeSurface (hex);
|
||||
|
||||
SDL_Rect pos = cadre_options (window, l);
|
||||
|
||||
int size = pos.h * 2 / 3. / NBOPTIONS;
|
||||
int margev = pos.h / 3. / (NBOPTIONS + 1);
|
||||
|
||||
pos.y += margev;
|
||||
pos.w -= 40;
|
||||
pos.x += 10;
|
||||
|
||||
SDL_Surface* entry [NBOPTIONS];
|
||||
|
||||
int maxw = create_options_surfaces (entry);
|
||||
|
||||
pos = blit_redim_options (window, entry, pos, maxw, size, margev);
|
||||
pos = blit_redim_retour (window, entry, pos, maxw, size);
|
||||
|
||||
for (int i = 0 ; i < window->h; ++i)
|
||||
putPixel (window, pos.x + pos.w/2 + 10, i, SDL_MapRGB (window->format, 0, 255, 0));
|
||||
|
||||
@ -219,39 +259,37 @@ void Affiche_menu_options (SDL_Surface* window, int rayon, int l)
|
||||
}
|
||||
|
||||
/* Scroll */
|
||||
/* Interne */
|
||||
|
||||
/*typedef struct s_scrolling {
|
||||
SDL_Surface* msg [NBMESS];
|
||||
SDL_Rect* pos;
|
||||
SDL_Rect* dim;
|
||||
int first_msg, nb_msg, nb_msg_max;
|
||||
}* scrolling_t;*/
|
||||
|
||||
scrolling_t init_scroll (SDL_Surface* window)
|
||||
int Cadre_scroll (SDL_Surface* window)
|
||||
{
|
||||
char* message [NBMESS] = {"Crédits : petite bite & gros chakal Corp.", "Breaking News : Le Soudan en manque de soudeurs", "lmqsdkmq"};
|
||||
SDL_Color c [NBMESS] = {{170,10,107}, {60,255,1}, {0, 0, 0}};
|
||||
scrolling_t s = malloc (sizeof (struct s_scrolling));
|
||||
|
||||
/* Bande de scroll */
|
||||
int size = window->h / 24;
|
||||
SDL_Rect bande = {0, window->h * 45. / 48, window->w, size};
|
||||
SDL_FillRect (window, &bande, param->in);
|
||||
SDL_Flip (window);
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Creation surfaces */
|
||||
void create_messages_surfaces (scrolling_t s, int size, int bpp)
|
||||
{
|
||||
char* message [NBMESS] = {"Crédits : petite bite & gros chakal Corp.", "Breaking News : Le Soudan en manque de soudeurs", "lmqsdkmq", "There is nothing to see here ... BASTARD !"};
|
||||
// Also modify NBMESS
|
||||
SDL_Color c [NBMESS] = {{170,10,107}, {60,255,1}, {0, 0, 0}, {200, 180, 201}};
|
||||
for (int i = 0; i < NBMESS; ++i)
|
||||
{
|
||||
assert (message [i] != NULL);
|
||||
SDL_Surface* texte = TTF_RenderUTF8_Blended(param->font, message [i], c [i]);//, param->rgb_ex);
|
||||
Redim_entry(&texte, size, texte->w);
|
||||
s->msg [i] = SDL_CreateRGBSurface (SDL_HWSURFACE, texte->w + 1, texte->h, window->format->BitsPerPixel, 0, 0, 0, 0);
|
||||
s->msg [i] = SDL_CreateRGBSurface (SDL_HWSURFACE, texte->w + 1, texte->h, bpp, 0, 0, 0, 0);
|
||||
SDL_Rect temp = {0, 0, s->msg [i]->w, s->msg [i]->h};
|
||||
SDL_FillRect (s->msg [i], &temp, param->in);
|
||||
SDL_BlitSurface (texte, NULL, s->msg [i], &temp);
|
||||
SDL_FreeSurface (texte);
|
||||
}
|
||||
}
|
||||
|
||||
void nb_msg_max (scrolling_t s, SDL_Surface* window)
|
||||
{
|
||||
s->nb_msg_max = 1;
|
||||
for (int i = 0; i < NBMESS; ++i)
|
||||
{
|
||||
@ -266,8 +304,12 @@ scrolling_t init_scroll (SDL_Surface* window)
|
||||
s->nb_msg_max = nb_msg;
|
||||
}
|
||||
++s->nb_msg_max;
|
||||
s->nb_msg_max += s->nb_msg_max % NBMESS;
|
||||
while (s->nb_msg_max % NBMESS != 0)
|
||||
++s->nb_msg_max;
|
||||
}
|
||||
|
||||
void init_pos_dim (scrolling_t s, SDL_Surface* window)
|
||||
{
|
||||
s->pos = malloc (sizeof (SDL_Rect) * s->nb_msg_max);
|
||||
s->dim = malloc (sizeof (SDL_Rect) * s->nb_msg_max);
|
||||
for (int i = 0; i < s->nb_msg_max; ++i)
|
||||
@ -279,6 +321,22 @@ scrolling_t init_scroll (SDL_Surface* window)
|
||||
s->dim [i].w = s->msg [i%NBMESS]->w;
|
||||
s->dim [i].h = s->msg [i%NBMESS]->h;
|
||||
}
|
||||
}
|
||||
|
||||
/* Externe */
|
||||
|
||||
scrolling_t init_scroll (SDL_Surface* window)
|
||||
{
|
||||
scrolling_t s = malloc (sizeof (struct s_scrolling));
|
||||
|
||||
int size = Cadre_scroll (window);
|
||||
|
||||
/* Creation surfaces */
|
||||
create_messages_surfaces (s, size, window->format->BitsPerPixel);
|
||||
|
||||
nb_msg_max (s, window);
|
||||
|
||||
init_pos_dim (s, window);
|
||||
|
||||
s->first_msg = 0;
|
||||
s->nb_msg = 1;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <SDL/SDL.h>
|
||||
#include "globals.h"
|
||||
|
||||
#define NBMESS 3
|
||||
#define NBMESS 4
|
||||
|
||||
typedef struct s_scrolling {
|
||||
SDL_Surface* msg [NBMESS];
|
||||
|
@ -33,10 +33,10 @@ void Quadrille_bis (plateau_t p)
|
||||
SDL_Surface* hex1 = SDL_CreateRGBSurface (SDL_HWSURFACE, 2 * p->r, 2 * p->r, p->window->format->BitsPerPixel, 0, 0, 0, 0);
|
||||
SDL_Surface* hex2 = SDL_CreateRGBSurface (SDL_HWSURFACE, 2 * p->r, 2 * p->r, p->window->format->BitsPerPixel, 0, 0, 0, 0);
|
||||
Hexagon (hex, p->r, param->ex, param->in, DBORD, &(p->l));
|
||||
Hexagon (hex1, p->r, param->ex, param->in, DBORD, &(p->l));
|
||||
Circle (hex1, p->l, param->j2);
|
||||
Hexagon (hex2, p->r, param->ex, param->in, DBORD, &(p->l));
|
||||
Circle (hex2, p->l, param->j1);
|
||||
Hexagon (hex1, p->r, param->ex, param->j1, DBORD, &(p->l));
|
||||
//Circle (hex1, p->l, param->j2);
|
||||
Hexagon (hex2, p->r, param->ex, param->j2, DBORD, &(p->l));
|
||||
//Circle (hex2, p->l, param->j1);
|
||||
for (int i = 0; i < NBSIDE; ++i)
|
||||
{
|
||||
int dx = p->marge_hori + i * (p->l + 1);
|
||||
@ -102,14 +102,18 @@ void Affiche_hexagon (plateau_t p, int x, int y, int state)
|
||||
c = param->ex;
|
||||
break;
|
||||
}
|
||||
Hexagon (hex, p->r, c, param->in, DBORD, &(p->l));
|
||||
switch (p->grid[x * NBSIDE + y])
|
||||
{
|
||||
case NORMAL :
|
||||
Hexagon (hex, p->r, c, param->in, DBORD, &(p->l));
|
||||
break;
|
||||
case J1:
|
||||
Circle (hex, p->l, param->j1);
|
||||
//Circle (hex, p->l, param->j1);
|
||||
Hexagon (hex, p->r, c, param->j1, DBORD, &(p->l));
|
||||
break;
|
||||
case J2:
|
||||
Circle (hex, p->l, param->j2);
|
||||
//Circle (hex, p->l, param->j2);
|
||||
Hexagon (hex, p->r, c, param->j2, DBORD, &(p->l));
|
||||
break;
|
||||
}
|
||||
SDL_BlitSurface (hex, NULL, p->window, &position);
|
||||
|
@ -11,9 +11,11 @@
|
||||
#include "action_plateau.h"
|
||||
#include "affichage_plateau.h"
|
||||
#include "window.h"
|
||||
#include "param.h"
|
||||
|
||||
void en_jeu (SDL_Surface* window)
|
||||
{
|
||||
Mix_PlayMusic(param->music, -1);
|
||||
plateau_t plateau = init_plateau (window);
|
||||
vec2 c = {0, 0};
|
||||
bool end = 0;
|
||||
@ -52,4 +54,6 @@ void en_jeu (SDL_Surface* window)
|
||||
}
|
||||
}
|
||||
free_plateau (plateau);
|
||||
Mix_HaltMusic();
|
||||
Mix_RewindMusic();
|
||||
}
|
||||
|
@ -61,7 +61,10 @@ typedef struct s_param {
|
||||
Uint32 in, ex, j1, j2, background;
|
||||
SDL_Color rgb_in, rgb_ex, rgb_j1, rgb_j2, rgb_background;
|
||||
TTF_Font* font;
|
||||
Mix_Music* click;
|
||||
Mix_Music* music;
|
||||
unsigned char music_vol;
|
||||
Mix_Chunk* click,* gong;
|
||||
unsigned char chunk_vol;
|
||||
}* param_t;
|
||||
|
||||
#endif /* _GLOBALS_H_ */
|
||||
|
@ -31,7 +31,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
save_param(window);
|
||||
SDL_FreeSurface (window);
|
||||
SDL_Quit ();
|
||||
Free_window (window);
|
||||
return 0;
|
||||
}
|
||||
|
10
src/param.c
10
src/param.c
@ -12,6 +12,8 @@
|
||||
#include <SDL/SDL_ttf.h>
|
||||
#include <SDL/SDL_mixer.h>
|
||||
|
||||
#include "sound.h"
|
||||
|
||||
#define C_IN SDL_MapRGB (w->format, 50, 50, 50)
|
||||
#define C_EX SDL_MapRGB (w->format, 100, 100, 100)
|
||||
#define C_J1 SDL_MapRGB (w->format, 255, 0, 0)
|
||||
@ -81,7 +83,8 @@ void load_param (SDL_Surface* w)
|
||||
}
|
||||
fclose (param_file);
|
||||
}
|
||||
param->click = Mix_LoadMUS("ressources/Click03.wav");
|
||||
|
||||
Load_sound ();
|
||||
}
|
||||
|
||||
void save_param (SDL_Surface* w)
|
||||
@ -96,7 +99,7 @@ void save_param (SDL_Surface* w)
|
||||
for (int i = 0; i < 5 ; ++i)
|
||||
{
|
||||
fprintf (param_file, "%s = %d %d %d\n", field [i], rgb->r, rgb->g, rgb->b);
|
||||
//printf ("%d - %d - %d\n", rgb->r, rgb->g, rgb->b);
|
||||
//printf ("%d - %d - %d\n", rgb->r, rsgb->g, rgb->b);
|
||||
rgb += 1;
|
||||
}
|
||||
|
||||
@ -119,5 +122,6 @@ void save_param (SDL_Surface* w)
|
||||
}
|
||||
free (param);
|
||||
fclose (param_file);
|
||||
Mix_FreeMusic(param->click);
|
||||
|
||||
Free_sound ();
|
||||
}
|
||||
|
42
src/sound.c
Normal file
42
src/sound.c
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* sound.c
|
||||
*
|
||||
* Created on: 23 avr. 2016
|
||||
* Author: nathan
|
||||
*/
|
||||
|
||||
#include "sound.h"
|
||||
#include <SDL/SDL_mixer.h>
|
||||
#include "param.h"
|
||||
|
||||
void Load_sound (void)
|
||||
{
|
||||
param->music_vol = .25 * MIX_MAX_VOLUME;
|
||||
param->music = Mix_LoadMUS ("ressources/theme.mp3");
|
||||
Mix_VolumeMusic (param->music_vol);
|
||||
|
||||
param->chunk_vol = .25 * MIX_MAX_VOLUME;
|
||||
printf ("%d\n", param->chunk_vol);
|
||||
param->click = Mix_LoadWAV("ressources/Click.wav");
|
||||
Mix_VolumeChunk (param->click, .5 * param->chunk_vol);
|
||||
|
||||
param->gong = Mix_LoadWAV("ressources/Gong.wav");
|
||||
Mix_VolumeChunk (param->gong, param->chunk_vol);
|
||||
}
|
||||
|
||||
void Free_sound (void)
|
||||
{
|
||||
Mix_FreeMusic (param->music);
|
||||
Mix_FreeChunk (param->click);
|
||||
Mix_FreeChunk (param->gong);
|
||||
}
|
||||
|
||||
void play_clik (void)
|
||||
{
|
||||
Mix_PlayChannel(0, param->click, 0);
|
||||
}
|
||||
|
||||
void play_gong (void)
|
||||
{
|
||||
//Mix_PlayChannel(1, param->gong, 0);
|
||||
}
|
20
src/sound.h
Normal file
20
src/sound.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* sound.h
|
||||
*
|
||||
* Created on: 23 avr. 2016
|
||||
* Author: nathan
|
||||
*/
|
||||
|
||||
#ifndef _SOUND_H_
|
||||
#define _SRC_SOUND_H_
|
||||
|
||||
|
||||
void Load_sound (void);
|
||||
|
||||
void Free_sound (void);
|
||||
|
||||
void play_clik (void);
|
||||
|
||||
void play_gong (void);
|
||||
|
||||
#endif /* _SOUND_H_ */
|
@ -25,6 +25,7 @@ SDL_Surface* init_window ()
|
||||
|
||||
if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 1024) == -1)
|
||||
fprintf(stderr, "Mix init failed : %s\n", Mix_GetError());
|
||||
Mix_AllocateChannels(3); //MIX_CHANNELS
|
||||
|
||||
const SDL_VideoInfo* info = SDL_GetVideoInfo();
|
||||
int bpp;
|
||||
@ -130,3 +131,11 @@ void Reset_window (SDL_Surface* window)
|
||||
SDL_FillRect (window, NULL, param->background);
|
||||
SDL_Flip (window);
|
||||
}
|
||||
|
||||
void Free_window (SDL_Surface* window)
|
||||
{
|
||||
SDL_FreeSurface (window);
|
||||
SDL_Quit();
|
||||
TTF_Quit();
|
||||
Mix_CloseAudio();
|
||||
}
|
||||
|
@ -11,4 +11,6 @@ SDL_Surface* fullscreen_window (SDL_Surface* window);
|
||||
|
||||
void Reset_window (SDL_Surface* window);
|
||||
|
||||
void Free_window (SDL_Surface* window);
|
||||
|
||||
#endif /* _WINDOW_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user