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 - kanonet

#46
Dam, instead of going to sleep you guys made me do this:
Code (glbasic) Select
FUNCTION DistanceBoxPoint#: cX# , cY# , cZ# , bXL# , bXR# , bYD# , bYU# , bZF# , bZB#
cX = IIF( cX<bXL, cX-bXL, IIF( cX>bXR, cX-bXR, 0 ) )
cY = IIF( cY<bYD, cY-bYD, IIF( cY>bYU, cY-bYU, 0 ) )
cZ = IIF( cZ<bZF, cZ-bZF, IIF( cZ>bZB, cZ-bZB, 0 ) )
RETURN cX * cX + cY * cY + cZ * cZ
ENDFUNCTION

Same interface as your function and should give the same results, while having obvious advantages. I love the fun of finding algorithms.  :booze:
#47
Once all starting bugs are sorted out, there should be no difference at all, GLBasic Updates usually are designed in a way that they maintain 100% backwards compatibility; so a new version should run your old code without a change. If you look at the release notes, you see that there is no breaking change in this update (at least no documented one, you still got the fun of hunting hidden ones lol).
#48
In der Programmierung gibt es immer tausende Wege um das um das gleiche zu erreichen, einen möglichst gut passenden zu finden ist immer Teil des Vergnügens. Das von dir gewünschte würde ich so lösen:
Code (glbasic) Select
SYSTEMPOINTER TRUE

GLOBAL pressed%

WHILE TRUE
IF Button(50,50,100,50) OR KEY(57)
IF pressed = 0
Ausgabe()
pressed = 1
ENDIF
ELSE
pressed = 0
ENDIF

SHOWSCREEN
WEND

FUNCTION Ausgabe:
PRINT "Hello", 10, 10
ENDFUNCTION

FUNCTION Button: x%, y%, w%, h%
LOCAL mx%, my%, b1%, b2%
MOUSESTATE mx, my, b1, b2
DRAWRECT x, y, w, h, RGB(255,0,0)
RETURN b1 AND BOXCOLL(x, y, w, h, mx, my, 1, 1)
ENDFUNCTION


PS ich glaube, was dir hier gefehlt hat um es selbst zu lösen waren logic operatoren, schauen dir mal AND, OR etc. an.


EDIT zu deinem neuen Post: mit den ersetzen, dass meinte ich wörtlich, an der stelle wo du bisher KEY stehen hast solltest du das einfach entfernen und stattdessen meine Funktion Button einfügen. Dann würde allerdings nur noch der Button funktionieren, nicht mehr der KEY. Willst du dass man beide drücken kann (jeweils eines reicht), dann musst du schreiben KEY() OR Button(), willst du, dass das Ereignis nur dann eintritt, wenn beide gleichzeitg gedrückt werden, dann musst du schreiben KEY() AND Button(). Hoffe das gibt dir eine Idee wo du starten kannst mit lernen. Und fragen ist immer eine gute Idee, kannst du ruhig weiterhin tun. Aber selbst ausprobieren ist genauso gut (und meist schneller), keine sorge, du kannst damit nichts kaputt machen. Bei fehlern passiert nur eines der 3:
-Programm kompiliert nicht (da hast du Glück, das ist einfach zu finden und zu beheben)
-Programm kompiliert und startet, aber crasht irgendwann
-Programm kompiliert und läuft ohne crash, aber macht nicht das was du wolltest (Fehelr ist am schwersten zu finden und zu beheben)
Egal welches davon passiert, keines ist schlimm oder irgendwie gefährlich. Im Gegenteil, das passiert jedem von uns häufig, egal wie viel Erfahrung wir schon haben. Also einfach mutig sein und probieren und wenn du es dann nicht selbst hin bekommst kannst du ja immer noch fragen. Viel Erfolg! :booze:
#49
Obviously dbg() was only implemented for simple arithmetic type member data types, but not for members that are arrays or other types:
Code (glbasic) Select
//works:
TYPE A
a%
ENDTYPE


//fails:
TYPE B
b[]
ENDTYPE


//fails:
TYPE C
c
ENDTYPE

TYPE D
d AS C
ENDTYPE



EDIT: I can confirm, that it is fixed in 14.006. Well done Gernot! :good:
#51
Sicher. Aber meinst du nicht das es sinnvoller wäre, wenn du versuchen würdest zumindest solch einfache Dinge selbst hinzubekommen? Am Ende willst du ja mal selbst ein Spiel schreiben und nicht nur den Code von uns kopieren. Übrigens kann es auch sehr hilfreich sein, wenn du mal in die Bespiele siehst, unter GLBasic/Samples findest du jede Menge. Kannst dann damit rum experimentieren, hier und da etwas verändern und sehen was raus kommt. Ist sicher lehrreich. :good:

Um deine letzte Frage doch noch zu beantworten (falls ich sie richtig verstanden habe), dann kannst du in deinem Code da wo bisher KEY() stand jetzt einfach BUTTON(x,y,b,h) einfügen/ersetzen (x,y,b,h müssen natürlich durch die jeweiligen Werte ersetzt werden).
#52
Hmm Im not sure what that post was trying to say, did you get it to work or not, in the end? If it works ok, then of cause it is easy to implement it into PLATFORMINFO.
#53
Das must du dir selbst bauen, ein ganz einfaches und unoptimiertes beispiel:

Code (glbasic) Select
FUNCTION Button: x%, y%, w%, h%
LOCAL mx%, my%, b1%, b2%
MOUSESTATE mx, my, b1, b2
DRAWRECT x, y, w, h, RGB(255,0,0)
RETURN b1 AND BOXCOLL(x, y, w, h, mx, my, 1, 1)
ENDFUNCTION


Zu benutzen so:
Code (glbasic) Select
SYSTEMPOINTER TRUE
IF Button(50,100,200,50) THEN PRINT "pressed", 50,150
#54
In my tests SETSCREEN is fixed, thank you.

But fullscreen set in project settings is still ignored (tested on windows only).
#55
I got the same problem in several projects, I think it is because you did not keep array members of types in mind, simplest failing test:
Code (glbasic) Select
TYPE t
array[]
ENDTYPE
#56
Tools > Settings > Click on Font button
(names may be a bit different, just translated from my german version)
#57
Strange it works for me (test run in windows), here is my test program:
Code (glbasic) Select
maxtex()

FUNCTION foo:
ENDFUNCTION

INLINE
    typedef unsigned int    GLenum;
    typedef int                             GLint;
    #define GL_MAX_TEXTURE_SIZE               0x0D33
    extern "C" {
            #ifdef __WIN32__
                    #ifndef APIENTRY
                            #define APIENTRY __stdcall
                    #endif
            #else
                    #ifndef APIENTRY
                            #define APIENTRY
                    #endif
            #endif
            void APIENTRY glGetIntegerv (GLenum pname, GLint* params);
    }
ENDINLINE

FUNCTION maxtex:
INLINE
int maxsize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
DEBUG ( maxsize );
ENDINLINE

ENDFUNCTION


Debug outputs 16384 for me, which seems to be ok. What problems do you get?
#58
Of cause you 1st need to import the function, before you can use it. If we need to do it manually, this is how we do it:

Code (glbasic) Select
// somewhere global, preferably in glbasic namespace, GLBasic probably does gl function import somewhere, that would be the place for this:
typedef unsigned int GLenum;
typedef int GLint;
#define GL_MAX_TEXTURE_SIZE               0x0D33
extern "C" {
#ifdef __WIN32__
#ifndef APIENTRY
#define APIENTRY __stdcall
#endif
#else
#ifndef APIENTRY
#define APIENTRY
#endif
#endif
void APIENTRY glGetIntegerv (GLenum pname, GLint* params);
}


Just copied together without trying, let me know how this works for you
#59
All those problems are new and probably related to the introduction of prescaler.
#60
Quote from: Kitty Hello on 2015-Aug-14
It also removes temp data used for collisions. Ao if you call x_coll.. it takes longer to rebuild that data.
So is it advised to call it after loading an object? How many space got allocated on loading an object that is never needed again? And why does it not get deallocated automatically when the loading function goes out of scope?