Das Verhalten finde ich merkwürdig.
Im Projekt habe ich Explizite Deklaration "An"
TYPE TTest
x1
y1
x2
y2
FUNCTION ChangeViewPort: BYREF w,BYREF h
w=(self.x2-self.x1)+1
h=(self.y2-self.y1)+1
IF self.y1=0 AND self.y2=0
VIEWPORT 0,0,-1,-1
ELSE
VIEWPORT self.x1,self.y1,w,h
ENDIF
ENDFUNCTION
ENDTYPE
LOCAL A AS TTest
A.x1=0
A.y1=0
A.x2=320
A.y2=320
LOCAL w,h
A.ChangeViewPort(w,h)
END
Quote
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.9.829 SN:471f0175 - 2D, WIN32
"Test.gbas"(29) warning : variable already exists : w
"Test.gbas"(29) warning : variable already exists : h
Wordcount:13 commands
compiling:
C:\Users\Gang\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\Gang\AppData\Local\Temp\glbasic\gpc_temp0.cpp:98: error: `w' was not declared in this scope
C:\Users\Gang\AppData\Local\Temp\glbasic\gpc_temp0.cpp:98: error: `h' was not declared in this scope
*** FATAL ERROR - Bitte die Compiler-Ausgabe ins Forum kopieren
_______________________________________
*** Fertig ***
Dauer: 1.4 sek. Zeit: 13:14
Erstellen: 0 erfolgreich.
*** 1 FEHLGESCHLAGEN ***
kam mir auch schon komisch vor...
Der denkt Du bist noch in der Funktion. Glaub ich.
Schieb mal den TYPE unter deine Main() Funktion (also unter das END).
@Kitty Hello
Unten drunter ging,aber wenn ich mehrere Dateien im Projekt nutze kann
ich das ja nicht bestimmen. Finde ich auch unlogisch unten drunter.
Ich glaube dort werden zusätzlich automatisch variablen erzeugt was ich nicht will,
der sollte die benutzen die ich da definiert habe.
Wenn man das in einer Unterfunktion rein macht gehts wieder
aber dann wurde vermutlich trotzdem drüber was automatisch erzeugt.
Problem existiert nur in erster Datei im Projekt.
@Kitty Hello
bei mir war das in einer Zusatz Datei im Projekt.
Darum hatte ich mir dieses Beispiel in ein Test Projekt kopiert.