File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ You can use it to create and share pixel art.
66By default, sprite sets up a 16x16 pixel canvas.
77If you'd like the larger 32x32 pixel canvas,
88start sprite with the -e flag.
9- It is the responsibility of the user to ensure the terminal is properly sized.
9+ If your terminal is not large enough to fit the 32x32 canvas,
10+ it will use the 16x16 canvas instead.
1011
1112Requirements
1213------------ 
Original file line number Diff line number Diff line change @@ -33,15 +33,13 @@ You can use it to create and share pixel art.
3333The options are as follows:
3434.Bl  -tag  -width  Ds 
3535.It  Fl  e 
36- Use an extended canvas of 32x32 pixels instead of the default 16x16 pixels.
36+ Use an extended canvas of 32x32 pixels instead of the default 16x16 pixels,
37+ if the terminal is large enough to support the larger canvas.
3738.El 
3839.Sh  AUTHORS 
3940.Nm 
4041was written by
4142.An  Brian  Callahan  Aq  Mt  bcallah@openbsd.org  .
4243.Sh  CAVEATS 
43- It is the responsibility of the user to ensure the terminal is properly
44- sized.
45- .Pp 
4644Console aspect ratio may not match user expectations.
4745PNG export creates standard square pixels.
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ color_panel(void)
169169static  void 
170170scrinit (void )
171171{
172- 	int  i ;
172+ 	int  i ,  x ,  y ;
173173
174174	if  (has_colors () ==  FALSE) {
175175		endwin ();
@@ -179,6 +179,14 @@ scrinit(void)
179179	start_color ();
180180	init_colors ();
181181
182+ 	getmaxyx (stdscr , y , x );
183+ 	if  (y  <  39  ||  x  <  90 )
184+ 		extended  =  0 ;
185+ 	if  (y  <  23  ||  x  <  74 ) {
186+ 		endwin ();
187+ 		errx (1 , "terminal too small!" );
188+ 	}
189+ 
182190	move (3 , 31 );
183191
184192	addch (ACS_ULCORNER );
@@ -392,7 +400,7 @@ file_save(int y, int x)
392400	noecho ();
393401
394402	if  ((fp  =  fopen (buf , "w+" )) ==  NULL ) {
395- 		move (21 , 31 );
403+ 		move (21   +  ( extended  ?  16  :  0 ) , 31 );
396404		printw ("Error: could not open %s for writing" , buf );
397405		goto out ;
398406	}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments