示例#1
0
void textslider_render(component *c) {
    textslider *tb = c->obj;
    char buf[100];
    int chars;
    int width;
    int xoff;
    sprintf(buf, "%s ", tb->text);
    chars = strlen(buf);
    for(int i = 0; i < tb->positions; i++) {
        if (i+1 > *tb->pos) {
            buf[chars+i] = '|';
        } else {
            buf[chars+i] = 127;
        }
    }
    // null terminator
    buf[chars+tb->positions] = '\0';
    chars = strlen(buf);
    width = chars*tb->font->w;
    xoff = (c->w - width)/2;
    if(c->selected) {
        int t = tb->ticks / 2;
        font_render(tb->font, buf, c->x + xoff, c->y, color_create(80 - t, 220 - t*2, 80 - t, 255));
    } else if (c->disabled) {
        font_render(tb->font, buf, c->x + xoff, c->y, color_create(121, 121, 121, 255));
    } else {
        font_render(tb->font, buf, c->x + xoff, c->y, color_create(0, 121, 0, 255));
    }
}
示例#2
0
seqdata::seqdata
(
    sequence & seq,
    perform & p,
    int zoom,
    Gtk::Adjustment & hadjust
) :
    gui_drawingarea_gtk2    (p, hadjust, adjustment_dummy(), 10, c_dataarea_y),
    m_seq                   (seq),
    m_zoom                  (zoom),
    m_scroll_offset_ticks   (0),
    m_scroll_offset_x       (0),
    m_number_w              (font_render().char_width()+1),      // was 6
    m_number_h              (3*(font_render().char_height()+1)), // was 3*10
    m_number_offset_y       (font_render().char_height()-1),     // was 8
    m_status                (0),
    m_cc                    (0),
    m_numbers               (),             // an array
    m_old                   (),
#ifdef USE_STAZED_SEQDATA_EXTENSIONS
    m_drag_handle           (false),
#endif
    m_dragging              (false)
{
    set_flags(Gtk::CAN_FOCUS);
}
示例#3
0
void gameover_draw(void *renderer) {
    SDL_Color w = {255, 255, 255, 255};
    font_render("Game over", 0, 10, 1, assets_bundle->fonts[0], w);
    char *buf = malloc(20);
    sprintf(buf, "Your score: %i", score);
    font_render(buf, 0, 80, 1, assets_bundle->fonts[1], w);
    font_render("Press any key to exit...", 0, 120, 1, assets_bundle->fonts[2], w);
}
示例#4
0
void scoreboard_render_overlay(scene *scene) {
    scoreboard_local *local = scene_get_userdata(scene);
    video_render_sprite_size(&local->black_surface, 0, 0, 320, 200);
    char row[128];
    char score_text[15];
    char temp_name[17];
    const char* score_row_format = "%-18s%-9s%-9s%11s";

    // Header text
    sprintf(row, "SCOREBOARD - %s", round_get_name(local->page));
    int title_x = 62 + (local->page == 0 ? 8 : 0);
    font_render(&font_large, row, title_x, 5, TEXT_COLOR_HEADER);

    // Column names
    sprintf(row, score_row_format, "PLAYER NAME", "ROBOT", "PILOT", "SCORE");
    font_render(&font_small, row, 20, 20, TEXT_COLOR_HEADER);

    // Scores information
    unsigned int score, har_id, pilot_id;
    char *player_name;
    int entry = 0;
    int found_slot = 0;
    for(int r = 0; r < 20; r++) {
        score = local->data.entries[local->page][entry].score;
        row[0] = 0;

        // If this slot is the slot where the new, pending score data should be written,
        // show pending data and text input field. Otherwise just show next line of 
        // original saved score data.
        if(local->has_pending_data && score < local->pending_data.score && !found_slot) {
            sprintf(temp_name, "%s%s", local->pending_data.name, CURSOR_STR);
            score_format(local->pending_data.score, score_text);
            sprintf(row,
                score_row_format,
                temp_name,
                har_get_name(local->pending_data.har_id),
                pilot_get_name(local->pending_data.pilot_id),
                score_text);
            found_slot = 1;
        } else {
            har_id = local->data.entries[local->page][entry].har_id;
            pilot_id = local->data.entries[local->page][entry].pilot_id;
            player_name = local->data.entries[local->page][entry].name;
            if(score > 0) {
                score_format(score, score_text);
                sprintf(row,
                    score_row_format,
                    player_name,
                    har_get_name(har_id),
                    pilot_get_name(pilot_id),
                    score_text);
            }
            entry++;
        }
        font_render(&font_small, row, 20, 30 + r*8, TEXT_COLOR_SCORES);
    }
}
示例#5
0
void main_render_menu(int menu_part) {
    SDL_Color white = {255, 255, 255, 255};
    SDL_Color red = {255, 0, 0, 255};
    for(int i = 0; i < menus[menu_part].items_count; i++) {
        SDL_Color item_color = (menu_pointer == i) ? red : white;
        if (menu_pointer == -1) item_color = white;
        font_render(menus[menu_part].title, 0, 110, 1, assets_bundle->fonts[1], white);
        SDL_Rect menu_border = font_render(menus[menu_part].items[i], 0, 160 + (i * 50), 1, assets_bundle->fonts[2], item_color);
        renderer_set_padding(&menu_border, 20);
        menus[menu_part].borders[i] = menu_border;
        renderer_draw_rect(&menu_border, item_color);
    }
}
示例#6
0
void textbutton_render(component *c) {
    textbutton *tb = c->obj;
    int chars = strlen(tb->text);
    int width = chars*tb->font->w;
    int xoff = (c->w - width)/2;
    if(c->selected) {
        int t = tb->ticks / 2;
        font_render(tb->font, tb->text, c->x + xoff, c->y, color_create(80 - t, 220 - t*2, 80 - t, 255));
    } else if (c->disabled) {
        font_render(tb->font, tb->text, c->x + xoff, c->y, color_create(121, 121, 121, 255));
    } else {
        font_render(tb->font, tb->text, c->x + xoff, c->y, color_create(0, 121, 0, 255));
    }
}
示例#7
0
void menuitem_put_text(menuitem_ptr m, char *s)
{
    SDL_Surface *tmp;

    m->text = s;
    if (m->img) SDL_FreeSurface(m->img);
    tmp = font_render(s, c_text);
    m->img = SDL_DisplayFormat(tmp);
    SDL_FreeSurface(tmp);
}
 void render_string_on_pixmap
 (
     int x, int y, const std::string & s, font::Color color,
     bool invert = false
 )
 {
     font_render().render_string_on_drawable
     (
         m_gc, x, y, m_pixmap, s.c_str(), color, invert
     );
 }
示例#9
0
void button_put_text(button_ptr b, char *s)
{
    SDL_Surface *tmp;

    if (b->img) SDL_FreeSurface(b->img);
    if (b->text) free(b->text);
    b->text = clonestr(s);
    tmp = font_render(s, c_text);
    b->img = SDL_DisplayFormat(tmp);
    SDL_FreeSurface(tmp);
}
示例#10
0
void label_put_text(label_ptr l, char *s)
{
    SDL_Surface *tmp;

    if (l->img) SDL_FreeSurface(l->img);
    if (l->text) free(l->text);
    l->text = clonestr(s);
    tmp = font_render(s, c_text);
    l->img = SDL_DisplayFormat(tmp);
    SDL_FreeSurface(tmp);
}
示例#11
0
 void render_number
 (
     Glib::RefPtr<Gdk::Pixmap> & pixmap,
     int x, int y,
     const char * const num
 )
 {
     font_render().render_string_on_drawable
     (
         m_gc, x, y, pixmap, num, font::BLACK, true
     );
 }
示例#12
0
struct texture *font_create_texture( const char *text ) {
	struct texture *t = NULL;
	SDL_Surface *s = font_render( text );
	if( s ) {
		t = ogl_create_texture( s );
		if( t == NULL ) {
			fprintf( stderr, "Error: Couldn't create texture for text '%s'\n", text );
		}
		SDL_FreeSurface( s );
	}
	return t;
}
示例#13
0
void render(objectmachine_t *obj, v2d_t camera_position)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;
    objectdecorator_textout_t *me = (objectdecorator_textout_t*)obj;

    /* 생성 */
    font_render(me->fnt, camera_position);

    /* done! */
    decorated_machine->render(decorated_machine, camera_position);
}
示例#14
0
void textbox_update_img(textbox_ptr tb)
{
    SDL_Surface *tmp;

    if (tb->img) SDL_FreeSurface(tb->img);
    tmp = font_render(tb->text, c_text);
    if (tmp) {
	tb->img = SDL_DisplayFormat(tmp);
	SDL_FreeSurface(tmp);
    } else {
	tb->img = NULL;
    }
}
示例#15
0
文件: gl.cpp 项目: ZeXx86/gen
void gl_render ()
{
	fps_stick = SDL_GetTicks ();
	
	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity ();
	
	camera_update ();
	
	/* Ziskame nasi kameru */
	camera_t *c = camera_get ();
	
	/* Vykreslovani SkyBoxu */
	gl_render_skybox (c);
	
	terrain_t *t;	
	for (t = terrain_list.next; t != &terrain_list; t = t->next) {
		if (!t->gl_buf_len) {
			/* mazani kontextu terenu z pameti */
			terrain_t *tmp = t->prev;
			if (terrain_del (t))
				t = tmp;
			
			continue;
		}

		gl_render_terrain (t, c);	
	}

	/* Vykreslovani vody */
	gl_water_render ();

	/* Vykreslovani HUD/textu */
	char sfps[32];
	sprintf (sfps, "FPS: %.0f", 1.0f/(fps_dtick/1000.0f));
	font_render (0.500, -0.400, sfps);
	
	glFlush ();
	
	 /* Prohodi predni a zadni buffer */
	SDL_GL_SwapWindow (g_window);

	/* vypocitame hodnotu FPS na zaklade soucasneho casu a casu z predchoziho cyklu */
	fps_dtick = SDL_GetTicks () - fps_stick;

	/* Omezime shora FPS, protoze nam vyssi uz nic neprinese */
	if (1000/FPS_MAX > fps_dtick)
		SDL_Delay (1000.0f/FPS_MAX - fps_dtick);
}
示例#16
0
/* creates the background */
image_t* create_background()
{
    image_t* img = image_create(VIDEO_SCREEN_W, VIDEO_SCREEN_H);
    font_t *fnt = font_create("disclaimer");
    v2d_t camera = v2d_new(VIDEO_SCREEN_W/2, VIDEO_SCREEN_H/2);

    image_clear(video_get_backbuffer(), image_rgb(0,0,0));
    font_set_width(fnt, VIDEO_SCREEN_W - 6);
    font_set_text(fnt, "%s", text);
    font_set_position(fnt, v2d_new(3,3));
    font_render(fnt, camera);
    image_blit(video_get_backbuffer(), img, 0, 0, 0, 0, image_width(img), image_height(img));

    font_destroy(fnt);
    return img;
}
示例#17
0
perfnames::perfnames
(
    perform & p,
    perfedit & parent,
    Gtk::Adjustment & vadjust
) :
    gui_drawingarea_gtk2    (p, adjustment_dummy(), vadjust, c_names_x, 100),
    seqmenu                 (p),
    m_parent                (parent),
    m_names_chars           (24),
    m_char_w                (font_render().char_width()),   /* 6            */
    m_setbox_w              (m_char_w * 2),
    m_namebox_w             (m_char_w * 22),                /* 24?          */
    m_names_x               (m_names_chars * m_char_w),     /* c_names_x    */
    m_names_y               (c_names_y),
    m_xy_offset             (2),
    m_seqs_in_set           (c_seqs_in_set),
    m_sequence_max          (c_max_sequence),
    m_sequence_offset       (0),
    m_sequence_active       ()                              /* an array     */
{
    for (int i = 0; i < m_sequence_max; ++i)
        m_sequence_active[i] = false;
}
示例#18
0
void render(bool bClearOnly)
{
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	if(bClearOnly == false)
	{
		textures[0]->Render(0,0,0,0);

		// =============================================================================================
		// TITLE
		// =============================================================================================

		double xPos, yPos;

		xPos = DbgFontCenterX( 
			0,									// x left (as in RECT)
			render_width,						// x right (as in RECT)
			FONT_SIZE_1,						// font size (in pixels)		
			strlen(szTitle),					// text length (num. chars)
			REFERENCE_WIDTH, REFERENCE_HEIGHT,	// reference width / height (should not be changed)
			render_width, render_height			// currently active resolution
		);
		yPos = DbgFontY(50.0, render_height);

		cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_1), 0xFFFFFFFF, "%s", szTitle);
		
		yPos += DbgFontY(FONT_SIZE_1 + FONT_SPACING, render_height);

		// =============================================================================================
		// DATE
		// =============================================================================================

		char szDate[128];
		char szTime[128];
		memset(&szDate, 0, sizeof(szDate));
		memset(&szTime, 0, sizeof(szTime));

		GetDateTimeStr((char*)szDate, (char*)szTime, false);

		xPos = DbgFontCenterX(
			0,									// x left (as in RECT)
			render_width,						// x right (as in RECT)
			FONT_SIZE_2,						// font size (in pixels)
			strlen(szDate),						// text length (num. chars)
			REFERENCE_WIDTH, REFERENCE_HEIGHT,	// reference width / height (should not be changed)
			render_width, render_height			// currently active resolution
		);
		
		cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", szDate);
		
		yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height);
		
		// =============================================================================================
		// TIME
		// =============================================================================================

		xPos = DbgFontCenterX(
			0,									// x left (as in RECT)
			render_width,						// x right (as in RECT)
			FONT_SIZE_1,						// font size (in pixels)
			strlen(szTime),						// text length (num. chars)
			REFERENCE_WIDTH, REFERENCE_HEIGHT,	// reference width / height (should not be changed)
			render_width, render_height			// currently active resolution
		);
		
		cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_1), 0xFFFFFFFF, "%s", szTime);
		
		yPos += DbgFontY(FONT_SIZE_1 + FONT_SPACING, render_height);

		// =============================================================================================
		
		static uint64_t nInterval = 30;				// 0.5 second @ 60 FPS
		static uint64_t nFrameCheckpoint = nFrame;
		
		if(nFrame >= (nFrameCheckpoint + nInterval)) 
		{
			nFrameCheckpoint = nFrame;
			
			sys_game_get_temperature(0, &temp_cpu);
			sys_game_get_temperature(1, &temp_rsx);
		}

		char szTemperature[256];
		memset(&szTemperature, 0, sizeof(szTemperature));

		sprintf(szTemperature, "Temperature: (CPU: %d' C) (RSX: %d' C)", temp_cpu, temp_rsx);

		xPos = DbgFontCenterX(
			0,									// x left (as in RECT)
			render_width,						// x right (as in RECT)
			FONT_SIZE_2,						// font size (in pixels)
			strlen(szTemperature),				// text length (num. chars)
			REFERENCE_WIDTH, REFERENCE_HEIGHT,	// reference width / height (should not be changed)
			render_width, render_height			// currently active resolution
		);
		
		cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", szTemperature);
		
		yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height);

		// ===
		yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height);
		yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height);
		// ===

		//xPos = DbgFontCenterX(
		//	0,									// x left (as in RECT)
		//	render_width,						// x right (as in RECT)
		//	FONT_SIZE_2,						// font size (in pixels)
		//	strlen((char*)"..::[ ISO LIST ] [ PS3ISO / PSXISO / BDISO / DVDISO ] ::.."),				// text length (num. chars)
		//	REFERENCE_WIDTH, REFERENCE_HEIGHT,	// reference width / height (should not be changed)
		//	render_width, render_height			// currently active resolution
		//);
		//
		//cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", (char*)"..::[ ISO LIST ] [ PS3ISO / PSXISO / BDISO / DVDISO ] ::..");
		//
		yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height);
		yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height);

		// ================

		xPos = DbgFontX(100.0, render_width);

		int nMenuItem = main_menu->UpdateTopItem();	

		while(nMenuItem <= (main_menu->nTopItem + main_menu->nListMax))
		{
			if(nMenuItem == main_menu->nTotalItem) break;
			if(main_menu->nTotalItem <= 0) break;

			// normal
			unsigned int nColor = 0xFFFFFFFF;

			// selected
			if(nMenuItem == main_menu->nSelectedItem) {
				nColor = 0xFF00CCFF;
			}
		
			//if(nFrameStep == 0) { nColor = g_opt_nFontShadowColor; } // Shadow color

			cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), nColor, "%s", main_menu->item[nMenuItem]->szMenuLabel/*, main_menu->item[nMenuItem]->szData_1*/);
			yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height);

			nMenuItem++;
		}

		(void)font_render();		
	}
	
	nFrame++;
	psglSwap();
}
示例#19
0
static int l_textbox_print(lua_State *L)
{
	l_textbox	*tb;
	btstring_t	*text;
	const char	*instring;
	SDL_Surface	*s;
	SDL_Color	fg;
	SDL_Rect	srect, prect;
	uint32_t	nchars;
	uint32_t	index = 0;

	tb = l_checkTextbox(L, 1);
	text = bts_strcpy(luaL_checkstring(L, 2));

	get_color(tb, FG_INDEX, &fg);

	debug("text: '%s'\n", text->buf);
	while (index < text->size - 1) {
		btstring_t *tmp;
#if 0
		/*
		 * Bard's Tale doesn't use the width of the font
		 * character's to do text wrapping.
		 */
		nchars = font_wrap(tb->font, text->buf, index, \
					(tb->rect->w - tb->x));
#endif

		if (tb->x == 0) {
			while (text->buf[index] == ' ')
				index++;
		}

		/*
		 * Output newlines first
		 */
		while (text->buf[index] == '\n') {
			index++;
			_textbox_newline(tb);
		}

		nchars = _textbox_wrap(tb, text, index);

		if (nchars) {
			tmp = bts_strncpy(&text->buf[index], nchars);
			debug("tmp = '%s'\n", tmp->buf);

			s = font_render(tb->font, tmp->buf, &fg);
			if (!s)
				sdl_error(L);

			srect.x = tb->x;
			srect.y = tb->y;
			srect.w = s->w;
			srect.h = s->h;

			if (SDL_BlitSurface_r(s, NULL, tb->s, &srect))
				sdl_error(L);
			_update_screen(tb);

			tb->x += s->w;

			index += nchars;
			tb->nchars += nchars;

			bts_free(tmp);
			SDL_FreeSurface(s);
		}


		if (text->buf[index] == '\n') {
			while (text->buf[index] == '\n') {
				index++;
				_textbox_newline(tb);
			}
		} else if (index < text->size - 1) {
			/* Line wrapped. Reset x and increment y */
			_textbox_newline(tb);

			/* Skip past any spaces at the end of the line */
			while ((text->buf[index] == ' ') && (index < text->size))
				index++;
		} 

	}

	bts_free(text);

	return 0;
}
示例#20
0
文件: melee.c 项目: rev22/openomf
void melee_render(scene *scene) {
    animation *ani;
    int current_a = 5*row_a + column_a;
    int current_b = 5*row_b + column_b;


    if (selection == 0) {
        video_render_sprite_flip(&feh, 70, 0, BLEND_ALPHA, FLIP_NONE);
        video_render_sprite_flip(&bleh, 0, 62, BLEND_ALPHA, FLIP_NONE);

        // player bio
        font_render_wrapped(&font_small, lang_get(135+current_a), 4, 66, 152, COLOR_GREEN);
        // player stats
        font_render(&font_small, lang_get(216), 74+27, 4, COLOR_GREEN);
        font_render(&font_small, lang_get(217), 74+19, 22, COLOR_GREEN);
        font_render(&font_small, lang_get(218), 74+12, 40, COLOR_GREEN);
        progressbar_render(&bar_power[0]);
        progressbar_render(&bar_agility[0]);
        progressbar_render(&bar_endurance[0]);

        if (scene->player2.selectable) {
            video_render_sprite_flip(&feh, 320-70-feh.w, 0, BLEND_ALPHA, FLIP_NONE);
            video_render_sprite_flip(&bleh, 320-bleh.w, 62, BLEND_ALPHA, FLIP_NONE);
            // player bio
            font_render_wrapped(&font_small, lang_get(135+current_b), 320-bleh.w+4, 66, 152, COLOR_GREEN);
            // player stats
            font_render(&font_small, lang_get(216), 320-66-feh.w+27, 4, COLOR_GREEN);
            font_render(&font_small, lang_get(217), 320-66-feh.w+19, 22, COLOR_GREEN);
            font_render(&font_small, lang_get(218), 320-66-feh.w+12, 40, COLOR_GREEN);
            progressbar_render(&bar_power[1]);
            progressbar_render(&bar_agility[1]);
            progressbar_render(&bar_endurance[1]);
        } else {
            // 'choose your pilot'
            font_render_wrapped(&font_small, lang_get(187), 160, 97, 160, COLOR_GREEN);
        }
    }
    ani = array_get(&scene->animations, 5);

    if (scene->player2.selectable) {
        video_render_sprite_flip(array_get(&ani->sprites, 0), 254, 0, BLEND_ALPHA, FLIP_NONE);
    } else {
        video_render_sprite_flip(array_get(&ani->sprites, 1), 162, 0, BLEND_ALPHA, FLIP_NONE);
    }
    if (selection == 0) {
        // player 1 name
        font_render_wrapped(&font_small, lang_get(20+current_a), 0, 52, 66, COLOR_BLACK);

        if (scene->player2.selectable) {
            // player 2 name
            font_render_wrapped(&font_small, lang_get(20+current_b), 320-66, 52, 66, COLOR_BLACK);
        }

        render_highlights(scene);
        for(int i = 0; i < 10; i++) {
            ani = array_get(&scene->animations, 3);

            video_render_sprite_flip(array_get(&ani->sprites, i), players[i].sprite->pos_x, players[i].sprite->pos_y, BLEND_ALPHA, FLIP_NONE);

            if (i == current_a) {
                // render the big portrait
                ani = array_get(&scene->animations, 4);
                video_render_sprite_flip(array_get(&ani->sprites, i), players_big[i].sprite->pos_x, players_big[i].sprite->pos_y, BLEND_ALPHA, FLIP_NONE);
            }

            if (scene->player2.selectable && i == current_b) {
                // render the big portrait
                ani = array_get(&scene->animations, 4);
                video_render_sprite_flip(array_get(&ani->sprites, i), 320-(players_big[i].sprite->img->w + players_big[i].sprite->pos_x), players_big[i].sprite->pos_y, BLEND_ALPHA, FLIP_HORIZONTAL);
            }
        }
    } else {
        // render the stupid unselected HAR portraits before anything
        // so we can render anything else on top of them
        sd_sprite *sprite = scene->bk->anims[1]->animation->sprites[0];
        ani = array_get(&scene->animations, 1);
        video_render_sprite_flip(array_get(&ani->sprites, 0), sprite->pos_x, sprite->pos_y, BLEND_ALPHA, FLIP_NONE);

        render_highlights(scene);

        // currently selected player
        ani = array_get(&scene->animations, 4);
        video_render_sprite_flip(array_get(&ani->sprites, player_id_a), players_big[player_id_a].sprite->pos_x, players_big[player_id_a].sprite->pos_y, BLEND_ALPHA, FLIP_NONE);

        //currently selected HAR
        video_render_sprite_flip(&harportraits[current_a], 11 + (62*column_a), 115 + (42*row_a), BLEND_ALPHA, FLIP_NONE);
        animationplayer_render(&harplayer_a);

        // player 1 name
        font_render_wrapped(&font_small, lang_get(20+player_id_a), 0, 52, 66, COLOR_BLACK);

        if (scene->player2.selectable) {
            // player 2 name
            font_render_wrapped(&font_small, lang_get(20+player_id_b), 320-66, 52, 66, COLOR_BLACK);

            // currently selected player
            video_render_sprite_flip(array_get(&ani->sprites, player_id_b), 320-(players_big[player_id_b].sprite->img->w + players_big[player_id_b].sprite->pos_x),
                    players_big[player_id_b].sprite->pos_y, BLEND_ALPHA, FLIP_HORIZONTAL);
            // currently selected HAR
            video_render_sprite_flip(&harportraits[current_b], 11 + (62*column_b), 115 + (42*row_b), BLEND_ALPHA, FLIP_NONE);
            animationplayer_render(&harplayer_b);
        } else {
            // 'choose your HAR'
            font_render_wrapped(&font_small, lang_get(186), 160, 97, 160, COLOR_GREEN);
        }
    }
}
示例#21
0
文件: kernel.c 项目: zzh8829/OSPP
void kernel_main(uint32_t mb_addr, uint32_t mb_magic)
{
	if(mb_magic != MULTIBOOT_BOOTLOADER_MAGIC)
	{
		kprintf(PANIC,"Wrong Bootloader Magic\n");
		for(;;);
	}

	multiboot_info_t* mb_info = (multiboot_info_t*)mb_addr;
	vbe_info_t* vbe_info = (vbe_info_t *)(mb_info->vbe_mode_info);

	uint32_t top = mb_info->mem_upper;
	uint32_t bot = mb_info->mem_lower;
	uint32_t mem = top+bot;

	clear_console();

	char version[20];
	get_version(version);
	kp("Welcome to ZOS v%s",version);

	kp("System Information");
	kp("	Booting Flag: 0x%x",mb_info->flags);
	if(check_flag(mb_info->flags,0))
		kp("	Available Memory: %d KB / %d MB",mem,mem/1024);
	if(check_flag(mb_info->flags,1))
		kp("	Booting Device: 0x%x",mb_info->boot_device);
	if(check_flag(mb_info->flags,2))
	{
		if(strlen((char*)mb_info->cmdline)>1)
			kp("	Booting Command: %s",(char*)mb_info->cmdline);
	}
	if(check_flag(mb_info->flags,3))
		{}
	if(check_flag(mb_info->flags,4))
		{}
	if(check_flag(mb_info->flags,5))
		kernel_elf = elf_from_multiboot(mb_info);
	if(check_flag(mb_info->flags,6))
	{
		/*
		multiboot_memory_map_t *mmap;
		kp ("mmap_addr = 0x%x, mmap_length = 0x%x",
			(unsigned) mb_info->mmap_addr, (unsigned) mb_info->mmap_length);
		for (mmap = (multiboot_memory_map_t *) mb_info->mmap_addr;
			(unsigned long) mmap < mb_info->mmap_addr + mb_info->mmap_length;
			mmap = (multiboot_memory_map_t *) ((unsigned long) mmap
			+ mmap->size + sizeof (mmap->size)))
		{
			kp (" size = 0x%x, base_addr = 0x%x%x,"
			" length = 0x%x%x, type = 0x%x",
			(unsigned) mmap->size,
			mmap->addr >> 32,
			mmap->addr & 0xffffffff,
			mmap->len >> 32,
			mmap->len & 0xffffffff,
			(unsigned) mmap->type);
		}
		*/		
	}
	gdt_init();		/* Global Descriptor Table */
	idt_init();		/* Interrupt Descriptor Table */
	isrs_init();	/* Interrupt Service Requests */
	irq_init();		/* Hardware Interrupt Requests */ 

	open_serial_output();

	timer_init();
	paging_init(mem);
	heap_init();
	
	keyboard_init();

	//pci_init();
	kp("login: "******"Welcome to ZOS\n",
		"Hello!\n",
		"abcdefghijklmnopqrstuvwxyz1234567890\n",
		0
	};
	for(int i=0;i!=3;i++)
	{
		for(int j = 0;j!=strlen(str[i]);j++)
		{
			gfx_print(str[i][j]);
		}
	}
	

	void render(window_t* win)
	{
	}

	void update(window_t* win)
	{
		surface_fill(win->surface,0,rgb(255,255,255));

		key_event_t* head;
		int len;
		keyboard_event_get(&head,&len);
		for(int i=0;i!=len;i++)
		{
			key_event_t* eve = head+i;
			if(eve->type == KEY_DOWN)
			{
				gfx_print(eve->character);
			}
		}
		keyboard_event_clear();
		
		rect_t trect = {0,0,720,20};
		for(int i=0;i!=24;i++)
		{
			if(strlen(gfx_con_buf[i]))
			{
				surface_t* surf = font_render(gfx_con_buf[i],col);
				surface_blend(surf,0,win->surface,&trect);
				surface_free(surf);
			}
			trect.y += 20;
		}
	}
示例#22
0
void main_menu_draw() {
    SDL_Color white = {255, 255, 255, 255};
    font_render("Space Invaders", 0, 50, 1, assets_bundle->fonts[0], white);
    main_render_menu(menu_part);
}