BASIC

Recent Posts

Pages: 1 2 3 [4] 5 6 ... 10
31
GLBasic - en / Re: Question...
« Last post by Schranz0r on 2019-May-17 »
I add the poll for you!
I'm not realy intressted in mobile, so my answer is yes :)
32
Competitions / Re: GLBasic Contest 02: 2D Art
« Last post by WPShadow on 2019-May-17 »
Quote
only question is how fast console window can be refreshed, and some functions to print at selected X,Y position would be also usefully.

That shouldn't be your problem... every developer have to find a way by himself to fix this issue  :D

I will set everything up for the next contest from 01.06 - 14.07. ?

I think 6 weeks should be enough
33
GLBasic - en / Question...
« Last post by Snoopy on 2019-May-17 »
I don't have the power to make a poll, so I ask :

Are you interested in a version of this beautiful language (but with a little more advanced possibilities, especially in 3D) only for Mac, Linux and Windows but not on mobile?

Thank you for your answers.
34
Competitions / Re: GLBasic Contest 02: 2D Art
« Last post by dreamerman on 2019-May-16 »
@WPShadow - for me sounds ok.

@Snoopy - true console mode sounded original, we can have this earlier or later and another contest with limitations for only SetPixel.
For moment I was thinking that we are limited to standard console colors but:

main file
Code: GLBasic [Select]
// project -> options -> console program
LOCAL i1%, i2%
FOR i2 = 0 TO 15
        FOR i1 = 0 TO 15
                ConsoleSetColor(i1, i2)
                STDOUT "test"
        NEXT
        STDOUT "\n"
NEXT
KEYWAIT
second file
Code: GLBasic [Select]
IMPORT "C" int __stdcall GetStdHandle(int nStdHandle)
IMPORT "C" int __stdcall SetConsoleTextAttribute(int hConsoleOutput, int wAttributes)

FUNCTION ConsoleSetColor: fg_color%, bg_color%
        LOCAL console_handle% = GetStdHandle(-11)
        SetConsoleTextAttribute(console_handle, bg_color% * 16 + fg_color%)
ENDFUNCTION

only question is how fast console window can be refreshed, and some functions to print at selected X,Y position would be also usefully.
Another thing is that you need to have idea for demo that would fit into console/text mode nicely, this may be an issue for me hehe... :D
35
Announcements / Re: Geek Audiobook out now!
« Last post by MrPlow on 2019-May-16 »
If anyone claims the codes please post to let others know :)
36
Off Topic / Re: Shaders
« Last post by dreamerman on 2019-May-15 »
Was it this topic? I think that there was also another one, but maybe not started by You, it had shaders included as sources not as attachments (that are now unavailable). Still this topic also gives some important info :)
37
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
38
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
39
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.
40
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


 
Pages: 1 2 3 [4] 5 6 ... 10