Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8261 was 8145, checked in by bensch, 19 years ago

trunk: merged the gui back
merged with command:
svn merge -r8114:HEAD https://svn.orxonox.net/orxonox/branches/gui .
→ no conflicts

File size: 1.9 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
[7779]20namespace OrxGui
[3365]21{
[4320]22
[7779]23  /**
24   * standard constructor
25  */
26  GLGuiImage::GLGuiImage ()
27  {
28    this->init();
[1853]29
[7779]30  }
[1853]31
[5360]32
[7779]33  /**
34   * standard deconstructor
35  */
36  GLGuiImage::~GLGuiImage()
37  {
38  }
[5360]39
[7779]40  /**
41   * initializes the GUI-element
42   */
43  void GLGuiImage::init()
44  {
[8035]45    this->setClassID(CL_GLGUI_IMAGE, "GLGuiImage");
[5360]46
[8035]47    this->frontMaterial().setDiffuseMap(this->texture);
48    this->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
49
50    this->resize();
[7779]51  }
[5360]52
[8035]53
54  void GLGuiImage::loadImageFromTexture(const Texture& texture)
55  {
56    this->frontMaterial().setDiffuseMap(texture);
57    this->frontMaterial().setDiffuse(1,1,1);
58  }
59
60  void GLGuiImage::loadImageFromFile(const std::string& fileName)
61  {
62    this->texture.loadImage(fileName);
63  }
64
65  void GLGuiImage::loadImageFromSDLSurface(SDL_Surface* surface)
66  {
67    //this->texture.loadSurface(surface);
68  }
69
70  void GLGuiImage::loadImageFromDisplayList(GLuint texture)
71  {
72//    this->texture.setTexture(texture);
73  }
74
75  void GLGuiImage::resize()
76  {
[8117]77    this->frontRect().setTopLeft(this->borderLeft(), this->borderTop());
[8115]78    this->frontRect().setSize(this->getSizeX2D() - (borderLeft() + borderRight()), this->getSizeY2D() - (borderTop() + borderBottom()) );
[8035]79    GLGuiWidget::resize();
80  }
81
82
[7779]83  /**
[8035]84   * @brief draws the GLGuiImage
[7779]85   */
[8035]86  void GLGuiImage::draw() const
[7779]87  {
[8035]88    this->beginDraw();
89    GLGuiWidget::draw();
90
91    this->frontMaterial().select();
92    this->drawRect(this->frontRect());
93    this->endDraw();
[7779]94  }
[5360]95}
Note: See TracBrowser for help on using the repository browser.