Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8299 in orxonox.OLD for trunk/src/lib/gui


Ignore:
Timestamp:
Jun 9, 2006, 3:17:28 AM (19 years ago)
Author:
bensch
Message:

gui: YEAH. the cursor works quite cool :)

Location:
trunk/src/lib/gui/gl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl/glgui_cursor.cc

    r8298 r8299  
    2121#include "color.h"
    2222#include "texture_sequence.h"
    23 
     23#include "loading/resource_manager.h" // HACK
    2424
    2525namespace OrxGui
     
    6262    this->backMaterial().setDiffuseMap("cursor.png");
    6363    this->backMaterial().setBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    64     this->setSize2D(20, 30);
     64    this->setSize2D(50, 50);
    6565    this->setAbsCoor2D(100, 100);
    6666    this->setLayer(E2D_LAYER_ABOVE_ALL);
    6767    this->color = 0.0f;
    6868
    69     TextureSequence* seq = new TextureSequence();
    70     seq->loadImageSeries("reap_mouse/reap_mouse_##", 0, 49, "tif");
     69    this->seq = new TextureSequence();
     70    this->seq->loadImageSeries(ResourceManager::getInstance()->getDataDir() + "/maps/reap_mouse/reap_mouse_##", 0, 49, "tif");
    7171
    7272    this->resize();
     
    7575  void GLGuiCursor::tick(float dt)
    7676  {
     77    this->frameNumber += 25.0*dt;
     78    if (frameNumber >= this->seq->getFrameCount())
     79      frameNumber = 0.0;
     80
    7781    this->color += dt*10.0;
    7882    if (this->color > 360.0)
     
    106110  {
    107111    this->beginDraw();
    108     GLGuiWidget::draw();
     112    // HACK
     113    glActiveTexture(GL_TEXTURE0);
     114    glEnable(GL_TEXTURE_2D);
     115    glBindTexture(GL_TEXTURE_2D, this->seq->getFrameTexture((int)frameNumber));
     116    glColor3f(1,1,1);
     117    glEnable(GL_BLEND);
     118    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     119    this->drawRect(this->backRect());
     120
     121    //GLGuiWidget::draw();
    109122    this->endDraw();
    110123  }
  • trunk/src/lib/gui/gl/glgui_cursor.h

    r8145 r8299  
    1111#include "event_listener.h"
    1212#include "vector2D.h"
     13
     14class TextureSequence;
    1315
    1416namespace OrxGui
     
    4951
    5052    static float _mouseSensitivity;
     53    TextureSequence* seq;
     54    float frameNumber;
    5155
    5256  };
Note: See TracChangeset for help on using the changeset viewer.