Load fixes, FreeType memory usage fix
parent
b381c123dd
commit
70b685fad8
|
@ -5,7 +5,7 @@ io.buffers io.files io.nonblocking io.sockets io.binary
|
||||||
io.sockets.impl windows.errors strings io.streams.duplex kernel
|
io.sockets.impl windows.errors strings io.streams.duplex kernel
|
||||||
math namespaces sequences windows windows.kernel32
|
math namespaces sequences windows windows.kernel32
|
||||||
windows.shell32 windows.types windows.winsock splitting
|
windows.shell32 windows.types windows.winsock splitting
|
||||||
continuations ;
|
continuations math.bitfields ;
|
||||||
IN: io.windows
|
IN: io.windows
|
||||||
|
|
||||||
TUPLE: windows-nt-io ;
|
TUPLE: windows-nt-io ;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
! Copyright (C) 2005, 2007 Slava Pestov.
|
! Copyright (C) 2005, 2008 Slava Pestov.
|
||||||
! Portions copyright (C) 2007 Eduardo Cavazos.
|
! Portions copyright (C) 2007 Eduardo Cavazos.
|
||||||
! Portions copyright (C) 2008 Joe Groff.
|
! Portions copyright (C) 2008 Joe Groff.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types continuations kernel libc math macros
|
USING: alien alien.c-types continuations kernel libc math macros
|
||||||
namespaces math.vectors math.constants math.functions
|
namespaces math.vectors math.constants math.functions
|
||||||
math.parser opengl.gl opengl.glu combinators arrays sequences
|
math.parser opengl.gl opengl.glu combinators arrays sequences
|
||||||
splitting words byte-arrays ;
|
splitting words byte-arrays assocs ;
|
||||||
IN: opengl
|
IN: opengl
|
||||||
|
|
||||||
: coordinates [ first2 ] 2apply ;
|
: coordinates [ first2 ] 2apply ;
|
||||||
|
@ -233,7 +233,8 @@ TUPLE: sprite loc dim dim2 dlist texture ;
|
||||||
dup sprite-dlist delete-dlist
|
dup sprite-dlist delete-dlist
|
||||||
sprite-texture delete-texture ;
|
sprite-texture delete-texture ;
|
||||||
|
|
||||||
: free-sprites ( sprites -- ) [ [ free-sprite ] when* ] each ;
|
: free-sprites ( sprites -- )
|
||||||
|
[ nip [ free-sprite ] when* ] assoc-each ;
|
||||||
|
|
||||||
: with-translation ( loc quot -- )
|
: with-translation ( loc quot -- )
|
||||||
GL_MODELVIEW [ >r gl-translate r> call ] do-matrix ; inline
|
GL_MODELVIEW [ >r gl-translate r> call ] do-matrix ; inline
|
||||||
|
|
|
@ -36,13 +36,13 @@ M: font hashcode* drop font hashcode* ;
|
||||||
|
|
||||||
: close-freetype ( -- )
|
: close-freetype ( -- )
|
||||||
global [
|
global [
|
||||||
open-fonts [ values [ close-font ] each f ] change
|
open-fonts [ [ drop close-font ] assoc-each f ] change
|
||||||
freetype [ FT_Done_FreeType f ] change
|
freetype [ FT_Done_FreeType f ] change
|
||||||
] bind ;
|
] bind ;
|
||||||
|
|
||||||
M: freetype-renderer free-fonts ( world -- )
|
M: freetype-renderer free-fonts ( world -- )
|
||||||
dup world-handle select-gl-context
|
dup world-handle select-gl-context
|
||||||
world-fonts values [ second free-sprites ] each ;
|
world-fonts [ nip second free-sprites ] assoc-each ;
|
||||||
|
|
||||||
: ttf-name ( font style -- name )
|
: ttf-name ( font style -- name )
|
||||||
2array H{
|
2array H{
|
||||||
|
@ -100,7 +100,7 @@ SYMBOL: dpi
|
||||||
swap set-font-height ;
|
swap set-font-height ;
|
||||||
|
|
||||||
: <font> ( handle -- font )
|
: <font> ( handle -- font )
|
||||||
V{ } clone
|
H{ } clone
|
||||||
{ set-font-handle set-font-widths } font construct
|
{ set-font-handle set-font-widths } font construct
|
||||||
dup init-font ;
|
dup init-font ;
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ M: freetype-renderer open-font ( font -- open-font )
|
||||||
: char-width ( open-font char -- w )
|
: char-width ( open-font char -- w )
|
||||||
over font-widths [
|
over font-widths [
|
||||||
dupd load-glyph glyph-hori-advance ft-ceil
|
dupd load-glyph glyph-hori-advance ft-ceil
|
||||||
] cache-nth nip ;
|
] cache nip ;
|
||||||
|
|
||||||
M: freetype-renderer string-width ( open-font string -- w )
|
M: freetype-renderer string-width ( open-font string -- w )
|
||||||
0 -rot [ char-width + ] with each ;
|
0 -rot [ char-width + ] with each ;
|
||||||
|
@ -175,7 +175,7 @@ M: freetype-renderer string-height ( open-font string -- h )
|
||||||
[ bitmap>texture ] keep [ init-sprite ] keep ;
|
[ bitmap>texture ] keep [ init-sprite ] keep ;
|
||||||
|
|
||||||
: draw-char ( open-font char sprites -- )
|
: draw-char ( open-font char sprites -- )
|
||||||
[ dupd <char-sprite> ] cache-nth nip
|
[ dupd <char-sprite> ] cache nip
|
||||||
sprite-dlist glCallList ;
|
sprite-dlist glCallList ;
|
||||||
|
|
||||||
: (draw-string) ( open-font sprites string loc -- )
|
: (draw-string) ( open-font sprites string loc -- )
|
||||||
|
@ -186,7 +186,7 @@ M: freetype-renderer string-height ( open-font string -- h )
|
||||||
] do-enabled ;
|
] do-enabled ;
|
||||||
|
|
||||||
: font-sprites ( open-font world -- pair )
|
: font-sprites ( open-font world -- pair )
|
||||||
world-fonts [ open-font V{ } clone 2array ] cache ;
|
world-fonts [ open-font H{ } clone 2array ] cache ;
|
||||||
|
|
||||||
M: freetype-renderer draw-string ( font string loc -- )
|
M: freetype-renderer draw-string ( font string loc -- )
|
||||||
>r >r world get font-sprites first2 r> r> (draw-string) ;
|
>r >r world get font-sprites first2 r> r> (draw-string) ;
|
||||||
|
|
|
@ -6,7 +6,8 @@ math math.vectors namespaces prettyprint sequences strings
|
||||||
vectors words windows.kernel32 windows.gdi32 windows.user32
|
vectors words windows.kernel32 windows.gdi32 windows.user32
|
||||||
windows.opengl32 windows.messages windows.types
|
windows.opengl32 windows.messages windows.types
|
||||||
windows.nt windows threads timers libc combinators continuations
|
windows.nt windows threads timers libc combinators continuations
|
||||||
command-line shuffle opengl ui.render unicode.case ascii ;
|
command-line shuffle opengl ui.render unicode.case ascii
|
||||||
|
math.bitfields ;
|
||||||
IN: ui.windows
|
IN: ui.windows
|
||||||
|
|
||||||
TUPLE: windows-ui-backend ;
|
TUPLE: windows-ui-backend ;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: alien.syntax kernel math windows.types ;
|
USING: alien.syntax kernel math windows.types math.bitfields ;
|
||||||
IN: windows.advapi32
|
IN: windows.advapi32
|
||||||
LIBRARY: advapi32
|
LIBRARY: advapi32
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
! Copyright (C) 2005, 2006 Doug Coleman.
|
! Copyright (C) 2005, 2006 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types alien.syntax parser namespaces kernel
|
USING: alien alien.c-types alien.syntax parser namespaces kernel
|
||||||
math windows.types windows.types init assocs sequences libc ;
|
math math.bitfields windows.types windows.types init assocs
|
||||||
|
sequences libc ;
|
||||||
IN: windows.opengl32
|
IN: windows.opengl32
|
||||||
|
|
||||||
! PIXELFORMATDESCRIPTOR flags
|
! PIXELFORMATDESCRIPTOR flags
|
||||||
|
@ -70,8 +71,6 @@ IN: windows.opengl32
|
||||||
: WGL_SWAP_UNDERLAY14 HEX: 20000000 ; inline
|
: WGL_SWAP_UNDERLAY14 HEX: 20000000 ; inline
|
||||||
: WGL_SWAP_UNDERLAY15 HEX: 40000000 ; inline
|
: WGL_SWAP_UNDERLAY15 HEX: 40000000 ; inline
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
: pfd-dwFlags
|
: pfd-dwFlags
|
||||||
{ PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL PFD_DOUBLEBUFFER } flags ;
|
{ PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL PFD_DOUBLEBUFFER } flags ;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2005, 2006 Doug Coleman.
|
! Copyright (C) 2005, 2006 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.syntax parser namespaces kernel math
|
USING: alien alien.syntax parser namespaces kernel math
|
||||||
windows.types shuffle ;
|
windows.types shuffle math.bitfields ;
|
||||||
IN: windows.user32
|
IN: windows.user32
|
||||||
|
|
||||||
! HKL for ActivateKeyboardLayout
|
! HKL for ActivateKeyboardLayout
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
|
! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
|
||||||
|
|
||||||
USING: alien alien.c-types alien.syntax arrays byte-arrays kernel
|
USING: alien alien.c-types alien.syntax arrays byte-arrays
|
||||||
math sequences windows.types windows.kernel32 windows.errors structs
|
kernel math sequences windows.types windows.kernel32
|
||||||
windows ;
|
windows.errors structs windows math.bitfields ;
|
||||||
IN: windows.winsock
|
IN: windows.winsock
|
||||||
|
|
||||||
USE: libc
|
USE: libc
|
||||||
|
|
Loading…
Reference in New Issue