Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/atmospheric_engine/src/lib/gui/gl/glgui_image.cc @ 8663

Last change on this file since 8663 was 8448, checked in by bensch, 19 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
Line 
1/*
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.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
17
18#include "glgui_image.h"
19
20#include "debug.h"
21
22namespace OrxGui
23{
24
25  /**
26   * standard constructor
27  */
28  GLGuiImage::GLGuiImage ()
29  {
30    this->init();
31
32  }
33
34
35  /**
36   * standard deconstructor
37  */
38  GLGuiImage::~GLGuiImage()
39  {
40  }
41
42  /**
43   * initializes the GUI-element
44   */
45  void GLGuiImage::init()
46  {
47    this->setClassID(CL_GLGUI_IMAGE, "GLGuiImage");
48
49    this->_imageMaterial.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
50
51    this->resize();
52  }
53
54
55  void GLGuiImage::loadImageFromTexture(const Texture& texture)
56  {
57    this->_imageMaterial.setDiffuseMap(texture);
58  }
59
60  void GLGuiImage::loadImageFromFile(const std::string& fileName)
61  {
62    this->_imageMaterial.setDiffuseMap(fileName);
63  }
64
65  void GLGuiImage::loadImageFromSDLSurface(SDL_Surface* surface)
66  {
67    this->_imageMaterial.setDiffuseMap(Texture(surface));
68  }
69
70  void GLGuiImage::loadImageFromDisplayList(GLuint texture)
71  {
72    PRINTF(2)("SORRY NOT IMPLEMENTED\n");
73//    this->_imageMaterial.setTexture(texture);
74  }
75
76  void GLGuiImage::updateFrontColor()
77  {
78    this->_imageMaterial.setDiffuseColor(this->frontColor());
79  }
80
81  void GLGuiImage::resize()
82  {
83    this->_imagePlane.setTopLeft(this->borderLeft(), this->borderTop());
84    this->_imagePlane.setSize(this->getSizeX2D() - (borderLeft() + borderRight()), this->getSizeY2D() - (borderTop() + borderBottom()) );
85    GLGuiWidget::resize();
86  }
87
88
89  /**
90   * @brief draws the GLGuiImage
91   */
92  void GLGuiImage::draw() const
93  {
94    this->beginDraw();
95    GLGuiWidget::draw();
96
97    this->_imageMaterial.select();
98    this->drawRect(this->_imagePlane);
99    this->endDraw();
100  }
101}
Note: See TracBrowser for help on using the repository browser.