<commit_before>! Copyright (C) 2007, 2008 <NAME>
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alarms arrays calendar jamshred.game jamshred.gl jamshred.player jamshred.log kernel math math.constants namespaces sequences threads ui ui.backend ui.gadgets ui.gadgets.worlds ui.gestures ui.render math.vectors ;
IN: jamshred

TUPLE: jamshred-gadget jamshred last-hand-loc alarm ;

: <jamshred-gadget> ( jamshred -- gadget )
    jamshred-gadget construct-gadget swap >>jamshred ;

: default-width ( -- x ) 800 ;
: default-height ( -- y ) 600 ;

M: jamshred-gadget pref-dim*
    drop default-width default-height 2array ;

M: jamshred-gadget draw-gadget* ( gadget -- )
    [ jamshred>> ] [ rect-dim first2 draw-jamshred ] bi ;

: jamshred-loop ( gadget -- )
    dup jamshred>> quit>> [
        drop
    ] [
        dup [ jamshred>> jamshred-update ]
        [ relayout-1 ] bi
        10 sleep jamshred-loop
    ] if ;

: fullscreen ( gadget -- )
    find-world t swap set-fullscreen* ;

: no-fullscreen ( gadget -- )
    find-world f swap set-fullscreen* ;

: toggle-fullscreen ( world -- )
    [ fullscreen? not ] keep set-fullscreen* ;

M: jamshred-gadget graft* ( gadget -- )
    [ jamshred-loop ] in-thread drop ;<commit_msg>jamshred: fixed hang bug with a call to yield (I think it's fixed)<commit_after>! Copyright (C) 2007, 2008 <NAME>
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alarms arrays calendar jamshred.game jamshred.gl jamshred.player jamshred.log kernel math math.constants namespaces sequences threads ui ui.backend ui.gadgets ui.gadgets.worlds ui.gestures ui.render math.vectors ;
IN: jamshred

TUPLE: jamshred-gadget jamshred last-hand-loc alarm ;

: <jamshred-gadget> ( jamshred -- gadget )
    jamshred-gadget construct-gadget swap >>jamshred ;

: default-width ( -- x ) 800 ;
: default-height ( -- y ) 600 ;

M: jamshred-gadget pref-dim*
    drop default-width default-height 2array ;

M: jamshred-gadget draw-gadget* ( gadget -- )
    [ jamshred>> ] [ rect-dim first2 draw-jamshred ] bi ;

: jamshred-loop ( gadget -- )
    dup jamshred>> quit>> [
        drop
    ] [
        dup [ jamshred>> jamshred-update ]
        [ relayout-1 ] bi
        yield jamshred-loop
    ] if ;

: fullscreen ( gadget -- )
    find-world t swap set-fullscreen* ;

: no-fullscreen ( gadget -- )
    find-world f swap set-fullscreen* ;

: toggle-fullscreen ( world -- )
    [ fullscreen? not ] keep set-fullscreen* ;

M: jamshred-gadget graft* ( gadget -- )
    [ jamshred-loop ] in-thread drop ;
{'fraction_non_alphanumeric': 0.12294440093970242, 'fraction_numerical': 0.014095536413469069, 'mean_word_length': 2.9307692307692306, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4714282', 'n_tokens_mistral': 923, 'n_tokens_neox': 896, 'n_words': 229}