ui.images: use MEMO: instead of explicit cache
parent
628c219495
commit
0bbc63f865
|
@ -1,28 +1,18 @@
|
|||
! Copyright (C) 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: namespaces cache images images.loader accessors assocs
|
||||
kernel opengl opengl.gl opengl.textures ui.gadgets.worlds ;
|
||||
kernel opengl opengl.gl opengl.textures ui.gadgets.worlds
|
||||
memoize ;
|
||||
IN: ui.images
|
||||
|
||||
TUPLE: image-name path ;
|
||||
|
||||
C: <image-name> image-name
|
||||
|
||||
<PRIVATE
|
||||
|
||||
SYMBOL: image-cache
|
||||
|
||||
image-cache [ <cache-assoc> ] initialize
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: cached-image ( image-name -- image )
|
||||
path>> image-cache get [ load-image ] cache ;
|
||||
MEMO: cached-image ( image-name -- image ) path>> load-image ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
SLOT: images
|
||||
|
||||
: image-texture-cache ( world -- texture-cache )
|
||||
[ [ <cache-assoc> ] unless* ] change-images images>> ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue