Merge branch 'master' of git://factorcode.org/git/factor
						commit
						ebde016eed
					
				| 
						 | 
				
			
			@ -1,5 +1,7 @@
 | 
			
		|||
 | 
			
		||||
USING: kernel arrays sequences math.vectors math.geometry accessors ;
 | 
			
		||||
USING: kernel arrays sequences
 | 
			
		||||
       math math.points math.vectors math.geometry
 | 
			
		||||
       accessors ;
 | 
			
		||||
 | 
			
		||||
IN: math.geometry.rect
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -50,3 +52,10 @@ M: rect set-height! ( rect height -- rect ) over dim>> set-second ;
 | 
			
		|||
 | 
			
		||||
M: rect set-x! ( rect x -- rect ) over loc>> set-first  ;
 | 
			
		||||
M: rect set-y! ( rect y -- rect ) over loc>> set-second ;
 | 
			
		||||
 | 
			
		||||
! Accessing corners
 | 
			
		||||
 | 
			
		||||
: top-left     ( rect -- point ) loc>> ;
 | 
			
		||||
: top-right    ( rect -- point ) [ loc>> ] [ width  1 - ] bi v+x ;
 | 
			
		||||
: bottom-left  ( rect -- point ) [ loc>> ] [ height 1 - ] bi v+y ;
 | 
			
		||||
: bottom-right ( rect -- point ) [ loc>> ] [ dim>> ] bi v+ { 1 1 } v- ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -195,6 +195,8 @@ TUPLE: sprite loc dim dim2 dlist texture ;
 | 
			
		|||
 | 
			
		||||
: gl-translate ( point -- ) first2 0.0 glTranslated ;
 | 
			
		||||
 | 
			
		||||
<PRIVATE
 | 
			
		||||
 | 
			
		||||
: top-left drop 0 0 glTexCoord2i 0.0 0.0 glVertex2d ; inline
 | 
			
		||||
 | 
			
		||||
: top-right 1 0 glTexCoord2i first 0.0 glVertex2d ; inline
 | 
			
		||||
| 
						 | 
				
			
			@ -203,6 +205,8 @@ TUPLE: sprite loc dim dim2 dlist texture ;
 | 
			
		|||
 | 
			
		||||
: bottom-right 1 1 glTexCoord2i gl-vertex ; inline
 | 
			
		||||
 | 
			
		||||
PRIVATE>
 | 
			
		||||
 | 
			
		||||
: four-sides ( dim -- )
 | 
			
		||||
    dup top-left dup top-right dup bottom-right bottom-left ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue