| 1 | /* ************************************************************************* * |
| 2 | SDL-Ball - DX-Ball/Breakout remake with openGL and SDL for Linux |
| 3 | Copyright (C) 2008 Jimmy Christensen ( dusted at dusted dot dk ) |
| 4 | |
| 5 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * ************************************************************************* */ |
| 18 | |
| 19 | |
| 20 | class backgroundClasscxx . . $ backgroundClass# { |
| 21 | private: |
| 22 | GLfloat rcxx . . $ backgroundClass#r.[4], gcxx . . $ backgroundClass#g.[4], bcxx . . $ backgroundClass#b.[4], acxx . . $ backgroundClass#a.; |
| 23 | |
| 24 | textureClasscxx . . $ textureClass# texcxx . . $ backgroundClass#tex.; |
| 25 | bool dircxx . . $ backgroundClass#dir.; |
| 26 | bool firstTexturecxx . . $ backgroundClass#firstTexture.; |
| 27 | public: |
| 28 | |
| 29 | |
| 30 | backgroundClasscxx . . $ backgroundClass#backgroundClass(49f6e7a06ebc5aa8).() |
| 31 | { |
| 32 | firstTexturecxx . . $ backgroundClass#firstTexture.=1; |
| 33 | } |
| 34 | |
| 35 | void initcxx . . $ backgroundClass#init(b1ea23c09f9f5a05).(textureManagercxx . . $ textureManager# & texMgr) |
| 36 | { |
| 37 | bool l; |
| 38 | //Så vi ikke kommer til at slette texture 0 første gang funktionen bliver kaldt |
| 39 | if(!firstTexturecxx . . $ backgroundClass#firstTexture.) |
| 40 | glDeleteTextures(1, &texcxx . . $ backgroundClass#tex..propcxx . . $ textureClass#prop..texturecxx . . $ texProp#texture.); |
| 41 | |
| 42 | float t = 0.25 * ((float)playercxx . . $ player..levelcxx . . $ player_struct#level.+1); |
| 43 | |
| 44 | if(t <= 1.0) |
| 45 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/1.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 46 | else if(t <= 2.0) |
| 47 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/2.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 48 | else if(t <= 3.0) |
| 49 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/3.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 50 | else if(t <= 4.0) |
| 51 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/4.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 52 | else if(t <= 5.0) |
| 53 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/5.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 54 | else if(t <= 6.0) |
| 55 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/6.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 56 | else if(t <= 7.0) |
| 57 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/7.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 58 | else if(t <= 8.0) |
| 59 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/8.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 60 | else if(t <= 9.0) |
| 61 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/9.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 62 | else if(t <= 10.0) |
| 63 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/10.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 64 | else if(t <= 11.0) |
| 65 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/11.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 66 | else if(t <= 12.0) |
| 67 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/12.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 68 | else if(t <= 13.0) |
| 69 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/13.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 70 | else if(t <= 14.0) |
| 71 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/14.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 72 | else if(t <= 15.0) |
| 73 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/15.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 74 | else if(t <= 16.0) |
| 75 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/16.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 76 | else if(t <= 17.0) |
| 77 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/17.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 78 | else if(t <= 18.0) |
| 79 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/18.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 80 | else if(t <= 19.0) |
| 81 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/19.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 82 | else if(t <= 20.0) |
| 83 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/20.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 84 | else if(t <= 21.0) |
| 85 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/21.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 86 | else if(t <= 22.0) |
| 87 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/22.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 88 | else if(t <= 23.0) |
| 89 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/23.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 90 | else if(t <= 24.0) |
| 91 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/24.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 92 | else if(t <= 25.0) |
| 93 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/25.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 94 | else |
| 95 | l=texMgr.loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/bg/final.jpg"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ backgroundClass#tex.); |
| 96 | |
| 97 | if(!l) |
| 98 | { |
| 99 | settingcxx . . $ setting..showBgcxx . . $ settings#showBg.=0; |
| 100 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Backgrounds disabled." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 101 | } |
| 102 | |
| 103 | firstTexturecxx . . $ backgroundClass#firstTexture.=0; |
| 104 | |
| 105 | for(int i = 0; i < 4; i++) |
| 106 | { |
| 107 | rcxx . . $ backgroundClass#r.[i] = rndfltcxx . . $ rndflt(d59a45cd3bfd2eda).(1,0); |
| 108 | gcxx . . $ backgroundClass#g.[i] = rndfltcxx . . $ rndflt(d59a45cd3bfd2eda).(1,0); |
| 109 | bcxx . . $ backgroundClass#b.[i] = rndfltcxx . . $ rndflt(d59a45cd3bfd2eda).(1,0); |
| 110 | } |
| 111 | acxx . . $ backgroundClass#a. = 1; |
| 112 | |
| 113 | } |
| 114 | |
| 115 | void drawcxx . . $ backgroundClass#draw(49f6e7a06ebc5aa8).() |
| 116 | { |
| 117 | |
| 118 | glLoadIdentity(); |
| 119 | glTranslatef( 0, 0, -3.0 ); |
| 120 | |
| 121 | glEnable(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!); |
| 122 | glEnable(GL_BLENDcxx . . $ `<external>/11565930711847777359/gl.h:337:9`!); |
| 123 | glBlendFunc(GL_SRC_ALPHAcxx . . $ `<external>/11565930711847777359/gl.h:344:9`!, GL_ONE_MINUS_SRC_ALPHAcxx . . $ `<external>/11565930711847777359/gl.h:345:9`!); |
| 124 | |
| 125 | glBindTexture(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, texcxx . . $ backgroundClass#tex..propcxx . . $ textureClass#prop..texturecxx . . $ texProp#texture.); |
| 126 | |
| 127 | glBegin( GL_QUADScxx . . $ `<external>/11565930711847777359/gl.h:163:9`! ); |
| 128 | glColor4f(rcxx . . $ backgroundClass#r.[0],gcxx . . $ backgroundClass#g.[0],bcxx . . $ backgroundClass#b.[0],acxx . . $ backgroundClass#a.); |
| 129 | glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.66, 1.25, 0.0f ); |
| 130 | glColor4f(rcxx . . $ backgroundClass#r.[1],gcxx . . $ backgroundClass#g.[1],bcxx . . $ backgroundClass#b.[1],acxx . . $ backgroundClass#a.); |
| 131 | glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.66, 1.25, 0.0f ); |
| 132 | glColor4f(rcxx . . $ backgroundClass#r.[2],gcxx . . $ backgroundClass#g.[2],bcxx . . $ backgroundClass#b.[2],acxx . . $ backgroundClass#a.); |
| 133 | glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.66,-1.25, 0.0f ); |
| 134 | glColor4f(rcxx . . $ backgroundClass#r.[3],gcxx . . $ backgroundClass#g.[3],bcxx . . $ backgroundClass#b.[3],acxx . . $ backgroundClass#a.); |
| 135 | glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.66,-1.25, 0.0f ); |
| 136 | glEnd( ); |
| 137 | } |
| 138 | }; |