Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10610 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 2.1 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{
[9869]24  ObjectListDefinition(GLGuiImage);
[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  {
[9869]47    this->registerObject(this, GLGuiImage::_objectList);
[5360]48
[8619]49    this->setForegroundColor(Color(1,1,1,1));
[8448]50    this->_imageMaterial.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
[8035]51
52    this->resize();
[7779]53  }
[5360]54
[8035]55
56  void GLGuiImage::loadImageFromTexture(const Texture& texture)
57  {
[8448]58    this->_imageMaterial.setDiffuseMap(texture);
[8035]59  }
60
61  void GLGuiImage::loadImageFromFile(const std::string& fileName)
62  {
[8448]63    this->_imageMaterial.setDiffuseMap(fileName);
[8035]64  }
65
66  void GLGuiImage::loadImageFromSDLSurface(SDL_Surface* surface)
67  {
[8448]68    this->_imageMaterial.setDiffuseMap(Texture(surface));
[8035]69  }
70
71  void GLGuiImage::loadImageFromDisplayList(GLuint texture)
72  {
[8448]73    PRINTF(2)("SORRY NOT IMPLEMENTED\n");
74//    this->_imageMaterial.setTexture(texture);
[8035]75  }
76
[8448]77  void GLGuiImage::updateFrontColor()
78  {
[8619]79    this->_imageMaterial.setDiffuseColor(foregroundColor());
[8448]80  }
81
[8035]82  void GLGuiImage::resize()
83  {
[8619]84    this->_imagePlane.setTopLeft(borderLeft(), borderTop());
[8448]85    this->_imagePlane.setSize(this->getSizeX2D() - (borderLeft() + borderRight()), this->getSizeY2D() - (borderTop() + borderBottom()) );
[8035]86    GLGuiWidget::resize();
87  }
88
89
[7779]90  /**
[8035]91   * @brief draws the GLGuiImage
[7779]92   */
[8035]93  void GLGuiImage::draw() const
[7779]94  {
[8035]95    this->beginDraw();
96    GLGuiWidget::draw();
97
[8448]98    this->_imageMaterial.select();
99    this->drawRect(this->_imagePlane);
[8035]100    this->endDraw();
[7779]101  }
[5360]102}
Note: See TracBrowser for help on using the repository browser.