Beispiel #1
0
ControllerHUD::ControllerHUD() :
  m_controls()
{
  const Sizef btn_size(16, 16);
  const Vector pos(128, 64);

  const Vector dpad_pos = pos + Vector(-64.0f, 0.0f);
  m_controls[Control::LEFT] = Rectf::from_center(dpad_pos + Vector(-16.0f, 0.0f), btn_size);
  m_controls[Control::RIGHT] = Rectf::from_center(dpad_pos + Vector(16.0f, 0.0f), btn_size);
  m_controls[Control::UP] = Rectf::from_center(dpad_pos + Vector(0.0f, -16.0f), btn_size);
  m_controls[Control::DOWN] = Rectf::from_center(dpad_pos + Vector(0.0f, 16.0f), btn_size);

  const Vector peek_pos = pos + Vector(0.0f, -24.0f);
  m_controls[Control::PEEK_LEFT] = Rectf::from_center(peek_pos + Vector(-16.0f, 0.0f), btn_size);
  m_controls[Control::PEEK_RIGHT] = Rectf::from_center(peek_pos + Vector(16.0f, 0.0f), btn_size);
  m_controls[Control::PEEK_UP] = Rectf::from_center(peek_pos + Vector(0.0f, -16.0f), btn_size);
  m_controls[Control::PEEK_DOWN] = Rectf::from_center(peek_pos + Vector(0.0f, 16.0f), btn_size);

  const Vector btn_pos = pos + Vector(64.0f, -8.0f);
  m_controls[Control::ACTION] = Rectf::from_center(btn_pos + Vector(-20.0f, 0.0f), btn_size);
  m_controls[Control::JUMP] = Rectf::from_center(btn_pos + Vector(0.0f, 20.0f), btn_size);

  m_controls[Control::START] = Rectf::from_center(pos + Vector(16.0f, 24.0f), Sizef(16, 8));
  m_controls[Control::ESCAPE] = Rectf::from_center(pos + Vector(-16.0f, 24.0f), Sizef(16, 8));
}
void
MenuManager::transition(Menu* from, Menu* to)
{
  if (!from && !to)
  {
    return;
  }
  else
  {
    Rectf from_rect;
    if (from)
    {
      from_rect = menu2rect(*from);
    }
    else
    {
      from_rect = Rectf(to->get_center_pos(), Sizef(0, 0));
    }

    Rectf to_rect;
    if (to)
    {
      to_rect = menu2rect(*to);
    }
    else
    {
      to_rect = Rectf(from->get_center_pos(), Sizef(0, 0));
    }

    m_transition->start(from_rect, to_rect);
  }
}
void
GeometryTest::draw()
{
  glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  Display::draw_line(line1, Color(0.0f, 1.0f, 0.0f));
  Display::draw_line(line2, Color(0.0f, 1.0f, 0.0f));

  Display::fill_rect(Rectf(cursor - Vector2f(2,2), Sizef(5,5)),  Color(1.0f, 0.0f, 1.0f));
  Display::fill_rect(Rectf(cursor2 - Vector2f(2,2), Sizef(5,5)), Color(1.0f, 1.0f, 0.0f));

  Display::fill_rect(Rectf(collision_point - Vector2f(3,3), Sizef(7,7)), Color(1.0f, 1.0f, 1.0f));

  // Try vector projection
  Vector2f a(line1.p2 - line1.p1);
  Vector2f b(line2.p2 - line2.p1);
  Vector2f c(a.project(b));
  
  Display::draw_line(line1.p1, line1.p1 + c, Color(1.0f, 1.0f, 1.0f, 0.5f));

  int segments = std::max(0, int(cursor.y / 10));

  Display::fill_arc(Vector2f(200, 200), 100.0f, cursor.x, cursor2.x, Color(1.0f, 1.0f, 1.0f, 0.5f), segments);
  Display::draw_arc(Vector2f(200, 200), 100.0f, cursor.x, cursor2.x, Color(1.0f, 1.0f, 1.0f), segments);
  Display::draw_circle(Vector2f(200, 200), 128.0f, Color(1.0f, 1.0f, 1.0f), segments);
}
Beispiel #4
0
bool FullScreen::update()
{

	const float virtual_screen_width = 800.0f;
	const float virtual_screen_height = 600.0f;
	game_time.update();

	// Check for fullscreen switch
	if (fullscreen_requested != is_fullscreen)
	{
		is_fullscreen = fullscreen_requested;
		create_window();
	}

	if (window.get_gc() != canvas.get_gc()) 
	{
		canvas = Canvas(window); // Always get the graphic context, the window may have been recreated
	}

	canvas.clear(Colorf(0.0f,0.0f,0.2f));

	int font_size = 28;
	font_size *= canvas.get_width() / virtual_screen_width;
	font.set_height(font_size);
	canvas.set_transform(Mat4f::identity());
	if (is_fullscreen)
	{
		font.draw_text(canvas, 16, font_size, "Full Screen Mode. Press 'F' to switch to resizable window.");
	}
	else
	{
		font.draw_text(canvas, 16, font_size, "Resizable Window. Press 'F' to switch to full screen mode.");
	}

	// Scale the drawing to the screen to a virtual screen size
	Mat4f matrix = Mat4f::scale( (float) canvas.get_width() / virtual_screen_width, (float) canvas.get_height() /virtual_screen_height, 1.0f);
	canvas.set_transform(matrix);

	spr_logo.draw(canvas, virtual_screen_width-spr_logo.get_width(), virtual_screen_height-spr_logo.get_height());

	spr_background.set_scale(0.5f, 0.5f);
	spr_background.draw(canvas, 100, 100);

	// Show a few alpha-blending moving rectangles that moves in circles
	float x = cos(sin_count)*120.0f;
	float y = sin(sin_count)*120.0f;
	sin_count += 2.0f * game_time.get_time_elapsed();
	canvas.fill_rect(Rectf( 320.0f + x -30.0f, 300.0f + y -30.0f, Sizef(60.0f, 60.0f)), Colorf(0.0f, 1.0f, 0.0, 0.5f));
	x = cos(sin_count+3.14159f)*120.0f;
	y = sin(sin_count+3.14159f)*120.0f;
	canvas.fill_rect(Rectf( 320.0f + x -30.0f, 300 + y -30.0f, Sizef(60.0f, 60.0f)), Colorf(1.0f, 1.0f, 0.0, 0.5f));

	window.flip(1);

	return !quit;
}
Beispiel #5
0
void
ItemHorizontalLine::draw(DrawingContext& context, const Vector& pos, int menu_width, bool active) {
  // TODO
  /* Draw a horizontal line with a little 3d effect */
  context.color().draw_filled_rect(Rectf(Vector(pos.x, pos.y - 6.0f),
                                         Sizef(static_cast<float>(menu_width), 4.0f)),
                                   Color(0.6f, 0.7f, 1.0f, 1.0f), LAYER_GUI);
  context.color().draw_filled_rect(Rectf(Vector(pos.x, pos.y - 6.0f),
                                         Sizef(static_cast<float>(menu_width), 2.0f)),
                                   Color(1.0f, 1.0f, 1.0f, 1.0f), LAYER_GUI);
}
void FontProvider_Sprite::draw_text(Canvas &canvas, float xpos, float ypos, float scale_x, float scale_y, const std::string &text, const Colorf &color)
{
	float f_spacelen = spacelen;
	float ascent = font_metrics.get_ascent() * scale_x;

	// Scan the string
	UTF8_Reader reader(text.data(), text.length());
	while(!reader.is_end())
	{
		unsigned int glyph = reader.get_char();
		reader.next();

		Font_Sprite_Glyph *gptr = get_glyph(glyph);
		if (gptr)
		{
			spr_glyphs.set_frame(gptr->sprite_index);
			Size frame_size = spr_glyphs.get_frame_size(gptr->sprite_index);
			float dest_width = scale_x * frame_size.width;
			float dest_height = scale_y * frame_size.height;
			spr_glyphs.set_color(color);
			spr_glyphs.draw(canvas, Rectf(xpos, ypos - ascent, Sizef(dest_width, dest_height)));
			xpos += dest_width;
		}
		else
		{
			xpos += f_spacelen;
		}
	}
}
//------------------------------------------------------------------------------//
void InventoryItem::populateGeometryBuffer()
{
    if (!isUserStringDefined("BlockImage"))
        return;

    const Image* img = PropertyHelper<Image*>::fromString(getUserString("BlockImage"));

    if (!img)
        return;

    const Sizef square_size(squarePixelSize());

    argb_t colour = 0xFF00FF00;

    if (d_dragging && !currentDropTargetIsValid())
        colour = 0xFFFF0000;

    for (int y = 0; y < d_content.height(); ++y)
    {
        for (int x = 0; x < d_content.width(); ++x)
        {
            if (d_content.elementAtLocation(x, y))
            {
                img->render(d_geometryBuffers,
                            glm::vec2(x * square_size.d_width + 1, y * square_size.d_height + 1),
                            Sizef(square_size.d_width - 2, square_size.d_height - 2), 0, false,
                            ColourRect(colour));
            }
        }
    }
}
void
BicyclePlatform::draw(DrawingContext& context)
{
  if (g_debug.show_collision_rects) {
    context.color().draw_filled_rect(Rectf::from_center(m_center, Sizef(16, 16)), Color::MAGENTA, LAYER_OBJECTS);
  }
}
Beispiel #9
0
	void Font_DrawFlat::draw_text(Canvas &canvas, const Pointf &position, const std::string &text, const Colorf &color, float line_spacing)
	{
		float offset_x = 0;
		float offset_y = 0;
		UTF8_Reader reader(text.data(), text.length());
		RenderBatchTriangle *batcher = canvas.impl->batcher.get_triangle_batcher();

		while (!reader.is_end())
		{
			unsigned int glyph = reader.get_char();
			reader.next();

			if (glyph == '\n')
			{
				offset_x = 0;
				offset_y += line_spacing;
				continue;
			}

			Font_TextureGlyph *gptr = glyph_cache->get_glyph(canvas, font_engine, glyph);
			if (gptr)
			{
				if (!gptr->texture.is_null())
				{
					float xp = offset_x + position.x + gptr->offset.x;
					float yp = offset_y + position.y + gptr->offset.y;

					Rectf dest_size(xp, yp, Sizef(gptr->geometry.get_size()));
					batcher->draw_image(canvas, gptr->geometry, dest_size, color, gptr->texture);
				}
				offset_x += gptr->metrics.advance.width;
				offset_y += gptr->metrics.advance.height;
			}
		}
	}
//------------------------------------------------------------------------------//
void InventoryReceiver::populateGeometryBuffer()
{
    if (!isUserStringDefined("BlockImage"))
        return;

    const Image* img = PropertyHelper<Image*>::fromString(getUserString("BlockImage"));

    if (!img)
        return;

    const Sizef square_size(squarePixelSize());

    for (int y = 0; y < d_content.height(); ++y)
    {
        for (int x = 0; x < d_content.width(); ++x)
        {
            argb_t colour = 0xFFFFFFFF;
            if (d_content.elementAtLocation(x, y))
                colour = 0xFF0000FF;

            img->render(*d_geometry,
                        Vector2f(x * square_size.d_width + 1, y * square_size.d_height + 1),
                        Sizef(square_size.d_width - 2, square_size.d_height - 2), 0,
                        ColourRect(colour));
        }
    }
}
//----------------------------------------------------------------------------//
void OpenGLGLXPBTextureTarget::initialisePBuffer()
{
    int creation_attrs[] =
    {
        GLX_PBUFFER_WIDTH, d_area.getWidth(),
        GLX_PBUFFER_HEIGHT, d_area.getHeight(),
        GLX_LARGEST_PBUFFER, True,
        GLX_PRESERVED_CONTENTS, True,
        None
    };

    // release any existing pbuffer
    if (d_pbuffer)
        glXDestroyPbuffer(d_dpy, d_pbuffer);

    d_pbuffer = glXCreatePbuffer(d_dpy, d_fbconfig, creation_attrs);

    if (!d_pbuffer)
        CEGUI_THROW(RendererException(
            "pbuffer creation error:  glXCreatePbuffer() failed"));

    // get the real size of the buffer that was created
    GLuint actual_width, actual_height;
    glXQueryDrawable(d_dpy, d_pbuffer, GLX_WIDTH, &actual_width);
    glXQueryDrawable(d_dpy, d_pbuffer, GLX_HEIGHT, &actual_height);
    d_area.setSize(Sizef(actual_width, actual_height));

    // ensure CEGUI::Texture is wrapping real GL texture and has correct size
    d_CEGUITexture->setOpenGLTexture(d_texture, d_area.getSize());
}
Beispiel #12
0
//----------------------------------------------------------------------------//
SVGImage::SVGImage(const XMLAttributes& attributes) :
    Image(attributes.getValueAsString(ImageNameAttribute),
          glm::vec2(static_cast<float>(attributes.getValueAsInteger(ImageXOffsetAttribute, 0)),
                    static_cast<float>(attributes.getValueAsInteger(ImageYOffsetAttribute, 0))),
          Rectf(glm::vec2(static_cast<float>(attributes.getValueAsInteger(ImageXPosAttribute, 0)),
                          static_cast<float>(attributes.getValueAsInteger(ImageYPosAttribute, 0))),
                Sizef(static_cast<float>(attributes.getValueAsInteger(ImageWidthAttribute, 0)),
                      static_cast<float>(attributes.getValueAsInteger(ImageHeightAttribute, 0)))),
          PropertyHelper<AutoScaledMode>::fromString(attributes.getValueAsString(ImageAutoScaledAttribute)),
          Sizef(static_cast<float>(attributes.getValueAsInteger(ImageNativeHorzResAttribute, 640)),
                static_cast<float>(attributes.getValueAsInteger(ImageNativeVertResAttribute, 480)))),
    d_svgData(&SVGDataManager::getSingleton().getSVGData(
              attributes.getValueAsString(ImageSVGDataAttribute))),
    d_useGeometryAntialiasing(true)
{
}
Beispiel #13
0
//----------------------------------------------------------------------------//
OpenGLRenderer::OpenGLRenderer(const TextureTargetType tt_type) :
    d_displayDPI(96, 96),
    d_initExtraStates(false),
    d_activeBlendMode(BM_INVALID)
{
    // get rough max texture size
    GLint max_tex_size;
    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size);
    d_maxTextureSize = max_tex_size;

    // initialise display size
    GLint vp[4];
    glGetIntegerv(GL_VIEWPORT, vp);
    d_displaySize = Sizef(static_cast<float>(vp[2]), static_cast<float>(vp[3]));

    initialiseGLExtensions();
    initialiseTextureTargetFactory(tt_type);

    // we _really_ need separate rgb/alpha blend modes, if this support is not
    // available, add a note to the renderer ID string so that this fact is
    // logged.
    if (!GLEW_VERSION_1_4 && !GLEW_EXT_blend_func_separate)
        d_rendererID += "  No glBlendFuncSeparate(EXT) support.";

    d_defaultTarget = new OpenGLViewportTarget(*this);
}
Beispiel #14
0
//----------------------------------------------------------------------------//
OpenGL3Renderer::OpenGL3Renderer() :
    d_displayDPI(96, 96),
    d_initExtraStates(false),
    d_activeBlendMode(BM_INVALID),
    d_shaderStandard(0),
    d_viewProjectionMatrix(0),
    d_activeRenderTarget(0),
    d_openGLStateChanger(0),
    d_shaderManager(0)
{
    // get rough max texture size
    GLint max_tex_size;
    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size);
    d_maxTextureSize = max_tex_size;

    // initialise display size
    GLint vp[4];
    glGetIntegerv(GL_VIEWPORT, vp);
    d_displaySize = Sizef(static_cast<float>(vp[2]), static_cast<float>(vp[3]));

    initialiseGLExtensions();
    initialiseTextureTargetFactory();
    initialiseOpenGLShaders();

    d_defaultTarget = new OpenGL3ViewportTarget(*this);
    d_openGLStateChanger = new OpenGL3StateChangeWrapper(*this);

    d_viewProjectionMatrix = new mat4Pimpl();
}
Beispiel #15
0
//----------------------------------------------------------------------------//
void OgreTextureTarget::declareRenderSize(const Sizef& sz)
{
    // exit if current size is enough
    if ((d_area.getWidth() >= sz.d_width) && (d_area.getHeight() >=sz.d_height))
        return;

    Ogre::TexturePtr rttTex = Ogre::TextureManager::getSingleton().createManual(
        OgreTexture::getUniqueName(),
        Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        Ogre::TEX_TYPE_2D, sz.d_width, sz.d_height, 1, 0, Ogre::PF_A8R8G8B8,
        Ogre::TU_RENDERTARGET);

    d_renderTarget = rttTex->getBuffer()->getRenderTarget();

    Rectf init_area(
        Vector2f(0, 0),
        Sizef(d_renderTarget->getWidth(), d_renderTarget->getHeight())
    );

    setArea(init_area);

    // delete viewport and reset ptr so a new one is generated.  This is
    // required because we have changed d_renderTarget so need a new VP also.
    delete d_viewport;
    d_viewport = 0;

    // because Texture takes ownership, the act of setting the new ogre texture
    // also ensures any previous ogre texture is released.
    d_CEGUITexture->setOgreTexture(rttTex, true);

    clear();
}
Beispiel #16
0
//----------------------------------------------------------------------------//
OpenGLWGLPBTextureTarget::OpenGLWGLPBTextureTarget(OpenGLRendererBase& owner) :
    OpenGLTextureTarget(owner),
    d_pixfmt(0),
    d_pbuffer(0),
    d_context(0),
    d_hdc(0),
    d_prevContext(0),
    d_prevDC(0)
{
    if (!WGLEW_ARB_pbuffer)
        CEGUI_THROW(RendererException("WGL_ARB_pbuffer extension is needed to "
            "use OpenGLWGLPBTextureTarget!"));

    HDC hdc = wglGetCurrentDC();

    uint fmtcnt;
    wglChoosePixelFormatARB(hdc, pbAttrs, 0, 1, &d_pixfmt, &fmtcnt);

    if (!fmtcnt)
        CEGUI_THROW(RendererException(
            "pbuff creation failure, no suitable pixel formats."));

    initialiseTexture();

    // set default size (and cause initialisation of the pbuffer)
    declareRenderSize(Sizef(DEFAULT_SIZE, DEFAULT_SIZE));
}
Rectf
GraphicContextState::get_clip_rect()
{
  return Rectf(Vector2f(-impl->offset.x,
                        -impl->offset.y),
               Sizef(static_cast<float>(get_width())  / impl->zoom,
                     static_cast<float>(get_height()) / impl->zoom));
}
Beispiel #18
0
void
Dialog::set_text(const std::string& text)
{
  m_text = text;

  m_text_size = Sizef(Resources::normal_font->get_text_width(m_text),
                      Resources::normal_font->get_text_height(m_text));

}
//----------------------------------------------------------------------------//
void OpenGLApplePBTextureTarget::restoreTexture()
{
    const Sizef sz(d_area.getSize());
    d_area.setSize(Sizef(0.0f, 0.0f));

    OpenGLTextureTarget::restoreTexture();
    initialiseTexture();
    declareRenderSize(sz);
}
//----------------------------------------------------------------------------//
NullTextureTarget::NullTextureTarget(NullRenderer& owner) :
    NullRenderTarget<TextureTarget>(owner),
    d_CEGUITexture(0)
{
    d_CEGUITexture = static_cast<NullTexture*>(
        &d_owner.createTexture(generateTextureName()));

    // setup area and cause the initial texture to be generated.
    declareRenderSize(Sizef(DEFAULT_SIZE, DEFAULT_SIZE));
}
Beispiel #21
0
//----------------------------------------------------------------------------//
void OgreWindowTarget::initRenderTarget(Ogre::RenderTarget& target)
{
    d_renderTarget = &target;

    Rectf init_area(glm::vec2(0.0f, 0.0f),
                    Sizef(static_cast<float>(d_renderTarget->getWidth()), 
                          static_cast<float>(d_renderTarget->getHeight())) );

    setArea(init_area);
}
Beispiel #22
0
//----------------------------------------------------------------------------//
void DirectFBTexture::cleanupDirectFBTexture()
{
    if (!d_texture)
        return;

    d_texture->Release(d_texture);
    d_texture = 0;
    d_size = d_dataSize = Sizef(0,0);
    updateCachedScaleValues();
}
void
ControllerHelpWindow::draw()
{
  const Controller& controller = InputManagerSDL::current()->get_controller();

  Vector2f pos(static_cast<float>(Display::get_width())  - 350.0f - 16.0f, 
               static_cast<float>(Display::get_height()) - 200.0f - 16.0f);

  Display::fill_rounded_rect(Rectf(pos, Sizef(350, 200)), 10.0f, Color(0.0f, 0.0f, 0.25f, 0.9f));
  Display::draw_rounded_rect(Rectf(pos, Sizef(350, 200)), 10.0f, Color(1.0f, 1.0f, 1.0f,  0.5f));

  draw_stick(pos + Vector2f(50, 75),
             controller.get_button_state(LEFT_STICK_BUTTON),
             controller.get_axis_state(X_AXIS),
             controller.get_axis_state(Y_AXIS));

  draw_stick(pos + Vector2f(250, 150),
             controller.get_button_state(RIGHT_STICK_BUTTON),
             controller.get_axis_state(X2_AXIS),
             controller.get_axis_state(Y2_AXIS));

  draw_trigger(pos + Vector2f(45,  20), controller.get_trigger_state(LEFT_TRIGGER_AXIS));
  draw_trigger(pos + Vector2f(305, 20), controller.get_trigger_state(RIGHT_TRIGGER_AXIS));

  draw_button(pos + Vector2f(125, 75), controller.get_button_state(SELECT_BUTTON));
  draw_button(pos + Vector2f(225, 75), controller.get_button_state(START_BUTTON));

  draw_button(pos + Vector2f(100, 22), controller.get_button_state(LEFT_SHOULDER_BUTTON));
  draw_button(pos + Vector2f(250, 22), controller.get_button_state(RIGHT_SHOULDER_BUTTON));

  Vector2f face_pos(300, 75);
  draw_button(pos + face_pos + Vector2f(  0,  25), controller.get_button_state(PRIMARY_BUTTON));
  draw_button(pos + face_pos + Vector2f (25,   0), controller.get_button_state(SECONDARY_BUTTON));
  draw_button(pos + face_pos + Vector2f(-25,   0), controller.get_button_state(TERTIARY_BUTTON));
  draw_button(pos + face_pos + Vector2f(  0, -25), controller.get_button_state(QUATERNARY_BUTTON));

  Vector2f dpad_pos(100, 150);
  draw_button(pos + dpad_pos + Vector2f(  0,  25), controller.get_button_state(MENU_DOWN_BUTTON));
  draw_button(pos + dpad_pos + Vector2f (25,   0), controller.get_button_state(MENU_RIGHT_BUTTON));
  draw_button(pos + dpad_pos + Vector2f(-25,   0), controller.get_button_state(MENU_LEFT_BUTTON));
  draw_button(pos + dpad_pos + Vector2f(  0, -25), controller.get_button_state(MENU_UP_BUTTON));
}
Beispiel #24
0
//----------------------------------------------------------------------------//
SVGImage::SVGImage(const String& name, SVGData& svg_data) :
    Image(name,
          glm::vec2(0.0f, 0.0f),
          Rectf(glm::vec2(0.0f, 0.0f),
                glm::vec2(svg_data.getWidth(), svg_data.getHeight())),
          ASM_Disabled,
          Sizef(640, 480)),
    d_svgData(&svg_data),
    d_useGeometryAntialiasing(true)
{
}
Beispiel #25
0
//----------------------------------------------------------------------------//
DirectFBRenderTarget::DirectFBRenderTarget(DirectFBRenderer& owner,
                                           IDirectFBSurface& target) :
    d_owner(owner),
    d_target(target),
    d_area(0, 0, 0, 0)
{
    int w, h;
    d_target.GetSize(&d_target, &w, &h);
    setArea(Rectf(d_area.getPosition(),
                 Sizef(static_cast<float>(w), static_cast<float>(h))));
}
Beispiel #26
0
//----------------------------------------------------------------------------//
OgreTextureTarget::OgreTextureTarget(OgreRenderer& owner,
                                     Ogre::RenderSystem& rs) :
    OgreRenderTarget<TextureTarget>(owner, rs),
    d_CEGUITexture(0)
{
    d_CEGUITexture = static_cast<OgreTexture*>(
        &d_owner.createTexture(generateTextureName()));

    // setup area and cause the initial texture to be generated.
    declareRenderSize(Sizef(DEFAULT_SIZE, DEFAULT_SIZE));
}
Beispiel #27
0
//----------------------------------------------------------------------------//
OpenGLViewportTarget::OpenGLViewportTarget(OpenGLRendererBase& owner) :
    OpenGLRenderTarget<>(owner)
{
    // viewport area defaults to whatever the current OpenGL viewport is set to
    GLint vp[4];
    glGetIntegerv(GL_VIEWPORT, vp);

    Rectf init_area(Vector2f(static_cast<float>(vp[0]), static_cast<float>(vp[1])),
                        Sizef(static_cast<float>(vp[2]), static_cast<float>(vp[3])));

    setArea(init_area);
}
//----------------------------------------------------------------------------//
Sizef Direct3D9Renderer::getViewportSize()
{
    D3DVIEWPORT9 vp;

    if (FAILED(d_device->GetViewport(&vp)))
        CEGUI_THROW(RendererException(
            "Unable to access required view port information from "
            "Direct3DDevice9."));
    else
        return Sizef(static_cast<float>(vp.Width),
                      static_cast<float>(vp.Height));
}
//----------------------------------------------------------------------------//
void FalagardTreeView::onLookNFeelAssigned()
{
    const WidgetLookFeel& wlf = getLookNFeel();
    d_subtreeExpanderImagery = &wlf.getImagerySection("SubtreeExpander");
    d_subtreeCollapserImagery = &wlf.getImagerySection("SubtreeCollapser");

    Sizef open_size = getImagerySize(*d_subtreeExpanderImagery);
    Sizef close_size = getImagerySize(*d_subtreeCollapserImagery);
    d_subtreeExpanderImagerySize = Sizef(
        (open_size.d_width + close_size.d_width) / 2.0f + getView()->getSubtreeExpanderMargin(),
        (open_size.d_height + close_size.d_height) / 2.0f + getView()->getSubtreeExpanderMargin());
}
	GraphicContext_State::GraphicContext_State()
	{
		textures.reserve(8);	// Reserse space for 8 unit indexes
		viewport.resize(1);		// Always have a minimum of 1 viewport
		depth_range.push_back(Sizef(0.0f, 1.0f));		// Always have a minimum of 1 viewport
		scissor_set = false;
		program_standard_set = false;
		blend_color = Colorf::white;
		sample_mask = 0xffffffff;
		stencil_ref = 0;
		draw_buffer = buffer_back;
	}