Mercurial > hg > Members > kono > Cerium
comparison Renderer/Engine/viewerSDL.cc @ 993:8024a3a44832
sdl mode not worked yet.
author | yutaka@charles.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Sat, 09 Oct 2010 19:11:45 +0900 |
parents | 0b6f8c82625a |
children | 33616b2789de |
comparison
equal
deleted
inserted
replaced
990:30f2e77ecb36 | 993:8024a3a44832 |
---|---|
1 #include "viewerSDL.h" | 1 #include "viewerSDL.h" |
2 #include "Func.h" | 2 #include "Func.h" |
3 #include "TaskManager.h" | 3 #include "TaskManager.h" |
4 #include "viewer_types.h" | 4 #include "viewer_types.h" |
5 #include "fb.h" | |
5 | 6 |
6 #define UGA 1 | 7 #define UGA 1 |
7 | 8 |
8 extern void post2runLoop(void *); | 9 extern void post2runLoop(void *); |
9 | 10 |
10 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK | 11 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
11 | 12 |
12 ViewerSDL::ViewerSDL() {} | 13 ViewerSDL::ViewerSDL() {} |
13 ViewerSDL::~ViewerSDL() {} | 14 ViewerSDL::~ViewerSDL() {} |
14 | 15 |
16 #define DEVICE_NAME "/dev/fb0" | |
17 #define DIV_BYTE 8 | |
18 | |
15 Uint32 * | 19 Uint32 * |
16 ViewerSDL::video_init(TaskManager *manager, int bpp, int width, int height) | 20 ViewerSDL::video_init(TaskManager *manager, int bpp, int width, int height) |
17 { | 21 { |
22 | |
23 int fd_framebuffer ; | |
24 struct fb_var_screeninfo vinfo; | |
25 struct fb_fix_screeninfo finfo; | |
26 | |
27 int xres,yres,vbpp; | |
28 | |
29 /* 読み書き用にファイルを開く */ | |
30 fd_framebuffer = open( DEVICE_NAME , O_RDWR); | |
31 if ( !fd_framebuffer ) { | |
32 send_current_error_msg("Framebuffer device open error !"); | |
33 exit(1); | |
34 } | |
35 send_current_information("The framebuffer device was opened !"); | |
36 | |
37 /* 固定スクリーン情報取得 */ | |
38 if ( ioctl( fd_framebuffer , FBIOGET_FSCREENINFO , &finfo ) ) { | |
39 send_current_error_msg("Fixed information not gotton !"); | |
40 exit(2); | |
41 } | |
42 | |
43 /* 変動スクリーン情報取得 */ | |
44 if ( ioctl( fd_framebuffer , FBIOGET_VSCREENINFO , &vinfo ) ) { | |
45 send_current_error_msg("Variable information not gotton !"); | |
46 exit(3); | |
47 } | |
48 | |
49 close(fd_framebuffer); | |
50 | |
51 xres = vinfo.xres; | |
52 yres = vinfo.yres; | |
53 vbpp = vinfo.bits_per_pixel; | |
54 | |
55 width = xres; | |
56 height = yres; | |
57 bpp = vbpp; | |
58 | |
18 Uint32 sdl_flag = default_sdl_flag | SDL_INIT_VIDEO; | 59 Uint32 sdl_flag = default_sdl_flag | SDL_INIT_VIDEO; |
19 Uint32 *p; | 60 Uint32 *p; |
20 | 61 |
21 if (SDL_Init(sdl_flag) < 0) { | 62 if (SDL_Init(sdl_flag) < 0) { |
22 fprintf(stderr,"Couldn't initialize SDL: %s\n", SDL_GetError()); | 63 fprintf(stderr,"Couldn't initialize SDL: %s\n", SDL_GetError()); |
23 exit(1); | 64 exit(1); |
24 } | 65 } |
25 | 66 |