Bild Problem

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

Sir Dan

Betreff: Bild Problem

BeitragSa, März 26, 2005 19:32
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo,

Ich habe mal ein kleines fun prog geschrieben, welches aber nicht funktioniert. Das Prob: Ich will rechts unten ein menü bild anzeigen,
aber statt dem menü erscheint ein ganz anderes bild. Aber ich finde den fehler nicht. Wahrscheinlich eine simple lösung, aber ich bin noch zu doof
um den Fehler zu finden Embarassed . Ich danke schon im Voraus für die antworten.
Hier der Code:
BlitzBasic: [AUSKLAPPEN]
;------------------------------Globals-------------------------------------------
Global breite = 800
Global hohe = 600
Global menu_01 = LoadImage(\"data/menu_01.bmp\")
Global bild_ex
Global frame_block = CreateTimer(60)
;------------------------------graphic_mode--------------------------------------
Graphics breite,hohe
;------------------------------arrays--------------------------------------------
Dim rot(800,600)
Dim grun(800,600)
Dim blau(800,600)
;--------------------------------------------------------------------------------
;------------------------------Main----------------------------------------------
;--------------------------------------------------------------------------------
SetBuffer BackBuffer()
Repeat
externes_bild(\"test\",0,0)
If KeyDown(205) richtung = richtung + 2;rechts
If KeyDown(203) richtung = richtung - 2;links
If KeyDown(208) richtung2 = richtung2 + 2;runter
If KeyDown(200) richtung2 = richtung2 - 2;rauf
menu_draw()
If KeyHit(2) save_bild(\"sirdan\",0,0,100,100)
If KeyHit(3) load_bild(\"sirdan\",100 + richtung,0 + richtung2,100,100,1)
If KeyHit(4) load_bild(\"sirdan\",100 + richtung,0 + richtung2,100,100,0)
If KeyHit(5) Cls
Flip
Until KeyHit(1)
FreeTimer frame_block
End
;--------------------------------------------------------------------------------
;------------------------------Functions-----------------------------------------
;--------------------------------------------------------------------------------
Function menu_draw()
DrawImage menu_01,614,508
;Text()
;Text()
End Function
;--------------------------------------------------------------------------------
Function externes_bild(name$,px,py)
bild_ex = LoadImage(\"data/\" + name$ + \".bmp\")
If KeyHit(15)
DrawImage bild_ex,px,py
EndIf
End Function
;--------------------------------------------------------------------------------
Function save_bild(sav$,zahl_x%,zahl_y%,breite2,hohe2)
For x = 0 To breite2
For y = 0 To hohe2
GetColor(x + zahl_x%,y + zahl_y%)
r%=ColorRed()
g%=ColorGreen()
b%=ColorBlue()
rot(x,y) = r%
grun(x,y) = g%
blau(x,y) = b%
Next
Next
If sav$ = \"\" sav$ = \"test\"
karten_datei = WriteFile(\"data/\" + sav$ + \".screen\")
For x = 0 To breite2
For y = 0 To hohe2
WriteByte(karten_datei,rot(x,y))
WriteByte(karten_datei,grun(x,y))
WriteByte(karten_datei,blau(x,y))
Next
Next
CloseFile karten_datei
End Function
;--------------------------------------------------------------------------------
Function load_bild(loadname$,posx%,posy%,breite2,hohe2,nega%)
If loadname$ = \"\" loadname$ = \"test\"
read_datei = ReadFile(\"data/\" + loadname$ + \".screen\")
For x = 0 To breite2
For y = 0 To hohe2
rot(x,y) = ReadByte(read_datei)
grun(x,y) = ReadByte(read_datei)
blau(x,y) = ReadByte(read_datei)
Next
Next
bild = CreateImage(640,640)
If nega% = 1
For x = 0 To breite2
For y = 0 To hohe2
Color 255 - rot(x,y),255 - grun(x,y),255 - blau(x,y)
Plot x + posx%,y + posy%
Next
Next
EndIf
If nega% = 0
For x = 0 To breite2
For y = 0 To hohe2
Color rot(x,y),grun(x,y),blau(x,y)
Plot x + posx%,y + posy%
Next
Next
EndIf
CloseFile read_datei
End Function
(\_/)
(O.o)
(> <) This is Bunny. Copy Bunny into your signature to help him on his way to world domination.

Artemis

BeitragSa, März 26, 2005 19:40
Antworten mit Zitat
Benutzer-Profile anzeigen
bei bildnamen kein "/" sondern "\"
mehr weiss ich grad nich!

Sir Dan

BeitragSa, März 26, 2005 19:42
Antworten mit Zitat
Benutzer-Profile anzeigen
Da hat sich nichts geändert... Sad Sad Sad
Und sonst mach ich es auch immer mit ´/´ und es geht. Aber heute...
(\_/)
(O.o)
(> <) This is Bunny. Copy Bunny into your signature to help him on his way to world domination.
 

Gerhard

BeitragSa, März 26, 2005 19:48
Antworten mit Zitat
Benutzer-Profile anzeigen
Bild nach Graphics laden...
Kein Bild in der Hauptschleife laden...(externesBild())

Sir Dan

BeitragSa, März 26, 2005 19:55
Antworten mit Zitat
Benutzer-Profile anzeigen
Ah,danke. Jetzt geht´s.
(\_/)
(O.o)
(> <) This is Bunny. Copy Bunny into your signature to help him on his way to world domination.

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group