BASIC

Recent Posts

Pages: 1 ... 8 9 [10]
91
Off Topic / Re: Shaders
« Last post by Hemlos on 2019-May-15 »
hmm oh ya, i started this thread when i started playing with the shaders in glb

https://www.glbasic.com/forum/index.php?topic=3148.msg22927#msg22927

note: its 10 years old thread with some relevent information tho, however, i dont know if the code still works the same.
gernot helped share some important info there too
92
Off Topic / Re: Shaders
« Last post by dreamerman on 2019-May-15 »
Already available shaders can be some base if you need basic/simple effects, only issue is that they are scattered on different forum threads.
Helmos I saw that topic some time ago but forgot to mark it, and now I can't find it :D
93
Imho if You want to delete elements by index/id in basic type array (int, float, string) and want to preserve elements position do something like this:

Code: GLBasic [Select]
// compile in Debug mode

GLOBAL myarray%[], elems2del%[], i1%, i2%, txt$
DIM myarray%[0]
DIM elems2del%[0]

SEEDRND 1
txt$ = ""
FOR i1 = 0 TO 20
        i2 = RND(100)
        DIMPUSH myarray[], i2
        INC txt$, i2 + ", "
NEXT
txt$ = LEFT$(txt$, LEN(txt$) - 2)

DEBUG txt$ + "\n"


DIMDATA elems2del[], 7, 14, 9   // or use DimPush
SORTARRAY elems2del[], 0        // ascending order

FOR i1 = LEN(elems2del[]) - 1 TO 0 STEP -1
        DIMDEL myarray[], elems2del[i1]
NEXT


txt$ = ""
FOR i1 = 0 TO LEN(myarray[]) - 1
        INC txt$, myarray[i1] + ", "
NEXT
txt$ = LEFT$(txt$, LEN(txt$) - 2)

DEBUG txt$ + "\n"


END

For dealing with UDT's I use 'toDelete%' flag, or approach similar to this, separate array with indexes to delete - depending on game logic, and if I don't need to preserve elements order just do elem[del_id] = elem[len[elem]-1], dec elem_count -> as this should be faster than multiple dimdel/push on large arrays.
94
GLBasic - en / Re: Remove a number (integer) out of an array
« Last post by Moru on 2019-May-14 »
Use DELETE inside a FOREACH loop.

Type "DELETE" in the editor and press F1 and then ENTER. Gives you the manual with a nice example how to do it:

Code: GLBasic [Select]
// Make an array of numbers
DIMDATA a[], 3,4,5,  12,13,  6

// Enumerate the numbers
FOREACH num IN a[]
   // throw out numbers bigger than 10, and continue
   IF num>10 THEN DELETE num
   a$=a$ + num + ", "
NEXT
PRINT a$, 0,0

SHOWSCREEN
MOUSEWAIT


 
95
GLBasic - en / Re: Message to Kitty
« Last post by spacefractal on 2019-May-14 »
the above should pretty been more automatic to detect the version with Android Studio..... But its not a priotiy by now and im will close this topic.
96
GLBasic - en / Re: Android Studio Progress......
« Last post by spacefractal on 2019-May-14 »
Howover the editor in Android Studio has a bit too much auto correction im cant disable, which annoying me quite a bit and backspace does not do what excpeted (curser often move up intead deleting).

Howover assest loading do now works again and tilt hopefully works again. Also GameInputAPI code im have did will break combatible and needs a update to get it working. But the official JOY commands should also works throught as well KEY() commands (which im choosen to change them to a float rather than int, which allways have annoying med, property due back in the iOS game controller days).

So its a nice progress, even the help documents is require updating and Android Studio is HUGE! Howover its doess seen Android Studio automatic download the eventuelly missing files and combonents in a project.

Admob as well inapp purchase wont been in this first release, so dont bugger me with that. Its better to get thing working again. But admob should been pretty easy to reimplements again throught as we now can use the newest google services api again, which can improve the stability a lots.

Im & Gernot have still not integrate the project to glbasic yet, but its a nice progressing throught.

Just to note, Android TV is supported and Fire TV should been supported out of the box as well (as long you does not uses Google Service for those devices), and you have full access to the source code for Android version. There is no So libs used this time, that is include glbasic source code its self. Of course landscape suppot is required.

Im do havent take a look into Ouya as well gameStick. Ouya was such a great test console prior to Android TV really. Here the Ouya SDK is required to been implemented, which im think should do that as a own project really.

The project is still works on a Android 5.1 emulator and on a Android 8 phone as im have, so api 16 would been the minimumsdk required while im currectly using api 28 as target sdk (Android 9). Arm 32, 64 + Intel 32+64 bit should all been supported (the emulator im uses is Intel based). So the future 64bit requirements would not been a issue.
97
so technically, I save IDs in an array: 7, 14, 9, whatever

so which loop to use to get rid of, let's say 14?

Should I simply use a counter and then use DIMDEL after the loop (I think using it within could cause problems)?

Or DELETE within the loop?!
98
GLBasic - en / Re: Android Studio Progress......
« Last post by JohnnyB on 2019-May-14 »
Great work! GLBasic is great, should have started using it years ago. Much better than AppGameKit (that language is so ugly).
99
GLBasic - en / Re: Remove a number (integer) out of an array
« Last post by MrPlow on 2019-May-14 »
Just be careful of deletes in the said array.
I often 'mark' array items and delete them later.
100
GLBasic - en / Re: Remove a number (integer) out of an array
« Last post by MrPlow on 2019-May-14 »
Yes - for any array.
Pages: 1 ... 8 9 [10]