From e06c097dbfbebee3c03bf82cdcd05805f546a61d Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 27 Aug 2008 15:01:16 +0000 Subject: rename Menu part2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1310 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDrawTexture.pas | 105 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/menu/UDrawTexture.pas (limited to 'src/menu/UDrawTexture.pas') diff --git a/src/menu/UDrawTexture.pas b/src/menu/UDrawTexture.pas new file mode 100644 index 00000000..a7dde18f --- /dev/null +++ b/src/menu/UDrawTexture.pas @@ -0,0 +1,105 @@ +unit UDrawTexture; + +interface + +{$I switches.inc} + +uses UTexture; + +procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); +procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); +procedure DrawTexture(Texture: TTexture); + +implementation + +uses gl; + +procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); +begin + glColor3f(ColR, ColG, ColB); + glBegin(GL_LINES); + glVertex2f(x1, y1); + glVertex2f(x2, y2); + glEnd; +end; + +procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); +begin + glColor3f(ColR, ColG, ColB); + glBegin(GL_QUADS); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; +end; + +procedure DrawTexture(Texture: TTexture); +var + x1, x2, x3, x4: real; + y1, y2, y3, y4: real; + xt1, xt2, xt3, xt4: real; + yt1, yt2, yt3, yt4: real; +begin + with Texture do begin + // rysuje paski gracza + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glDepthRange(0, 10); + glDepthFunc(GL_LEQUAL); +// glDepthFunc(GL_GEQUAL); + glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +// glBlendFunc(GL_SRC_COLOR, GL_ZERO); + glBindTexture(GL_TEXTURE_2D, TexNum); + + x1 := x; + x2 := x; + x3 := x+w*scaleW; + x4 := x+w*scaleW; + y1 := y; + y2 := y+h*scaleH; + y3 := y+h*scaleH; + y4 := y; + if Rot <> 0 then begin + xt1 := x1 - (x + w/2); + xt2 := x2 - (x + w/2); + xt3 := x3 - (x + w/2); + xt4 := x4 - (x + w/2); + yt1 := y1 - (y + h/2); + yt2 := y2 - (y + h/2); + yt3 := y3 - (y + h/2); + yt4 := y4 - (y + h/2); + + x1 := (x + w/2) + xt1 * cos(Rot) - yt1 * sin(Rot); + x2 := (x + w/2) + xt2 * cos(Rot) - yt2 * sin(Rot); + x3 := (x + w/2) + xt3 * cos(Rot) - yt3 * sin(Rot); + x4 := (x + w/2) + xt4 * cos(Rot) - yt4 * sin(Rot); + + y1 := (y + h/2) + yt1 * cos(Rot) + xt1 * sin(Rot); + y2 := (y + h/2) + yt2 * cos(Rot) + xt2 * sin(Rot); + y3 := (y + h/2) + yt3 * cos(Rot) + xt3 * sin(Rot); + y4 := (y + h/2) + yt4 * cos(Rot) + xt4 * sin(Rot); + + end; + +{ glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex3f(x1, y1, z); + glTexCoord2f(0, TexH); glVertex3f(x2, y2, z); + glTexCoord2f(TexW, TexH); glVertex3f(x3, y3, z); + glTexCoord2f(TexW, 0); glVertex3f(x4, y4, z); + glEnd;} + + glBegin(GL_QUADS); + glTexCoord2f(TexX1*TexW, TexY1*TexH); glVertex3f(x1, y1, z); + glTexCoord2f(TexX1*TexW, TexY2*TexH); glVertex3f(x2, y2, z); + glTexCoord2f(TexX2*TexW, TexY2*TexH); glVertex3f(x3, y3, z); + glTexCoord2f(TexX2*TexW, TexY1*TexH); glVertex3f(x4, y4, z); + glEnd; + end; + glDisable(GL_DEPTH_TEST); + glDisable(GL_TEXTURE_2D); +end; + +end. -- cgit v1.2.3 From 1ef212ba89e50965b6b3b2d756be2c17e110b3ee Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 6 Sep 2008 09:53:53 +0000 Subject: Delphi-mode set for FPC git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1348 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDrawTexture.pas | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/menu/UDrawTexture.pas') diff --git a/src/menu/UDrawTexture.pas b/src/menu/UDrawTexture.pas index a7dde18f..3ea1c5eb 100644 --- a/src/menu/UDrawTexture.pas +++ b/src/menu/UDrawTexture.pas @@ -2,6 +2,10 @@ unit UDrawTexture; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses UTexture; -- cgit v1.2.3 From dbf39d5bfc56c24a67d481187c619dc84828221f Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 23 Sep 2008 21:17:22 +0000 Subject: gpl header added and property svn:header set to "HeadURL Id" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1403 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDrawTexture.pas | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/menu/UDrawTexture.pas') diff --git a/src/menu/UDrawTexture.pas b/src/menu/UDrawTexture.pas index 3ea1c5eb..cb4daa61 100644 --- a/src/menu/UDrawTexture.pas +++ b/src/menu/UDrawTexture.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UDrawTexture; interface -- cgit v1.2.3 From 015b6c092b0779ee9b53ed1ee78044737f8dc592 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 23 Sep 2008 21:43:52 +0000 Subject: indentation unified, no code change. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1406 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDrawTexture.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/menu/UDrawTexture.pas') diff --git a/src/menu/UDrawTexture.pas b/src/menu/UDrawTexture.pas index cb4daa61..2f3e4abe 100644 --- a/src/menu/UDrawTexture.pas +++ b/src/menu/UDrawTexture.pas @@ -33,7 +33,8 @@ interface {$I switches.inc} -uses UTexture; +uses + UTexture; procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); -- cgit v1.2.3 From 2b99e27aee7efb65f25b2444e6b574c8c66b7e2e Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 23 Sep 2008 22:17:59 +0000 Subject: indentation, no code change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1409 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDrawTexture.pas | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/menu/UDrawTexture.pas') diff --git a/src/menu/UDrawTexture.pas b/src/menu/UDrawTexture.pas index 2f3e4abe..92837fab 100644 --- a/src/menu/UDrawTexture.pas +++ b/src/menu/UDrawTexture.pas @@ -37,23 +37,26 @@ uses UTexture; procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); -procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); +procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); procedure DrawTexture(Texture: TTexture); implementation -uses gl; +uses + gl; procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); + begin glColor3f(ColR, ColG, ColB); glBegin(GL_LINES); - glVertex2f(x1, y1); - glVertex2f(x2, y2); + glVertex2f(x1, y1); + glVertex2f(x2, y2); glEnd; end; procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); + begin glColor3f(ColR, ColG, ColB); glBegin(GL_QUADS); @@ -65,13 +68,16 @@ begin end; procedure DrawTexture(Texture: TTexture); + var - x1, x2, x3, x4: real; - y1, y2, y3, y4: real; - xt1, xt2, xt3, xt4: real; - yt1, yt2, yt3, yt4: real; + x1, x2, x3, x4: real; + y1, y2, y3, y4: real; + xt1, xt2, xt3, xt4: real; + yt1, yt2, yt3, yt4: real; + begin - with Texture do begin + with Texture do + begin // rysuje paski gracza glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha); glEnable(GL_TEXTURE_2D); @@ -92,7 +98,8 @@ begin y2 := y+h*scaleH; y3 := y+h*scaleH; y4 := y; - if Rot <> 0 then begin + if Rot <> 0 then + begin xt1 := x1 - (x + w/2); xt2 := x2 - (x + w/2); xt3 := x3 - (x + w/2); @@ -114,12 +121,14 @@ begin end; -{ glBegin(GL_QUADS); +{ + glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(x1, y1, z); glTexCoord2f(0, TexH); glVertex3f(x2, y2, z); glTexCoord2f(TexW, TexH); glVertex3f(x3, y3, z); glTexCoord2f(TexW, 0); glVertex3f(x4, y4, z); - glEnd;} + glEnd; +} glBegin(GL_QUADS); glTexCoord2f(TexX1*TexW, TexY1*TexH); glVertex3f(x1, y1, z); -- cgit v1.2.3 From ab1423bcf52ec322218fa6a7351795da38e16da5 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 23 Sep 2008 22:24:27 +0000 Subject: indentation, no code change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1410 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDrawTexture.pas | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/menu/UDrawTexture.pas') diff --git a/src/menu/UDrawTexture.pas b/src/menu/UDrawTexture.pas index 92837fab..33082765 100644 --- a/src/menu/UDrawTexture.pas +++ b/src/menu/UDrawTexture.pas @@ -46,7 +46,6 @@ uses gl; procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); - begin glColor3f(ColR, ColG, ColB); glBegin(GL_LINES); @@ -56,7 +55,6 @@ begin end; procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); - begin glColor3f(ColR, ColG, ColB); glBegin(GL_QUADS); @@ -68,13 +66,11 @@ begin end; procedure DrawTexture(Texture: TTexture); - var x1, x2, x3, x4: real; y1, y2, y3, y4: real; xt1, xt2, xt3, xt4: real; yt1, yt2, yt3, yt4: real; - begin with Texture do begin -- cgit v1.2.3 From d33f56a40d9e8325a2782f90bb253dece5127c5f Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 3 Nov 2008 14:53:17 +0000 Subject: All comments are English now (Polish ones have been translated) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1498 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDrawTexture.pas | 1 - 1 file changed, 1 deletion(-) (limited to 'src/menu/UDrawTexture.pas') diff --git a/src/menu/UDrawTexture.pas b/src/menu/UDrawTexture.pas index 33082765..bc136f11 100644 --- a/src/menu/UDrawTexture.pas +++ b/src/menu/UDrawTexture.pas @@ -74,7 +74,6 @@ var begin with Texture do begin - // rysuje paski gracza glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); -- cgit v1.2.3