示例#1
0
文件: graph.cpp 项目: yujiang/mos
int graph::draw_texturemul_index(const st_cell& cell,int index)
{
	texture* _tex = find_texturemul_index(index);
	if (!_tex)
		return 0;
	return get_render()->draw_texture_cell(cell,_tex,NULL);
}
示例#2
0
文件: graph.cpp 项目: yujiang/mos
int graph::draw_texture(const st_cell& cell,const char* file)
{
	texture* _tex = find_texture(file);
	if (!_tex)
		return 0;
	return get_render()->draw_texture_cell(cell,_tex,NULL);
}
示例#3
0
文件: graph.cpp 项目: yujiang/mos
int graph::draw_text(const st_cell& cell,const st_cell& text,const g_rect& rc_father)
{
	const stFont* font = get_font(text.font);
	if (!font)
		return -1;

	get_render()->text_start(rc_father);
	st_cell c = cell;

	auto_free af(core::UTF8ToUnicode(text.text));
	if (af.ptr == 0)
		return -1;
	const wchar_t* str = af.ptr;

	text_char tc;

	int x = 0;
	int y = 0;
	float room = cell.room;

	int ch;
	while(ch = *str++)
	{
		//if tc.char_value == #... 如果是转义字符,那么变了。
		if (ch == '\n')
		{
			x = 0;
			y += font->height + font->y_space ;
			continue;
		}

		if (!find_texture_font_rc(text,ch,tc))
			continue;

		c.x = cell.x + x*room;
		c.y = cell.y + y*room;
		c.color = text.color;
		c.alpha = text.alpha;
		get_render()->draw_text_cell(c,tc.texture->m_texture,tc.rc_texture);

		x += tc.advance;
	}

	get_render()->text_end();
	return 0;
}
示例#4
0
文件: graph.cpp 项目: yujiang/mos
int graph::draw_image(const st_cell& cell,const char* file,int frame)
{
	const st_redirect* r = redirect_image_file(file,frame);
	if (r)
		file = r->file_image.c_str();

	image* img = find_image_raw(file,frame,&cell.part0);
	if (!img)
		return -1;

	const g_rect* rc = NULL;
	if (r && !r->rc.is_empty())
		rc = &r->rc;

	file_source* source = find_file_source(file);
	if (source)
		file = source->get_texture_file(file,frame,&cell.part0);

	return get_render()->draw_image_cell(cell,img,file,rc);
}
示例#5
0
void
TestScene5::runPanda(int argc, char** argv)
{
	// initialize framework
	PandaFramework framework;
	framework.open_framework(argc, argv);
	// open window
	WindowProperties windowProp;
	framework.get_default_window_props(windowProp);
	windowProp.set_size(800, 600);
	auto window = framework.open_window(windowProp, GraphicsPipe::BF_require_window);
	// adjust camera
	auto camera = window->get_camera_group();
	camera.set_pos(2000, -2000, 2000);
	camera.look_at(LPoint3(0, 0, 0));
	// load & integrate model
	auto model = window->load_model(framework.get_models(), "panda-model");
	model.set_pos(-2000, 2000, -2000);
	model.reparent_to(window->get_render());
	// loop
	framework.main_loop();
}
示例#6
0
int main()
{
	ms_init();

	MSFilter *source = get_source();
	MSFilter *render = get_render();

	ms_filter_link(source, 0, render, 0);

	MSTicker *ticker = ms_ticker_new();
	ms_ticker_attach(ticker, source);

	while (true) {
		ms_sleep(1);
	}

	ms_ticker_destroy(ticker);

	ms_filter_destroy(render);
	ms_filter_destroy(source);

	return 0;
}
示例#7
0
文件: graph.cpp 项目: yujiang/mos
void graph::draw_win_end()
{
	get_render()->window_end();
}
示例#8
0
文件: graph.cpp 项目: yujiang/mos
void graph::draw_win_begin(int x,int y,int w,int h,const st_cell& win)
{
	get_render()->window_start(x,y,w,h,win);
}
示例#9
0
文件: graph.cpp 项目: yujiang/mos
int graph::draw_box(const st_cell& cell,int w,int h)
{
	return get_render()->draw_box_cell(cell,w,h);
}