@ -194,7 +194,7 @@
Author
~ ~ ~ ~ ~ ~
David Barr , aka javidx9 , © OneLoneCoder 2018 , 2019 , 2020 , 2021
David Barr , aka javidx9 , © OneLoneCoder 2018 , 2019 , 2020 , 2021
*/
# pragma endregion
@ -1306,14 +1306,10 @@ namespace olc
{
if ( x > = 0 & & x < width & & y > = 0 & & y < height )
return pColData [ y * width + x ] ;
else
return Pixel ( 0 , 0 , 0 , 0 ) ;
}
else
{
return pColData [ abs ( y % height ) * width + abs ( x % width ) ] ;
}
}
bool Sprite : : SetPixel ( int32_t x , int32_t y , Pixel p )
{
@ -1322,7 +1318,6 @@ namespace olc
pColData [ y * width + x ] = p ;
return true ;
}
else
return false ;
}
@ -1438,13 +1433,10 @@ namespace olc
pDecal = std : : make_unique < olc : : Decal > ( pSprite . get ( ) , filter , clamp ) ;
return olc : : rcode : : OK ;
}
else
{
pSprite . release ( ) ;
pSprite = nullptr ;
return olc : : rcode : : NO_FILE ;
}
}
olc : : Decal * Renderable : : Decal ( ) const
{ return pDecal . get ( ) ; }
@ -1764,7 +1756,6 @@ namespace olc
{
if ( pDrawTarget )
return pDrawTarget - > width ;
else
return 0 ;
}
@ -1772,7 +1763,6 @@ namespace olc
{
if ( pDrawTarget )
return pDrawTarget - > height ;
else
return 0 ;
}
@ -1830,9 +1820,7 @@ namespace olc
if ( ! pDrawTarget ) return false ;
if ( nPixelMode = = Pixel : : NORMAL )
{
return pDrawTarget - > SetPixel ( x , y , p ) ;
}
if ( nPixelMode = = Pixel : : MASK )
{
@ -1852,9 +1840,7 @@ namespace olc
}
if ( nPixelMode = = Pixel : : CUSTOM )
{
return pDrawTarget - > SetPixel ( x , y , funcPixelMode ( x , y , p , pDrawTarget - > GetPixel ( x , y ) ) ) ;
}
return false ;
}
@ -1952,6 +1938,10 @@ namespace olc
if ( radius > 0 )
{
Draw ( x , y , p ) ;
return ;
}
int x0 = 0 ;
int y0 = radius ;
int d = 3 - 2 * radius ;
@ -1977,9 +1967,6 @@ namespace olc
d + = 4 * ( x0 + + - y0 - - ) + 10 ;
}
}
else
Draw ( x , y , p ) ;
}
void PixelGameEngine : : FillCircle ( const olc : : vi2d & pos , int32_t radius , Pixel p )
{ FillCircle ( pos . x , pos . y , radius , p ) ; }
@ -1991,6 +1978,10 @@ namespace olc
if ( radius > 0 )
{
Draw ( x , y , p ) ;
return ;
}
int x0 = 0 ;
int y0 = radius ;
int d = 3 - 2 * radius ;
@ -2019,9 +2010,6 @@ namespace olc
}
}
}
else
Draw ( x , y , p ) ;
}
void PixelGameEngine : : DrawRect ( const olc : : vi2d & pos , const olc : : vi2d & size , Pixel p )
{ DrawRect ( pos . x , pos . y , size . x , size . y , p ) ; }
@ -2552,8 +2540,9 @@ namespace olc
di . uv = { { 0.0f , 0.0f } , { 0.0f , 1.0f } , { 1.0f , 1.0f } , { 1.0f , 0.0f } } ;
olc : : vf2d center ;
float rd = ( ( pos [ 2 ] . x - pos [ 0 ] . x ) * ( pos [ 3 ] . y - pos [ 1 ] . y ) - ( pos [ 3 ] . x - pos [ 1 ] . x ) * ( pos [ 2 ] . y - pos [ 0 ] . y ) ) ;
if ( rd ! = 0 )
{
if ( rd = = 0 ) return ;
rd = 1.0f / rd ;
float rn = ( ( pos [ 3 ] . x - pos [ 1 ] . x ) * ( pos [ 0 ] . y - pos [ 1 ] . y ) - ( pos [ 3 ] . y - pos [ 1 ] . y ) * ( pos [ 0 ] . x - pos [ 1 ] . x ) ) * rd ;
float sn = ( ( pos [ 2 ] . x - pos [ 0 ] . x ) * ( pos [ 0 ] . y - pos [ 1 ] . y ) - ( pos [ 2 ] . y - pos [ 0 ] . y ) * ( pos [ 0 ] . x - pos [ 1 ] . x ) ) * rd ;
@ -2568,7 +2557,6 @@ namespace olc
di . mode = nDecalMode ;
vLayers [ nTargetLayer ] . vecDecalInstance . push_back ( di ) ;
}
}
void PixelGameEngine : : DrawWarpedDecal ( olc : : Decal * decal , const std : : array < olc : : vf2d , 4 > & pos , const olc : : Pixel & tint )
{ DrawWarpedDecal ( decal , pos . data ( ) , tint ) ; }