Grogs is extremely unstable #2

Open
opened 2025-09-25 13:27:35 +10:00 by DiamondNether90 · 1 comment

Right now, using the grogs library is extremely unstable. For example, creating a loop without a delay instantly causes extreme lag. Also, functions just break the system. This is a problem, as you can't neatly organize your code.

Is there any way this could be fixed?

Right now, using the grogs library is extremely unstable. For example, creating a loop without a delay instantly causes extreme lag. Also, functions just break the system. This is a problem, as you can't neatly organize your code. Is there any way this could be fixed?
Author
Member

fun -list !init
    setlist &keyChecks 32 97
    setlist &keyDown false false
    setlist &keyTracker $keyChecks $keyDown
    return $keyTracker
endfun

fun -int !keyPressed -list &keyTracker
    getlistat &keyTracker 0 &keyChecks
    getlistat &keyTracker 1 &keyDown

    !grogs:getLastKey &key
    set &idx 0
    getlistsize &keyChecks &len
    @loop
        equal $idx $len &cond
        if $cond %false

        getlistat &keyChecks $idx &store
        equal $store $key &cond
        getlistat &keyDown $idx &store
        inequal $cond $store &cond
        if $cond %true

        add $idx 1 &idx
        jump %loop

    @true
    getlistat &keyChecks $idx &store
    return $store

    @false
    return -1
endfun

# Test script
!init &keyTracker

pusharg "Test" 1000 1000
!grogs:initSDL &store

@loop
    pusharg 100
    !grogs:delay &store

    !grogs:pollEvent &event
    equal $event 0 &cond
    if $cond %end

    pusharg $keyTracker
    !keyPressed &store
    stdlnout $store

    !grogs:renderFrame &store

    jump %loop

@end
!grogs:cleanup &store
stdlnout "End"
end 0

The program I want to run. Note the extreme delay between ctrl+c and the program terminating

```extern "grogs" fun -list !init setlist &keyChecks 32 97 setlist &keyDown false false setlist &keyTracker $keyChecks $keyDown return $keyTracker endfun fun -int !keyPressed -list &keyTracker getlistat &keyTracker 0 &keyChecks getlistat &keyTracker 1 &keyDown !grogs:getLastKey &key set &idx 0 getlistsize &keyChecks &len @loop equal $idx $len &cond if $cond %false getlistat &keyChecks $idx &store equal $store $key &cond getlistat &keyDown $idx &store inequal $cond $store &cond if $cond %true add $idx 1 &idx jump %loop @true getlistat &keyChecks $idx &store return $store @false return -1 endfun # Test script !init &keyTracker pusharg "Test" 1000 1000 !grogs:initSDL &store @loop pusharg 100 !grogs:delay &store !grogs:pollEvent &event equal $event 0 &cond if $cond %end pusharg $keyTracker !keyPressed &store stdlnout $store !grogs:renderFrame &store jump %loop @end !grogs:cleanup &store stdlnout "End" end 0 ``` The program I want to run. Note the extreme delay between ctrl+c and the program terminating
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ground/libraries#2
No description provided.