Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/parenting/src/glmenu_imagescreen.cc @ 3358

Last change on this file since 3358 was 3358, checked in by patrick, 19 years ago

orxonox/branches/parenting: imageloader works. but not yet fully implemented

File size: 3.0 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer:
16*/
17
18
19#include "glmenu_imagescreen.h"
20#include "importer/texture.h"
21
22using namespace std;
23
24
25/**
26   \brief standard constructor
27
28   \todo this constructor is not jet implemented - do it
29*/
30GLMenuImageScreen::GLMenuImageScreen () 
31{
32   this->setClassName ("GLMenuImageScreen");
33}
34
35
36/**
37   \brief standard deconstructor
38
39   \todo this deconstructor is not jet implemented - do it
40*/
41GLMenuImageScreen::~GLMenuImageScreen () {}
42
43
44/**
45   \brief function to init the screen
46*/
47void GLMenuImageScreen::init ()
48{
49  int w = 680;
50  int h = 480;
51
52  glViewport(0,0,w,h);
53 
54  glMatrixMode(GL_PROJECTION);
55  glLoadIdentity(); 
56  gluPerspective(45.0f,(GLfloat)w/(GLfloat)h, .5f ,150.0f);
57  glMatrixMode(GL_MODELVIEW); 
58
59  this->backTex = new Texture();
60  this->backTex->loadImage("orx_tex.bmp");
61
62  /* ------------painten */
63
64  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
65  glLoadIdentity();
66  gluLookAt(0, 0, 6,     0, 0, 0,     0, 1, 0);
67
68  // Bind the texture stored at the zero index of g_Texture[]
69  //glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
70}
71
72
73/**
74   \brief function to innit screen with all attributes set
75   \param name of the background-image file
76   \param height of the ImageScreen
77   \param width of the Image Screen
78   \param x offset from (0, 0)
79   \param y offset from (0, 0)
80
81   GLMenu uses its own coordinating system: upper left corner is (0, 0). x-axis is down=height,
82   right axis is right direction (=width)
83*/
84void GLMenuImageScreen::init (char* backImageName, float height, float width, 
85                              float offsetX, float offsetY)
86{}
87
88
89/**
90   \brief draws the ImageScreen to the screenbuffer
91*/
92void GLMenuImageScreen::draw ()
93{
94  // Display a quad texture to the screen
95  glBegin(GL_QUADS);
96 
97  // Display the top left vertice
98  glTexCoord2f(0.0f, 1.0f);
99  glVertex3f(-2.5, 2.5, 0);
100 
101  // Display the bottom left vertice
102  glTexCoord2f(0.0f, 0.0f);
103  glVertex3f(-2.5, -2.5, 0);
104 
105  // Display the bottom right vertice
106  glTexCoord2f(1.0f, 0.0f);
107  glVertex3f(2.5, -2.5, 0);
108 
109  // Display the top right vertice
110  glTexCoord2f(1.0f, 1.0f);
111  glVertex3f(2.5, 2.5, 0);
112
113  glEnd();
114 
115  SDL_GL_SwapBuffers();                   
116
117  delete this->backTex;
118  SDL_Delay(1000);
119}
120
121 
122/**
123    \brief sets the background image name
124    \param file name of the backgroun-image
125 */
126void GLMenuImageScreen::setBackImageName (char* backImageName)
127{}
128
129
130/**
131   \brief sets position of the ImageScreen
132   \param x offset from (0, 0)
133   \param y offset from (0, 0)
134*/
135void GLMenuImageScreen::setPosition(float offsetX, float offsetY)
136{}
137
138
139/*
140  \brief sets size of the ImageScreen
141  \param height of the ImageScreen
142  \param width of the Image Screen
143*/
144void GLMenuImageScreen::setSize(float height, float width)
145{}
Note: See TracBrowser for help on using the repository browser.