Mercurial > hg > Game > Cerium
comparison Renderer/Engine/SceneGraph.cc @ 1211:7763f03a94e1 draft before-dma-manager
const char fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Jul 2011 08:46:29 +0900 |
parents | 0ee23180d301 |
children | 636dfdc30176 |
comparison
equal
deleted
inserted
replaced
1210:0ee23180d301 | 1211:7763f03a94e1 |
---|---|
219 | 219 |
220 finalize = &SceneGraph::finalize_original; | 220 finalize = &SceneGraph::finalize_original; |
221 | 221 |
222 } | 222 } |
223 | 223 |
224 SceneGraph::SceneGraph(TaskManager *manager,char *font,int pixels,Uint32 color,char *string_name) { | 224 SceneGraph::SceneGraph(TaskManager *manager,const char *font,int pixels,Uint32 color,const char *string_name) { |
225 | 225 |
226 init(); | 226 init(); |
227 | 227 |
228 this->matrix = (float*)manager->allocate(sizeof(float)*16); | 228 this->matrix = (float*)manager->allocate(sizeof(float)*16); |
229 this->real_matrix = (float*)manager->allocate(sizeof(float)*16); | 229 this->real_matrix = (float*)manager->allocate(sizeof(float)*16); |
255 | 255 |
256 finalize = &SceneGraph::finalize_original; | 256 finalize = &SceneGraph::finalize_original; |
257 } | 257 } |
258 | 258 |
259 void | 259 void |
260 SceneGraph::create_font_data(TaskManager *manager,char *font ,int pixels, Uint32 color, char *string_name) | 260 SceneGraph::create_font_data(TaskManager *manager,const char *font ,int pixels, Uint32 color, const char *string_name) |
261 { | 261 { |
262 //font_coordinate(pixels/2,pixels); | 262 //font_coordinate(pixels/2,pixels); |
263 font_normal(); | 263 font_normal(); |
264 font_model(); | 264 font_model(); |
265 //font_texture(); | 265 //font_texture(); |
266 | 266 |
267 get_font_image(manager, font, pixels, color, string_name); | 267 get_font_image(manager, font, pixels, color, string_name); |
268 } | 268 } |
269 | 269 |
270 void | 270 void |
271 SceneGraph::get_font_image(TaskManager *manager,char *font ,int pixels ,Uint32 color, char *string_name) | 271 SceneGraph::get_font_image(TaskManager *manager,const char *font ,int pixels ,Uint32 color, const char *string_name) |
272 { | 272 { |
273 int tex_id; | 273 int tex_id; |
274 if (texture_hash.hash_regist(string_name, tex_id)) { | 274 if (texture_hash.hash_regist(string_name, tex_id)) { |
275 SDL_Surface *texture_image = load_font_image(font,pixels,color,string_name); | 275 SDL_Surface *texture_image = load_font_image(font,pixels,color,string_name); |
276 if(!texture_image){ | 276 if(!texture_image){ |
292 texture_info->scale_max = list[tex_id].scale_max; | 292 texture_info->scale_max = list[tex_id].scale_max; |
293 texture_info->texture_image = list[tex_id].texture_image; | 293 texture_info->texture_image = list[tex_id].texture_image; |
294 } | 294 } |
295 | 295 |
296 SDL_Surface* | 296 SDL_Surface* |
297 SceneGraph::load_font_image(char *font ,int pixel,Uint32 color , char *string_name) | 297 SceneGraph::load_font_image(const char *font ,int pixel,Uint32 color , const char *string_name) |
298 { | 298 { |
299 //printf("laod_font_iamge"); | 299 //printf("laod_font_iamge"); |
300 FT_Library library; | 300 FT_Library library; |
301 FT_Error err; | 301 FT_Error err; |
302 err = FT_Init_FreeType(&library); | 302 err = FT_Init_FreeType(&library); |
391 | 391 |
392 return texture_image; | 392 return texture_image; |
393 } | 393 } |
394 | 394 |
395 void | 395 void |
396 SceneGraph::conv(char *str, int length, u_int32_t *out) { | 396 SceneGraph::conv(const char *str, int length, u_int32_t *out) { |
397 int oindex = 0; | 397 int oindex = 0; |
398 int i = 0; | 398 int i = 0; |
399 while (i < length) { | 399 while (i < length) { |
400 out[oindex] = str[i++] & 0xff; | 400 out[oindex] = str[i++] & 0xff; |
401 int len = 0; | 401 int len = 0; |
652 } | 652 } |
653 } | 653 } |
654 } | 654 } |
655 | 655 |
656 static int | 656 static int |
657 is_bmp(char *name) { | 657 is_bmp(const char *name) { |
658 int bmp = 0; | 658 int bmp = 0; |
659 | 659 |
660 while(*name) { | 660 while(*name) { |
661 if (bmp==0 && *name=='.') bmp = 1; | 661 if (bmp==0 && *name=='.') bmp = 1; |
662 else if (bmp==1 && (*name=='b' || *name=='B')) bmp = 2; | 662 else if (bmp==1 && (*name=='b' || *name=='B')) bmp = 2; |
694 } | 694 } |
695 } | 695 } |
696 } | 696 } |
697 | 697 |
698 SDL_Surface* | 698 SDL_Surface* |
699 SceneGraph::load_decode_image(char *file_name, char *image_name, xmlNodePtr cur) | 699 SceneGraph::load_decode_image(const char *file_name, const char *image_name, xmlNodePtr cur) |
700 { | 700 { |
701 int fd = mkstemp(image_name); | 701 int fd = mkstemp((char *)image_name); |
702 FILE *outfile = fdopen(fd, "wb"); | 702 FILE *outfile = fdopen(fd, "wb"); |
703 | 703 |
704 if (NULL == outfile) { | 704 if (NULL == outfile) { |
705 cout << "error open file\n"; | 705 cout << "error open file\n"; |
706 return 0; | 706 return 0; |