verstehe nicht ganz. ..\Compiler\platform\Include gibt es nur einmal für alle Platformen
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
#include <test.h>
#include "test.h"
Quote from: Markus on 2012-Apr-24
@Quentin
ich möchte keine kopie als Rückgabe
FOR i = 0 TO LEN(Players[]) - 1
Players[i].draw()
NEXT
// damit kannst du dann auch außerhalb der Schleife gezielt über den Index zugreifen
// und deine gezeigte FindPlayer-Funktion wäre überflüssig
Players[5].update()
TYPE TPlayer
text$
ENDTYPE
GLOBAL players[] AS TPlayer
DIM players[3]
players[0].text$ = "Erster"
players[1].text$ = "Zweiter"
players[2].text$ = "Dritter"
LOCAL test AS TPlayer
test = get_player("Zweiter")
STDOUT test.text$
KEYWAIT
FUNCTION get_player AS TPlayer: text$
FOREACH p IN players[]
IF p.text$ = text$
RETURN p
ENDIF
NEXT
ENDFUNCTION
// GUI-Elemente, z.B. Label, Eingabefeld, pushbutton
TYPE TGuiElement
x%
y%
name$
content$
ENDTYPE
// Ein Dialog kann 1..n Gui-Elemente enthalten
TYPE TDialog
x%
y%
name$
items[] AS TGuiElement
ENDTYPE
// für das Hauptprogram benötigt man einen "GUI-Manager"
TYPE TGuiManager
dialogs[] AS TDialog
ENDTYPE
// jetzt mal ein paar GUI-Elemnte anlegne
LOCAL label AS TGuiElement
LOCAL inputfield AS TGuiElement
LOCAL checkbox AS TGuiElement
label.x = 0
label.y = 0
label.name$ = "LABEL"
label.content$ = "Eingabe:"
inputfield.x = 10
inputfield.y = 0
inputfield.name$ = "INPUTFIELD"
inputfield.content$ = ""
checkbox.x = 0
checkbox.y = 10
checkbox.name$ = "CHECKBOX"
checkbox.content$ = "X"
// diese packen wir in einen Dialog
LOCAL dialog AS TDialog
dialog.x = 0
dialog.y = 0
dialog.name$ = "DIALOG"
DIMPUSH dialog.items[], label
DIMPUSH dialog.items[], inputfield
DIMPUSH dialog.items[], checkbox
//... ggfs. weitere Dialog
// alle Dialog packen wir in unseren "Gui-Manager"
LOCAL guimgr AS TGuiManager
DIMPUSH guimgr.dialogs[], dialog
LOCAL y
WHILE TRUE
FOREACH dia IN guimgr.dialogs[]
y = 0
FOREACH item IN dia.items[]
PRINT item.name$, 0, y
PRINT item.content$, 100, y
INC y, 20
NEXT
NEXT
SHOWSCREEN
WEND
TYPE TGuiElement
name$
...
ENDTYPE
TYPE TDialog
....
GuiElements as TGuiElement[]
....
ENDTYPE
TYPE TGuiManager
...
dialogs as TDialog[]
....
ENDTYPE