Marble Match 3 game update.

- updated fonts



git-svn-id: svn://kolibrios.org@5242 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
alpine 2014-12-19 10:44:00 +00:00
parent e7f2530411
commit ba5bb1ced2
3 changed files with 65 additions and 38 deletions

View File

@ -31,7 +31,7 @@ void game_draw() {
if (game.menu_index == MENU_MAIN) {
if (game.status == STATUS_LOADING) {
game_textout( GAME_WIDTH/2 - 192, 240, 0, " L0ADING``` " );
game_textout_at_center( 0, 240, 0, "L0ADING```" );
}
else {
@ -39,17 +39,20 @@ void game_draw() {
if (game.time) {
game_textout( GAME_WIDTH/2 - 192, 230, 3, " LEVEL PA55ED " );
game_textout_at_center( 0, 230, 0, "LEVEL PA55ED" );
game_textout_at_center( -3, 230-2, 3, "LEVEL PA55ED" );
char s[] = " TIME: 000 ";
char s[] = "TIME: 000";
int time_sec = game.time / 25;
s[11] = '0' + (( time_sec / 100 ) % 10);
s[12] = '0' + (( time_sec / 10 ) % 10);
s[13] = '0' + (( time_sec / 1 ) % 10);
game_textout( GAME_WIDTH/2 - 192, 260, 3, s );
s[6] = '0' + (( time_sec / 100 ) % 10);
s[7] = '0' + (( time_sec / 10 ) % 10);
s[8] = '0' + (( time_sec / 1 ) % 10);
game_textout_at_center( 0, 260, 0, s );
game_textout_at_center( -3, 260-2, 3, s );
};
game_textout( GAME_WIDTH/2 - 192, 300, 0, " CLICK T0 5TART " );
game_textout_at_center( 0, 300, 0, "CLICK T0 5TART" );
game_textout_at_center( -3, 300-2, 3, "CLICK T0 5TART" );
};
@ -95,13 +98,17 @@ void game_draw() {
str[7] = '0' + ( (time_sec / 10) % 10);
str[8] = '0' + ( (time_sec / 1) % 10);
game_textout( 56+3, 32+2, 0, str );
// game_textout( 56-1, 32-1, 0, str );
game_textout( 56, 32, 3, str );
char sstr[] = "5C0RE: 000 0F 100 ";
sstr[7] = '0' + ( (game.score / 100) % 10);
sstr[8] = '0' + ( (game.score / 10) % 10);
sstr[9] = '0' + ( (game.score / 1) % 10);
game_textout( 56+3, 64+2, 0, sstr );
game_textout( 56, 64, 3, sstr );
};
@ -147,17 +154,28 @@ void game_textures_init_stage1() {
rs_gen_term();
rs_texture_t tex_shadow;
texture_init(&tex_shadow, 64, 64);
rs_gen_init(1, 64);
rs_gen_func_perlin(0, 21, 6, 0.5, 1000);
rs_gen_func_normalize(0, 0.0, 0.5);
rs_gen_tex_out_rgba(0, 0, 0, -1, 1.0, 1.0, 1.0, 1.0);
memcpy(tex_shadow.data, rs_gen_reg.tex_out, 64*64*4 );
rs_gen_term();
texture_init(&game.tex_logo, GAME_WIDTH, 128);
texture_clear(&game.tex_logo, COLOR_TRANSPARENT);
game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192, 3, 1, DRAW_MODE_REPLACE, "MARBLE");
game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192, 4, 1, DRAW_MODE_REPLACE, "MARBLE");
game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192, 63, 1, DRAW_MODE_REPLACE, "MATCH3");
texture_draw(&game.tex_logo, &tex_shadow, 0, 0, DRAW_MODE_MULT | DRAW_TILED_FLAG);
game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192 - 5, 0, 1, DRAW_MODE_ALPHA, "MARBLE");
game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192 - 4, 60, 1, DRAW_MODE_ALPHA, "MATCH3");
texture_draw(&game.tex_logo, &game.tex_clouds, 0, 0, DRAW_MODE_MULT | DRAW_TILED_FLAG);
game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192 - 4, 0, 1, DRAW_MODE_MULT, "MARBLE");
game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192 - 4, 60, 1, DRAW_MODE_MULT, "MATCH3");
texture_free(&tex_shadow);
texture_init(&game.tex_bg, 512, 512);

View File

@ -323,20 +323,20 @@ void game_font_init() {
// float radiuses[4] = { 1.0, 1.1, 1.2, 0.87 };
float scales[4] = { 0.5, 2.0, 0.2, 2 }; // 2,1,1,1
float scales[4] = { 0.69, 2.0, 0.2, 0.5 }; // 2,1,1,1
//float pows[4] = { 45.0, 100.0, 200.0, 22.0 };
float pows[4] = { 3.0, 7.0, 15.0, 22.0 };
float pows[4] = { 8.0, 7.0, 15.0, 22.0 };
float ks1[4] = { 0.01, 0.05, 1.2, 0.90 }; // 0.75 straight
float ks2[4] = { -3.75, -2.75, -1.0, -1.0 };
float pows1[4] = { 1.0, 1.0, 1.0, 1.0 };
float pows2[4] = { 0.6, 0.6, 1.0, 1.0 };
float clamp1[4] = { 0.45, 0.69, 0.65, 0.87 }; // 0.8 to 0.86
float clamp2[4] = { 0.90, 0.75, 0.85, 0.92 };
float clamp1[4] = { 0.65, 0.69, 0.65, 0.87 }; // 0.8 to 0.86
float clamp2[4] = { 0.85, 0.75, 0.85, 0.92 };
float radiuses[4] = { 0.9667, 0.997, 1.2, 0.87 };
float colors_r[4] = { 0.3, 0.997, 1.0, 0.9 };
float colors_g[4] = { 0.2, 0.875, 1.0, 0.5 };
float colors_b[4] = { 0.1, 0.763, 1.0, 0.1 };
float colors_r[4] = { 0.15, 0.997, 1.0, 0.4 };
float colors_g[4] = { 0.10, 0.875, 1.0, 0.6 };
float colors_b[4] = { 0.05, 0.763, 1.0, 0.8 };
// 1: 0.5, 0.74, 0.79
DEBUG20(":: font init label-a");
@ -386,8 +386,11 @@ void game_font_init() {
rs_gen_func_clamp(32+ch, (ch+ch/8)%2 ? 0.0 : 0.0, 1.0);
// rs_gen_func_set(32+ch, (ch+ch/8)%2 ? 0.5 : 0.0);
rs_gen_func_set(96, 1.0);
rs_gen_tex_out_rgba_set(0.0, 0.0, 0.0, 0.0);
rs_gen_tex_out_rgba(32+ch, 32+ch, 32+ch, 32+ch, colors_b[font_index_color], colors_g[font_index_color], colors_r[font_index_color], 1.0);
//rs_gen_tex_out_rgba(32+ch, 32+ch, 32+ch, 32+ch, colors_b[font_index_color], colors_g[font_index_color], colors_r[font_index_color], 1.0);
rs_gen_tex_out_rgba(96, 96, 96, 32+ch, colors_b[font_index_color], colors_g[font_index_color], colors_r[font_index_color], 1.0);
texture_init(&game.tex_font[font_index_color*64 + ch], char_tex_size, char_tex_size);
memcpy(game.tex_font[font_index_color*64 + ch].data, rs_gen_reg.tex_out, char_tex_size*char_tex_size*4 );
@ -465,8 +468,14 @@ void game_textout(int x, int y, int font_index, char* s) {
game_textout_adv(&game.framebuffer, x, y, font_index, DRAW_MODE_ALPHA, s);
};
void game_textout_at_center(int x, int y, int font_index, char *s) {
x += (GAME_WIDTH - game.tex_font[font_index*64].w*strlen(s))/2;
game_textout_adv(&game.framebuffer, x, y, font_index, DRAW_MODE_ALPHA, s);
};
void game_textout_adv(rs_texture_t *dest, int x, int y, int font_index, int draw_mode, char* s) {
int i = 0;
while (*s) {
if (*s != ' ') {

View File

@ -5,30 +5,30 @@
#define GAME_COLORS_COUNT 8
#define GAME_COLOR_BLACK 0
#define GAME_COLOR_WHITE 1
#define GAME_COLOR_YELLOW 2
#define GAME_COLOR_RED 3
#define GAME_COLOR_BLUE 4
#define GAME_COLOR_ORANGE 5
#define GAME_COLOR_GRAY 6
#define GAME_COLOR_GREEN 7
#define GAME_FONT_DEFAULT 0
#define GAME_FONT_HEAVY 1
#define GAME_FONT_TITLE 2
#define GAME_FONT_LIGHT 3
#define GAME_ALIGN_LEFT 0
#define GAME_ALIGN_CENTER 1
#define GAME_ALIGN_RIGHT 2
//#define GAME_COLOR_BLACK 0
//#define GAME_COLOR_WHITE 1
//#define GAME_COLOR_YELLOW 2
//#define GAME_COLOR_RED 3
//#define GAME_COLOR_BLUE 4
//#define GAME_COLOR_ORANGE 5
//#define GAME_COLOR_GRAY 6
//#define GAME_COLOR_GREEN 7
//
//#define GAME_FONT_DEFAULT 0
//#define GAME_FONT_HEAVY 1
//#define GAME_FONT_TITLE 2
//#define GAME_FONT_LIGHT 3
//
//#define GAME_ALIGN_LEFT 0
//#define GAME_ALIGN_CENTER 1
//#define GAME_ALIGN_RIGHT 2
void game_font_init();
void game_font_term();
void game_textout(int x, int y, int font_index, char* s);
void game_textout_at_center(int x, int y, int font_index, char *s);
void game_textout_adv(rs_texture_t *dest, int x, int y, int font_index, int draw_mode, char* s);
#endif