Mercurial > hg > Members > kono > Cerium
changeset 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 | 30f2e77ecb36 |
children | 33616b2789de |
files | Renderer/Engine/viewerSDL.cc |
diffstat | 1 files changed, 42 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/viewerSDL.cc Fri Oct 01 04:43:02 2010 +0900 +++ b/Renderer/Engine/viewerSDL.cc Sat Oct 09 19:11:45 2010 +0900 @@ -2,6 +2,7 @@ #include "Func.h" #include "TaskManager.h" #include "viewer_types.h" +#include "fb.h" #define UGA 1 @@ -12,12 +13,52 @@ ViewerSDL::ViewerSDL() {} ViewerSDL::~ViewerSDL() {} +#define DEVICE_NAME "/dev/fb0" +#define DIV_BYTE 8 + Uint32 * ViewerSDL::video_init(TaskManager *manager, int bpp, int width, int height) { + + int fd_framebuffer ; + struct fb_var_screeninfo vinfo; + struct fb_fix_screeninfo finfo; + + int xres,yres,vbpp; + + /* 読み書き用にファイルを開く */ + fd_framebuffer = open( DEVICE_NAME , O_RDWR); + if ( !fd_framebuffer ) { + send_current_error_msg("Framebuffer device open error !"); + exit(1); + } + send_current_information("The framebuffer device was opened !"); + + /* 固定スクリーン情報取得 */ + if ( ioctl( fd_framebuffer , FBIOGET_FSCREENINFO , &finfo ) ) { + send_current_error_msg("Fixed information not gotton !"); + exit(2); + } + + /* 変動スクリーン情報取得 */ + if ( ioctl( fd_framebuffer , FBIOGET_VSCREENINFO , &vinfo ) ) { + send_current_error_msg("Variable information not gotton !"); + exit(3); + } + + close(fd_framebuffer); + + xres = vinfo.xres; + yres = vinfo.yres; + vbpp = vinfo.bits_per_pixel; + + width = xres; + height = yres; + bpp = vbpp; + Uint32 sdl_flag = default_sdl_flag | SDL_INIT_VIDEO; Uint32 *p; - + if (SDL_Init(sdl_flag) < 0) { fprintf(stderr,"Couldn't initialize SDL: %s\n", SDL_GetError()); exit(1);