fb:porticula NoPaste
oglschachbeta
Uploader: | csde_rats |
Datum/Zeit: | 21.07.2007 18:41:45 |
' Einbindung von OpenGL
#include once "GL/gl.bi"
#include once "GL/glu.bi"
#include once "2d_opengl.bi"
' Andere Includes
#include once "windows.bi"
' Definitionen
' COLORType's
type COLORType_rgb
rot as integer
gruen as integer
blau as integer
end type
type COLORType_rgba
rot as integer
gruen as integer
blau as integer
alpha as integer
end type
' Konsole
dim konsole_name as string = command(0)
dim hWndConsole as HWND = FindWindow(0, strptr(konsole_name))
if right(command(1), 5) = "debug" then ' Damit kann man -debug, #debug, bdebug usw. übergeben.
ShowWindow(hWndConsole, SW_SHOW) ' Konsole anzeigen, wenn debug übergeben wurde.
else
ShowWindow(hWndConsole, SW_HIDE) ' Konsole verbergen, wenn kein -debug übergeben wurde.
end if
' Wo sind welche Daten!?
' Hier liegen Daten
const path_data = "data/"
' Hier Bilder
const path_img = path_data + "img/"
' Hier Sound + Musikdateien
const path_snd = path_data + "snd/"
' Wie heißen die Image-Files!?
' Figuren
const file_white_bauer = path_img + "bauer_white.png"
const file_white_turm = path_img + "turm_white.png"
const file_white_laeufer = path_img + "laeufer_white.png"
const file_white_pferd = path_img + "pferd_white.png"
const file_white_koenig = path_img + "koenig_white.png"
const file_white_dame = path_img + "dame_white.png"
const file_black_bauer = path_img + "bauer_black.png"
const file_black_turm = path_img + "turm_black.png"
const file_black_laeufer = path_img + "laeufer_black.png"
const file_black_pferd = path_img + "pferd_black.png"
const file_black_koenig = path_img + "koenig_black.png"
const file_black_dame = path_img + "dame_black.png"
' Spielfelder
const file_black = path_img + "black.png"
const file_white = path_img + "white.png"
' Sonstiges
const file_escape = path_img + "escape.png"
' Texturdefinitionen
' Wie heißen die Texes!?
dim shared tex_white_bauer as GFXType
dim shared tex_white_turm as GFXType
dim shared tex_white_laeufer as GFXType
dim shared tex_white_pferd as GFXType
dim shared tex_white_koenig as GFXType
dim shared tex_white_dame as GFXType
dim shared tex_black_bauer as GFXType
dim shared tex_black_turm as GFXType
dim shared tex_black_laeufer as GFXType
dim shared tex_black_pferd as GFXType
dim shared tex_black_koenig as GFXType
dim shared tex_black_dame as GFXType
dim shared tex_white as GFXType
dim shared tex_black as GFXType
dim shared tex_escape as GFXType
' Hilsvariablen
dim reload as integer
dim at_every_end_handle as any ptr
dim shared loaded as integer = 0
dim statbarX as integer = (570/2)
dim statbarY as integer = (600/2)
' Deklarationen
declare sub at_every_end (nix as integer) ' Wird als eigener Thread gestartet
declare sub Statusanzeige (Acktuellerwert as integer, _
Endwert as integer, _
PosX as integer, _
PosY as integer) ' Stellt eine Statusbar dar.
declare sub openGL_line_b (fromX as integer, _
fromY as integer, _
toX as integer, _
toY as integer, _
z as integer, _
farbe as COLORType_rgb) ' Wie ein LINE (x,y)-(x2,y2),,B
declare sub openGL_line_bf (fromX as integer, _
fromY as integer, _
toX as integer, _
toY as integer, _
z as integer, _
farbe as COLORType_rgb) ' Wie ein LINE (x,y)-(x2,y2),,BF
declare sub escape_butt (z as integer) ' Zeichnet den "Exit"-Button
declare sub fenster () ' Erspart ein ständiges "windowtitle"...
declare sub draw_init_game (z as Integer, _
mode As Integer) ' Zeichnet das Schwarz/Weiße Spielfeld
declare sub draw_game (mode As Integer) ' Zeichnet Hintergrundfarbe, Border
declare sub anfang () ' Zeichnet die Figuren in der Ausgangsstellung
declare sub tile () ' GL_QUADS für ein 48x48px großes Quadrat
declare sub border (z as integer) ' Zeichnet den Border
declare sub bckgrnd (z as integer) ' Zeichnet die Hintergrundfarbe
declare sub lade (datei as string, _
tex as GFXType) ' Lädt eine Textur (BMP, PNG)
declare function openGL_init (win_post as string, _
X as integer, _
Y as integer, _
sdepth as integer, _
sfullscreen as integer)_
as integer ' Initialiesiert openGL
' Festlegung der Konstanten, die für den Bildschirm wichtig sind
const scrnX = 800
const scrnY = 600
const depth = 32
const fullscreen = &h0 ' Vollbildmodus ( &h0 = aus, &h1 = an )
width 80, 50
WriteToConsole "Konsole:"
WriteToConsole "Deklarationen erfolgreich...."
'at_every_end_handle = threadcreate(@at_every_end, 0)
'WriteToConsole "Thread gestartet (at_every_end, 0, Handle: " + str(at_every_end_handle) + ")"
WriteToConsole "Enviroment:"
WriteToConsole " Data-Path: " + path_data
WriteToConsole " Image-Path: " + path_img
WriteToConsole " Sound-Path: " + path_snd
WriteToConsole "Files - Figures: "
WriteToConsole " Bauer (Weiss):" + file_white_bauer
WriteToConsole " Turm (Weiss):" + file_white_turm
WriteToConsole " Laeufer (Weiss):" + file_white_laeufer
WriteToConsole " Pferd (Weiss):" + file_white_pferd
WriteToConsole " Koenig (Weiss):" + file_white_koenig
WriteToConsole " Dame (Weiss):" + file_white_dame
WriteToConsole " Bauer (Schwarz):" + file_black_bauer
WriteToConsole " Turm (Schwarz):" + file_black_turm
WriteToConsole " Laeufer (Schwarz):" + file_black_laeufer
WriteToConsole " Pferd (Schwarz):" + file_black_pferd
WriteToConsole " Koenig (Schwarz):" + file_black_koenig
WriteToConsole " Dame (Schwarz):" + file_black_dame
Screen 19, 32
loaded += 30: fenster: Statusanzeige (loaded,100,(800/2),(600/2))
WriteToConsole "Lade Texturen...."
lade file_white_bauer , tex_white_bauer : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_white_turm , tex_white_turm : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_white_laeufer , tex_white_laeufer : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_white_pferd , tex_white_pferd : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_white_koenig , tex_white_koenig : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_white_dame , tex_white_dame : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_black_bauer , tex_black_bauer : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_black_turm , tex_black_turm : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_black_laeufer , tex_black_laeufer : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_black_pferd , tex_black_pferd : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_black_koenig , tex_black_koenig : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_black_dame , tex_black_dame : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_black , tex_black : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_white , tex_white : loaded += 5: fenster: Statusanzeige (loaded,100,200,134)
lade file_escape , tex_escape
openGL_init("Schach [by csde_rats] [Loading...] [" + str(loaded) + "%]", scrnX,scrnY,depth,fullscreen)
WriteToConsole "openGL erfolgreich initialisiert (" + str(scrnX) + "." + str(scrnY) + "." + str(depth) + "." + str(fullscreen) + ")"
draw_game 1
anfang
glFlush
flip
screensync
glLoadIdentity
loaded += 5: fenster': Statusanzeige (loaded,100,200,134)
WriteToConsole "Spielfeld wurde initialisiert."
WriteToConsole "Fenstertitel reinitialisiert..."
windowtitle "Schach [by csde_rats]"
WriteToConsole "Hauptschleife hat begonnen..."
do
sleep 1
reload = 0
if multikey(&h01) = -1 then
exit do
end if
if inkey <> "" then
reload = 1
end if
if reload = 1 then
glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
draw_game(0)
glFlush
flip
screensync
glLoadIdentity
end if
glFlush ' Verarbeitung der Befehle
flip
screensync
loop until multikey(&h01) ' Verlasse die Schleife sobald escape gedrückt wird
WriteToConsole "Hauptschleife wurde verlassen"
do
sleep 1
glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
glFlush ' Verarbeitung der Befehle
flip
screensync
loop until inkey <> ""
sub openGL_line_b (fromX as integer, fromY as integer, toX as integer, toY as integer, z as integer, farbe as COLORType_rgb)
glTranslatef 0,0,z
WriteToConsole " Z Achse gesetzt (" + str(z) + ")"
glColor3ub farbe.rot, farbe.gruen, farbe.blau
WriteToConsole " Farbe gesetzt (" + str(115) + "." + str(115) + "."+ str(115) + ")"
glBegin GL_LINES
glVertex2i fromX, fromY
WriteToConsole " 1. Koordinate gesetzt (" + str(fromX) + "." + str(fromY) + ")"
glVertex2i toX, fromY
WriteToConsole " 2. Koordinate gesetzt (" + str(toX) + "." + str(fromY) + ")"
glEnd
WriteToConsole " 1. Linie abgeschlossen"
glBegin GL_LINES
glVertex2i fromX, fromY
WriteToConsole " 1. Koordinate gesetzt (" + str(fromX) + "." + str(fromY) + ")"
glVertex2i fromX, toY
WriteToConsole " 2. Koordinate gesetzt (" + str(fromX) + "." + str(toY) + ")"
glEnd
WriteToConsole " 2. Linie abgeschlossen"
glBegin GL_LINES
glVertex2i fromX, toY
WriteToConsole " 1. Koordinate gesetzt (" + str(fromX) + "." + str(toY) + ")"
glVertex2i toX, toY
WriteToConsole " 2. Koordinate gesetzt (" + str(toX) + "." + str(toY) + ")"
glEnd
WriteToConsole " 3. Linie abgeschlossen"
glBegin GL_LINES
glVertex2i toX, toY
WriteToConsole " 1. Koordinate gesetzt (" + str(toX) + "." + str(toY) + ")"
glVertex2i toX, fromY
WriteToConsole " 2. Koordinate gesetzt (" + str(toX) + "." + str(fromY) + ")"
glEnd
WriteToConsole " 4. Linie abgeschlossen"
glflush
WriteToConsole " OGL-Befehle verarbeitet"
flip
WriteToConsole " Screenpages geflipt"
end sub
sub openGL_line_bf (fromX as integer, fromY as integer, toX as integer, toY as integer, z as integer, farbe as COLORType_rgb)
glTranslatef 0,0,z
WriteToConsole " Z Achse gesetzt (" + str(z) + ")"
glColor3ub farbe.rot, farbe.gruen, farbe.blau
WriteToConsole " Farbe gesetzt (" + str(115) + "." + str(115) + "."+ str(115) + ")"
glBegin GL_QUADS
glVertex2i fromX , toY '' LINKS UNTEN (1. Koordinate)
WriteToConsole " 1. Koordinate gesetzt (" + str(0) + "." + str(600) + ")"
glVertex2i toX , toY '' RECHTS UNTEN (2. Koordinate)
WriteToConsole " 2. Koordinate gesetzt (" + str(800) + "." + str(600) + ")"
glVertex2i toX , fromY '' RECHTS OBEN (3. Koordinate)
WriteToConsole " 3. Koordinate gesetzt (" + str(800) + "." + str(0) + ")"
glVertex2i fromX , fromY '' LINKS OBEN (4. Koordinate)
WriteToConsole " 4. Koordinate gesetzt (" + str(0) + "." + str(0) + ")"
glEnd
WriteToConsole " GL_QUADS abgeschlossen."
glflush
WriteToConsole " OGL-Befehle verarbeitet"
flip
WriteToConsole " Screenpages geflipt"
end sub
sub at_every_end(nix as integer)
if nix = 0 then
do
sleep 20
if inkey = chr(255) + "k" then end
if multikey(&h01) = -1 then end
loop
end if
end sub
sub Statusanzeige (Acktuellerwert as integer, Endwert as integer, PosX as integer,PosY as integer)
' Geschrieben von AndT
dim as integer prozent
dim Z as integer = 20
dim as COLORType_rgb raw_col, ak_col, no_col
raw_col.rot = 0
raw_col.gruen = 0
raw_col.blau = 255
ak_col.rot = 0
ak_col.gruen = 0
ak_col.blau = 0
no_col.rot = 255
no_col.gruen = 255
no_col.blau = 255
Prozent=Acktuellerwert*100/Endwert
'openGL_line_bf PosX+1, PosY+1, PosX+prozent * 2, PosY +30, z, raw_col
' Line(PosX+1,PosY+1)-(PosX+prozent * 2,PosY +30), rgb(0,0,255),bf
if prozent < 100 then
' openGL_line_bf PosX+prozent*2+1, PosY+1, PosX+200, PosY +30, z, ak_col
' Line(PosX+prozent*2+1,PosY+1)-(,Posy+ 30), rgb(0,0,0),bf
end if
'draw string (PosX+90,PosY+10 ), Prozent & "%", rgb(255,255,255)
' openGL_line_b PosX, PosY, PosX+200, PosY +30, z, no_col
' line(PosX, PosY)-(PosX+200,PosY +30), rgb(255,255,255),b
screenunlock
end sub
sub escape_butt(z as integer)
' Diese Sub erstellt den "escape"-Button
glColor3ub 56 , 56 , 56
WriteToConsole " Farbe gesetzt (" + str(21) + "." + str(21) + "."+ str(21) + ")"
glBindTexture GL_TEXTURE_2D, tex_escape.handle
glTranslatef 0 , 0 , z
WriteToConsole " Z Achse gesetzt (" + str(z) + ")"
glBegin GL_QUADS
glVertex2i (200-20) , (200-10) '' LINKS UNTEN (1. Koordinate)
WriteToConsole " 1. Koordinate gesetzt (" + str(800-20) + "." + str(600-10) + ")"
glVertex2i 200 , (200-10) '' RECHTS UNTEN (2. Koordinate)
WriteToConsole " 2. Koordinate gesetzt (" + str(800) + "." + str(600-10) + ")"
glVertex2i 200 , 200 '' RECHTS OBEN (3. Koordinate)
WriteToConsole " 3. Koordinate gesetzt (" + str(800) + "." + str(600) + ")"
glVertex2i (200-20) , 200 '' LINKS OBEN (4. Koordinate)
WriteToConsole " 4. Koordinate gesetzt (" + str(800-20) + "." + str(600) + ")"
glEnd
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
glflush
WriteToConsole " OGL-Befehle verarbeitet"
flip
WriteToConsole " Screenpages geflipt"
end Sub
sub bckgrnd (z as integer)
' Diese Sub erstellt unsere Hintergrundfarbe
glColor3ub 21 , 21 , 21
WriteToConsole " Farbe gesetzt (" + str(21) + "." + str(21) + "."+ str(21) + ")"
glTranslatef 0 , 0 , z
WriteToConsole " Z Achse gesetzt (" + str(z) + ")"
glBegin GL_QUADS
glVertex2i 0 , 600 '' LINKS UNTEN (1. Koordinate)
WriteToConsole " 1. Koordinate gesetzt (" + str(0) + "." + str(600) + ")"
glVertex2i 800 , 600 '' RECHTS UNTEN (2. Koordinate)
WriteToConsole " 2. Koordinate gesetzt (" + str(800) + "." + str(600) + ")"
glVertex2i 800 , 0 '' RECHTS OBEN (3. Koordinate)
WriteToConsole " 3. Koordinate gesetzt (" + str(800) + "." + str(0) + ")"
glVertex2i 0 , 0 '' LINKS OBEN (4. Koordinate)
WriteToConsole " 4. Koordinate gesetzt (" + str(0) + "." + str(0) + ")"
glEnd
glflush
WriteToConsole " OGL-Befehle verarbeitet"
flip
WriteToConsole " Screenpages geflipt"
end Sub
sub border(z as integer)
glTranslatef 0,0,z ' Erste Reihe
WriteToConsole " Z Achse gesetzt (" + str(128) + ")"
glColor3ub 115, 115, 115
WriteToConsole " Farbe gesetzt (" + str(115) + "." + str(115) + "."+ str(115) + ")"
glBegin GL_LINES
glVertex2i 1, 1
WriteToConsole " 1. Koordinate gesetzt (" + str(1) + "." + str(1) + ")"
glVertex2i 800, 1
WriteToConsole " 2. Koordinate gesetzt (" + str(800) + "." + str(1) + ")"
glEnd
WriteToConsole " 1. Linie abgeschlossen"
glBegin GL_LINES
glVertex2i 0, 0
WriteToConsole " 1. Koordinate gesetzt (" + str(0) + "." + str(0) + ")"
glVertex2i 0, 600
WriteToConsole " 2. Koordinate gesetzt (" + str(0) + "." + str(600) + ")"
glEnd
WriteToConsole " 2. Linie abgeschlossen"
glBegin GL_LINES
glVertex2i 0, 600
WriteToConsole " 1. Koordinate gesetzt (" + str(0) + "." + str(600) + ")"
glVertex2i 800, 600
WriteToConsole " 2. Koordinate gesetzt (" + str(800) + "." + str(600) + ")"
glEnd
WriteToConsole " 3. Linie abgeschlossen"
glBegin GL_LINES
glVertex2i 799, 600
WriteToConsole " 1. Koordinate gesetzt (" + str(799) + "." + str(600) + ")"
glVertex2i 799, 1
WriteToConsole " 2. Koordinate gesetzt (" + str(799) + "." + str(1) + ")"
glEnd
WriteToConsole " 4. Linie abgeschlossen"
glflush
WriteToConsole " OGL-Befehle verarbeitet"
flip
WriteToConsole " Screenpages geflipt"
end Sub
sub lade(datei as string, tex as GFXType)
dim p as integer = load_texture(datei, tex)
if p = 0 then
WriteToConsole " Textur " + datei + " wurde erfolgreich geladen."
else
WriteToConsole " Fehler beim laden der Textur " + datei + ". (ErrNo " + str(p) + ")"
end if
end Sub
sub tile ()
glBegin GL_QUADS
glTexCoord2f 0, 0
glVertex2i 0 , 48 '' LINKS UNTEN (1. Koordinate)
glTexCoord2f 1, 0
glVertex2i 48 , 48 '' RECHTS UNTEN (2. Koordinate)
glTexCoord2f 1, 1
glVertex2i 48 , 0 '' RECHTS OBEN (3. Koordinate)
glTexCoord2f 0, 1
glVertex2i 0 , 0 '' LINKS OBEN (4. Koordinate)
glEnd
end Sub
sub draw_init_game(z as Integer, mode As Integer)
dim as integer i, x, y, farbe, xc, yc, row
farbe = 1
x = 192
y = 97
xc = 0
yc = 0
row = 1
for i = 1 to 64
if xc < 8 then
glTranslatef x, y, z ' Zweite Reihe
if farbe mod 2 = 1 then
glBindTexture GL_TEXTURE_2D, tex_black.handle
'WriteToConsole " Spielfeld Tile Nr. " + str(i) + " wurde gezeichnet. Farbe: Schwarz."
else
glBindTexture GL_TEXTURE_2D, tex_white.handle
'WriteToConsole " Spielfeld Tile Nr. " + str(i) + " wurde gezeichnet. Farbe: Weiss."
end if
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
glFlush
Flip
If mode = 1 Then
ScreenSync
End if
farbe += 1
x += 48
xc += 1
elseif xc = 8 then
y += 48
x = 192
xc = 0
farbe += 1
glTranslatef x, y, z ' Zweite Reihe
if farbe mod 2 = 1 then
glBindTexture GL_TEXTURE_2D, tex_black.handle
'WriteToConsole " Spielfeld Tile Nr. " + str(i) + " wurde gezeichnet. Farbe: Schwarz."
else
glBindTexture GL_TEXTURE_2D, tex_white.handle
'WriteToConsole " Spielfeld Tile Nr. " + str(i) + " wurde gezeichnet. Farbe: Weiss."
end if
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
glFlush
Flip
If mode = 1 Then
ScreenSync
End If
farbe += 1
x += 48
xc += 1
end if
next i
end Sub
sub draw_game(mode As Integer)
glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
' Umgebung: Hintergrundfarbe & Menü
' Der Trick hier: anstatt die GraKa alle Befehle einzeln ausführen zu lassen, endet jede Sub mit
' "glflush", was die Befehle verarbeitet
screenlock
' Block 1: Hintergrundfarbe setzten
WriteToConsole "Block 1: Hintergrundfarbe:"
bckgrnd -10
glFlush
flip
screensync
glLoadIdentity
WriteToConsole "Block 1: Hintergrundfarbe setzten: Abgeschlossen"
' Block 2: Rand malen
WriteToConsole "Block 2: Rand malen:"
border -9
glFlush
flip
screensync
glLoadIdentity
WriteToConsole "Block 2: Rand malen: Abgeschlossen"
' Block 3: escape-Button malen
WriteToConsole "Block 3: Exit-Button malen:"
escape_butt -7
glFlush
flip
screensync
glLoadIdentity
WriteToConsole "Block 3: Exit-Button malen: Abgeschlossen"
' Block 4: Spielfeld malen
WriteToConsole "Block 4: Spielfeld malen:"
draw_init_game -8, mode
glFlush
flip
screensync
glLoadIdentity
WriteToConsole "Block 4: Spielfeld malen: Abgeschlossen"
screenunlock
end Sub
sub anfang()
' Ausgangspositionen der Spielfiguren
dim as integer x, y, z
z = 0
x = 241 - 1
for y = 97 to 433 step 48
glBindTexture GL_TEXTURE_2D, tex_black_bauer.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
next y
y = (97 - 48)
x = 193 - 1
y += 48
glBindTexture GL_TEXTURE_2D, tex_black_turm.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_black_laeufer.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_black_pferd.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_black_koenig.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_black_dame.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_black_pferd.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_black_laeufer.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_black_turm.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
x = 481 - 1
for y = 97 to 433 step 48
glBindTexture GL_TEXTURE_2D, tex_white_bauer.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
next y
y = (97 - 48)
x = 529 - 1
y += 48
glBindTexture GL_TEXTURE_2D, tex_white_turm.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_white_laeufer.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_white_pferd.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_white_koenig.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_white_dame.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_white_pferd.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_white_laeufer.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
y += 48
glBindTexture GL_TEXTURE_2D, tex_white_turm.handle
glTranslatef x, y, z
tile
glBindTexture GL_TEXTURE_2D, 0
glLoadIdentity
end Sub
function openGL_init(win_post as string, X as integer, Y as integer, sdepth as integer, sfullscreen as integer) as integer ' Initialisiert openGL
' Initialisiert einen openGL-Screen
screenres X,Y,sdepth,,&H02 or sfullscreen
windowtitle win_post
glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
glflush
flip
screensync
' Konfiguration von OpenGL
' Matrix definieren
glMatrixMode(GL_PROJECTION)
glLoadIdentity
' Achse festlegen
glViewport(0,0,X,Y)
glOrtho(0,X,Y,0,-128,128)
' Deaktivierung des Rendern der Rückseiten
glMatrixMode(GL_MODELVIEW)
glEnable(GL_CULL_FACE)
glCullFace(GL_BACK)
' Texturen aktivieren
glEnable GL_TEXTURE_2D
glLoadIdentity
' Tiefentest
glEnable(GL_DEPTH_TEST)
glDepthFunc(GL_LESS)
' Alphatest
glEnable(GL_ALPHA_TEST)
glAlphaFunc(GL_GREATER, 0.1)
' Ende der openGL Konfiguration
glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
glflush
flip
screensync
' Wenn alles geklappt hat: 1 Zurückgeben
return 1
end Function
sub fenster ()
' Prozent=Acktuellerwert*100/Endwert
dim prozent as integer = (loaded*100/100)/2
if loaded = 0 then
windowtitle "Schach [by csde_rats] [Loading...] [" + str(loaded) + "%] [" + string(50,"_") + "]"
else
windowtitle "Schach [by csde_rats] [Loading...] [" _
+ str(loaded) + "%] [" + string(prozent,"#") + string(50-prozent, "_") + "]"
end if
end Sub