Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/gl/glgui_image.cc @ 8471

Last change on this file since 8471 was 8448, checked in by bensch, 18 years ago

merged gui back to the trunk
merged with command
merge -r8377:HEAD https://svn.orxonox.net/orxonox/branches/gui .

File size: 2.0 KB
RevLine 
[4744]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
[5360]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[5360]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
[1853]17
[5366]18#include "glgui_image.h"
[1853]19
[8448]20#include "debug.h"
21
[7779]22namespace OrxGui
[3365]23{
[4320]24
[7779]25  /**
26   * standard constructor
27  */
28  GLGuiImage::GLGuiImage ()
29  {
30    this->init();
[1853]31
[7779]32  }
[1853]33
[5360]34
[7779]35  /**
36   * standard deconstructor
37  */
38  GLGuiImage::~GLGuiImage()
39  {
40  }
[5360]41
[7779]42  /**
43   * initializes the GUI-element
44   */
45  void GLGuiImage::init()
46  {
[8035]47    this->setClassID(CL_GLGUI_IMAGE, "GLGuiImage");
[5360]48
[8448]49    this->_imageMaterial.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
[8035]50
51    this->resize();
[7779]52  }
[5360]53
[8035]54
55  void GLGuiImage::loadImageFromTexture(const Texture& texture)
56  {
[8448]57    this->_imageMaterial.setDiffuseMap(texture);
[8035]58  }
59
60  void GLGuiImage::loadImageFromFile(const std::string& fileName)
61  {
[8448]62    this->_imageMaterial.setDiffuseMap(fileName);
[8035]63  }
64
65  void GLGuiImage::loadImageFromSDLSurface(SDL_Surface* surface)
66  {
[8448]67    this->_imageMaterial.setDiffuseMap(Texture(surface));
[8035]68  }
69
70  void GLGuiImage::loadImageFromDisplayList(GLuint texture)
71  {
[8448]72    PRINTF(2)("SORRY NOT IMPLEMENTED\n");
73//    this->_imageMaterial.setTexture(texture);
[8035]74  }
75
[8448]76  void GLGuiImage::updateFrontColor()
77  {
78    this->_imageMaterial.setDiffuseColor(this->frontColor());
79  }
80
[8035]81  void GLGuiImage::resize()
82  {
[8448]83    this->_imagePlane.setTopLeft(this->borderLeft(), this->borderTop());
84    this->_imagePlane.setSize(this->getSizeX2D() - (borderLeft() + borderRight()), this->getSizeY2D() - (borderTop() + borderBottom()) );
[8035]85    GLGuiWidget::resize();
86  }
87
88
[7779]89  /**
[8035]90   * @brief draws the GLGuiImage
[7779]91   */
[8035]92  void GLGuiImage::draw() const
[7779]93  {
[8035]94    this->beginDraw();
95    GLGuiWidget::draw();
96
[8448]97    this->_imageMaterial.select();
98    this->drawRect(this->_imagePlane);
[8035]99    this->endDraw();
[7779]100  }
[5360]101}
Note: See TracBrowser for help on using the repository browser.