GLBasic forum

Other languages => GLBasic - de => Topic started by: 4pac on 2007-Dec-20

Title: Frage zu Arrays (DIM)
Post by: 4pac on 2007-Dec-20
[EDIT] Oops... das sollte gar nicht in Tutorien landen, sondern in GLBasic - de [/EDIT]

Hallo GLBasic-Freunde,

ich hab hier eine Frage zu Datenfeldern, weil beii mir etwas nicht hinhaut, wo ich denke, das müsste eigentlich ganz selbtverständlich laufen.

Code (glbasic) Select
GLOBAL pixelfields_x = 32 // Gesamtzahl Pixelfelder -> Maximalwert 32, begrenzt durch´s Layout
GLOBAL pixelfields_y = 32

DIM pixelfield_r [pixelfields_x] [pixelfields_y] // Jedes Pixelfeld hat die Eigenschaften R/G/B
DIM pixelfield_g [pixelfields_x] [pixelfields_y]
DIM pixelfield_b [pixelfields_x] [pixelfields_y]

FOR x=0 TO pixelfields_x-1
    FOR y=0 TO pixelfields_y-1
        pixelfield_r[x][y] = 0
        pixelfield_g[x][y] = 0
        pixelfield_b[x][y] = 0
    NEXT
NEXT
Da meckert der Compiler:

Code (glbasic) Select
compiling:
C:/DOKUME~1/Thomas/LOKALE~1/Temp/glbasic/gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:/DOKUME~1/Thomas/LOKALE~1/Temp/glbasic/gpc_temp0.cpp:27: error: void value not ignored as it ought to be
C:/DOKUME~1/Thomas/LOKALE~1/Temp/glbasic/gpc_temp0.cpp:30: error: void value not ignored as it ought to be
C:/DOKUME~1/Thomas/LOKALE~1/Temp/glbasic/gpc_temp0.cpp:32: error: void value not ignored as it ought to be
*** FATAL ERROR - Bitte die Compiler-Ausgabe ins Forum kopieren
nehme ich o.g. Codeabshnitt raus, läuft das Programm. Das kann ich mal so probieren, denn o.g. Array ist bisher noch nicht in den Programmablauf eingebunden. Das mache ich erst, wenn das Dimensionieren so funzt, wie ich mir das vorstelle. Kann mir jemand sagen, was ich da falsch mache?

Es handelt sich (noch) um die Demoversion von GLBasic.

Viele Grüße,
4pac
Title: Frage zu Arrays (DIM)
Post by: BumbleBee on 2007-Dec-20
Der Compiler mag keine Leerzeichen zwischen den Klammern.

DIM pixelfield_r  [pixelfields_x][pixelfields_y]
DIM pixelfield_g [pixelfields_x][pixelfields_y]
DIM pixelfield_b [pixelfields_x][pixelfields_y]

Hoffe es geht jetzt.:D

Cheers
Title: Frage zu Arrays (DIM)
Post by: 4pac on 2007-Dec-20
Jessas!!! Im Detail steckt der Teufel. Das war es tatsächlich schon. Wäre natürlich nett, wenn der Debugger sich etwas präziser äußern würde, was ihm nicht passt. Vielen Dank, BumbleBee =D
Title: Frage zu Arrays (DIM)
Post by: BumbleBee on 2007-Dec-20
Bitte, gern geschehen.:)

Cheers