annotate Renderer/Engine/viewerFB.cc @ 860:63a08f3a468a draft

Still on the way
author yutaka@localhost.localdomain
date Fri, 18 Jun 2010 01:30:06 +0900
parents c7afc21e448d
children b662e9dd26b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "viewerFB.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "fb.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
728
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
4 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 //extern void post2runLoop(void *);
728
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
6 ViewerFB::ViewerFB() {}
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
7 ViewerFB::~ViewerFB() {}
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
728
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
9 Uint32 *
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
10 ViewerFB::video_init(TaskManager *manager, int bpp, int width, int height)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 Uint32 sdl_flag = default_sdl_flag | SDL_INIT_VIDEO;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 if (SDL_Init(sdl_flag) < 0) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 fprintf(stderr,"Couldn't initialize SDL: %s\n",SDL_GetError());
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 exit(1);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
728
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
19 Uint32 *pixels = (Uint32*)get_fbdev_addr();
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 if (pixels == 0) {
728
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
22 pixels = (new Uint32[width*height*32/8]);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 }
728
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
24
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
25 return pixels;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 ViewerFB::clean_pixels()
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 //bzero(pixels, sizeof(int)*width*height);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 //memset(pixels, 0xFF, sizeof(int)*width*height);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 }
728
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
34
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
35 void
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
36 ViewerFB::clear_screen()
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
37 {
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
38 }
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
39
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
40
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
41 void
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
42 ViewerFB::free_device()
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
43 {
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
44 }
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
45
c7afc21e448d add Engine/ViewerDevice , SgRootChange not work
aaa
parents: 539
diff changeset
46