Menu

Show posts

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

Messages - Quentin

#46
Beta Tests / Re: V11 beta
2012-Sep-26
IMHO it's always a bad idea to use keywords as variable names. Unfortunately something like "select%" was allowed in version 10. Good to see that this was corrected in V11.
#47
Geh ins Menü unter "Projekt - Optionen". Dort findest du eine Checkbox "Explizite Deklarationen". Wenn diese markiert ist, müssen Variablen vor ihrer Verwendung mit LOCAL oder GLOBAL deklariert werden. Wenn du dieses Häkchen entfernst, dürften dann auch die älteren Samples laufen.
#48
sorry I'm not that familiar with FMOD and don't know which version you're using. Perhaps you'll find something like STREAM_OPEN to load a song into a buffer and STREAM_PLAY to play it afterwards.
#49
I think the best way is to load all things you'll need for your game (music, sound, graphics etc.) before the main game loop, not in it. Depending on the size of the loaded files you'll see lags in the game. Not very nice!
#50
did you try GETDESKTOPSIZE ?
not really sure, but I guess, it is working on every device.
#51
könntest dir ja eine Funktion schreiben, die dir ein TRect zurückliefert

Code (glbasic) Select

TYPE TRect
x1%
y1%
width%
height%
ENDTYPE

LOCAL r AS TRect
r = create_rect(10, 10, 100, 50)
draw(r)

SHOWSCREEN
KEYWAIT


FUNCTION create_rect AS TRect: x1%, y1%, width%, height%
LOCAL r AS TRect
r.x1 = x1
r.y1 = y1
r.width = width
r.height = height
RETURN r
ENDFUNCTION

FUNCTION draw: r AS TRect
DRAWRECT r.x1, r.y1, r.width, r.height, RGB(255, 0, 0)
ENDFUNCTION


nun könnte man ja vermuten, man könnte das in einen Befehl zusammenfassen, weil die Funktion create_rect ja ein TRect zurückliefert.
Code (glbasic) Select

draw(create_rect(10, 10, 100, 50))


Das gibt allerdings einen Fehler durch den Precompiler. Das kann man bedauern, ich denke jedoch, wenn man das in zwei Codingzeilen packt, ist das doch übersichtlicher. Mich schaudert es ein wenig vor solchen Funktionsverkettungen. Es dient imho nicht gerade der Übersichtlichkeit, auch wenn manche Leute das elegant finden.
#52
*lol*
warum nicht? Viele hier haben mit C64, Amiga oder ähnlichem begonnen. Ich glaube, einen Lochkartenstanzer haben wir nicht dabei :), bin mir aber nicht sicher.

Wegen Zufallszahlen:
Sieh dir mal die Funktions SEEDRND an. Wenn du die vorher aufrufst, bekommst du mit RND dann auch unterschiedliche "zufällige" Zahlen

wegen SHOWSCREEN:
GLBasic arbeitet im Prinzip mit zwei Bildschirm-Seiten, die eine siehst du auf dem Monitor, die andere ist verborgen im Speicher. Wenn du jetzt in deinem Programm Grafik-Befehle aufrufst, schreiben diese erst in den unsichtbaren Bereich. Wird dann SHOWSCREEN aufgerufen, wechelt die Anzeige dorthin und zeigt alles an. Such bei Onkel Google mal nach "Backbuffer" oder "Double buffering", da wird das wohl noch besser erklärt.

#53
na dann willkommen erst einmal.

Aber was soll daran nicht funktionieren. Um das  beurteilen zu können, bräuchte man wohl mehr vom Coding. Was mir nur gleich ins Auge springt, ist  das SHOWSCREEN vor den Unterprogramm-Aufrufen. Überlicherweise ist SHOWSCREEN die letzte Anweisung in der Hauptschleife.

z.B.
Code (glbasic) Select

WHILE TRUE
    unterprog1()
    unterprog2()
    ...
    SHOWSCREEN
WEND


nach SHOWSCREEN können natürlich noch weitere Berechnungen folgen, sinnvollerweise aber keine Bildschirmausgaben mehr, da diese möglicherweise nicht mehr dargestellt werden können, wenn du z.B. zu Beginn deiner WHILE-Schleife CLEARSCREEN aufrufst.

KEYWAIT erscheint hier wenig sinnvoll. Wenn du z.B. aus deinem Spiel in ein anderes Programm wechselst und wieder zurück, wirst du sehr wahrscheinlich erst mal nur ein leeres Fenster sehen, bis du wieder eine entsprechende Taste gedrückt hast.
#54
ahh ok, nee, da hab ich auch nix passendes gefunden. Müsste man halt von außen steuern.
oder die Funktonalität selbst dazu basteln
#55
?? gibt doch EntitySetAnimation, womit du das steuern kannst
meintest du das?
#56
it could work, if you pay attention to some issues :)

place the +operator outside the type as a normal C++ function
in this case a forward declaration is needed (see first INLINE statement)

it's also possible to define different +operators (e.g. type + type or type + number)

Code (glbasic) Select

INLINE
const TVec2 operator+(TVec2& _a, const TVec2& _b );
const TVec2 operator+(TVec2& _a, DGInt b);
ENDINLINE

TYPE TVec2
x#
y#
w# = 1
ENDTYPE


LOCAL one AS TVec2
LOCAL two AS TVec2

one.x = 1
one.y = 2

two.x = 3
two.y = 4

LOCAL result AS TVec2

result = one + two
result = result + 11

STDOUT "result.x = " + result.x + "\n"
STDOUT "result.y = " + result.y + "\n"
STDOUT "result.w = " + result.w + "\n"

KEYWAIT


FUNCTION __dummy__:
ENDFUNCTION

INLINE
const TVec2 operator+(TVec2& _a, const TVec2& _b )
{
_a.x += _b.x;
_a.y += _b.y;
_a.w += _b.w;
return _a;
}

const TVec2 operator+(TVec2& _a, DGInt b)
{
_a.x += b;
_a.y += b;
_a.w += b;
return _a;
}
ENDINLINE


[EDIT]
The usage of const is quite confusing for me. In many examples I see both parameters definded as const. Not really sure, which is the best way. But I guess in this case it's ok to use _a without const to avoid a temporay copy of TVec2.
#57
wie hast du DDGui_set denn aufgerufen?
glaube DDGui_set(id$, "TEXT", inhalt$) sollte doch klappen
#58
scared at first.
perhaps scarred, after Chuck has finished with him.
#59
*muuhaarrr*
ok, it is childish, but .... a scared debugger ... great.
#60
... dass das deutsche Forum jetzt unter "ferner liefen" hier steht. Wo sind eigentlich die ganzen restlichen Topics wie Tutorials usw. verblieben? Endgültig weg?