Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <uwsim/HUDCamera.h>
00014 #include <string.h>
00015 #include <iostream>
00016
00017 HUDCamera::HUDCamera(unsigned int width, unsigned int height, unsigned int posx, unsigned int posy, double scale,
00018 int blackWhite)
00019 {
00020 this->width = width;
00021 this->height = height;
00022 this->posx = posx;
00023 this->posy = posy;
00024 this->scale = scale;
00025 osg_image = new osg::Image();
00026 if (blackWhite)
00027 {
00028 osg_image->allocateImage(width, height, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE);
00029 memset(osg_image->data(), 0, width * height * 1 * sizeof(unsigned char));
00030 }
00031 else
00032 {
00033 osg_image->allocateImage(width, height, 1, GL_RGB, GL_UNSIGNED_BYTE);
00034 memset(osg_image->data(), 0, width * height * 3 * sizeof(unsigned char));
00035 }
00036
00037 ready_ = false;
00038
00039 }
00040
00041 osg::ref_ptr<osgWidget::Window> HUDCamera::getWidgetWindow()
00042 {
00043 osg::ref_ptr < osgWidget::Box > box = new osgWidget::Box("HUDCameraBox", osgWidget::Box::HORIZONTAL, true);
00044 widget = new osgWidget::Widget("HUDCameraWidget", width, height);
00045 widget->setUpdateCallback(new widgetUpdateCallback(osg_image));
00046
00047 box->addWidget(widget);
00048 box->setX(posx);
00049 box->setY(posy);
00050 box->setScale(scale);
00051 box->getBackground()->setColor(1.0f, 0.0f, 0.0f, 0.8f);
00052 box->attachMoveCallback();
00053 box->attachScaleCallback();
00054 return box;
00055 }
00056
00057 HUDCamera::~HUDCamera()
00058 {
00059 }
00060