@@ -497,23 +497,17 @@ void AddPickerMenu() {
497
497
layerCutButton . UpdateActive ( ) ;
498
498
499
499
UpdateChannels ( ) ;
500
-
501
500
}
502
501
public void InitUI ( ) {
503
502
InitControls ( ) ;
504
-
505
503
historyMenu = new HistoryMenu ( 16 , Height , model ) ;
506
504
historyMenu . UpdateListing ( ) ;
507
505
model . historyChanged += historyMenu . HistoryChanged ;
508
-
509
506
spriteMenu = new SpriteMenu ( Width - controlsMenu . Width , Height , model ) {
510
507
FocusOnMouseClick = true ,
511
508
UseMouse = true
512
509
} ;
513
510
spriteMenu . OnKeyboard += OnKeyboard ;
514
-
515
-
516
-
517
511
void OnKeyboard ( Keyboard info ) {
518
512
519
513
if ( info . IsKeyPressed ( Tab ) ) {
@@ -729,7 +723,6 @@ public override void Render(TimeSpan timeElapsed) {
729
723
y += 1 ;
730
724
this . Print ( x , y , new ColoredString ( $ "{ r . Width , 4 } { r . Height , 4 } ", f , b ) ) ;
731
725
}
732
-
733
726
bool GetRectDisplay ( out Rectangle r ) => model . selectRect . GetAdjustedRect ( out r ) ||
734
727
! ( ( r = model . selection . rects . FirstOrDefault ( r => r . Contains ( model . cursor ) ) ) . IsEmpty ) ;
735
728
bool GetEllipseDisplay ( out Ellipse e ) => model . selectRect . GetAdjustedEllipse ( out e ) ;
@@ -738,11 +731,9 @@ bool GetRectDisplay(out Rectangle r) => model.selectRect.GetAdjustedRect(out r)
738
731
case Mode . SelectOutline : {
739
732
int x = model . cursorScreen . X + 2 ;
740
733
int y = model . cursorScreen . Y ;
741
-
742
734
var f = model . brush . foreground ;
743
735
var b = model . brush . background ;
744
736
this . Print ( x , y , new ColoredString ( $ "{ model . cursorScreen . X , 4 } { model . cursorScreen . Y , 4 } ", f , b ) ) ;
745
-
746
737
if ( model . ticksSelect % 30 < 15 ) {
747
738
IEnumerable < Point > points = model . selectOutline . outline ;
748
739
if ( points . Any ( ) ) {
@@ -761,11 +752,9 @@ bool GetRectDisplay(out Rectangle r) => model.selectRect.GetAdjustedRect(out r)
761
752
case Mode . SelectWand : {
762
753
int x = model . cursorScreen . X + 2 ;
763
754
int y = model . cursorScreen . Y ;
764
-
765
755
var f = model . brush . foreground ;
766
756
var b = model . brush . background ;
767
757
this . Print ( x , y , new ColoredString ( $ "{ model . cursorScreen . X , 4 } { model . cursorScreen . Y , 4 } ", f , b ) ) ;
768
-
769
758
if ( model . ticksSelect % 30 < 15 ) {
770
759
DrawSelection ( ) ;
771
760
}
@@ -774,11 +763,9 @@ bool GetRectDisplay(out Rectangle r) => model.selectRect.GetAdjustedRect(out r)
774
763
case Mode . Move :
775
764
DrawSelection ( ) ;
776
765
//Draw offset
777
-
778
766
//TO DO: Fix
779
767
if ( model . ticksSelect % 10 < 5 && model . move . current . HasValue ) {
780
768
var offset = model . move . end - model . move . start . Value ;
781
-
782
769
int x = model . move . start . Value . X - camera . X ;
783
770
int y = model . move . start . Value . Y - camera . Y ;
784
771
bool first = true ;
@@ -901,15 +888,11 @@ void DrawVertical() {
901
888
break ;
902
889
}
903
890
}
904
-
905
-
906
-
907
891
base . Render ( timeElapsed ) ;
908
892
void DrawSelection ( ) => DrawPoints ( model . selection . GetAll ( ) ) ;
909
893
void DrawSelectionWith ( IEnumerable < Point > points ) => DrawPoints ( model . selection . GetAll ( ) . Union ( points ) ) ;
910
894
void DrawPoints ( IEnumerable < Point > all ) {
911
895
foreach ( var point in all ) {
912
-
913
896
bool n = Contains ( new Point ( 0 , - 1 ) ) , e = Contains ( new Point ( 1 , 0 ) ) , s = Contains ( new Point ( 0 , + 1 ) ) , w = Contains ( new Point ( - 1 , 0 ) ) , ne = Contains ( new Point ( 1 , - 1 ) ) , se = Contains ( new Point ( 1 , 1 ) ) , sw = Contains ( new Point ( - 1 , 1 ) ) , nw = Contains ( new Point ( - 1 , - 1 ) ) ;
914
897
bool Contains ( Point offset ) => all . Contains ( point + offset ) ;
915
898
var p = point - camera ;
@@ -979,8 +962,6 @@ void DrawPoints(IEnumerable<Point> all) {
979
962
}
980
963
void DrawRect ( Rectangle r ) {
981
964
var ( left , top ) = ( r . X , r . Y ) ;
982
-
983
-
984
965
if ( r . Width > 1 && r . Height > 1 ) {
985
966
DrawSidesX ( Line . Single ) ;
986
967
DrawSidesY ( Line . Single ) ;
@@ -999,7 +980,6 @@ void DrawRect(Rectangle r) {
999
980
} else {
1000
981
DrawBox ( left , top , new BoxGlyph { n = Line . Single , e = Line . Single , s = Line . Single , w = Line . Single } ) ;
1001
982
}
1002
-
1003
983
void DrawCornerNW ( ) {
1004
984
//Left top
1005
985
DrawBox ( left , top , new BoxGlyph { e = Line . Single , s = Line . Single } ) ;
@@ -1052,7 +1032,6 @@ public override bool ProcessKeyboard(Keyboard info) {
1052
1032
}
1053
1033
if ( info . IsKeyPressed ( S ) ) {
1054
1034
//File.WriteAllText(Path.Combine(Environment.CurrentDirectory, Path.GetFileName(Path.GetTempFileName())), JsonConvert.SerializeObject(model));
1055
-
1056
1035
if ( model . filepath == null || info . IsKeyDown ( LeftShift ) ) {
1057
1036
var p = Game . Instance . Screen as Console ;
1058
1037
Game . Instance . Screen = new FileMenu ( p . Width , p . Height , new SaveMode ( model , this ) ) ;
@@ -1061,23 +1040,20 @@ public override bool ProcessKeyboard(Keyboard info) {
1061
1040
}
1062
1041
}
1063
1042
}
1064
-
1065
1043
model . ProcessKeyboard ( info ) ;
1066
1044
}
1067
1045
return base . ProcessKeyboard ( info ) ;
1068
1046
}
1069
1047
public override bool ProcessMouse ( MouseScreenObjectState state ) {
1070
1048
IsFocused = true ;
1071
- var delta = state . Mouse . ScrollWheelValueChange / 120 ;
1049
+ var delta = state . Mouse . ScrollWheelValueChange ;
1072
1050
if ( model . ctrl ) {
1073
1051
if ( delta < 0 ) {
1074
1052
FontSize += new Point ( 1 , 1 ) ;
1075
-
1076
1053
( int w , int h ) = Program . calculate ( FontSize . X ) ;
1077
1054
Resize ( w , h , w , h , false ) ;
1078
1055
} else if ( delta > 0 ) {
1079
1056
FontSize -= new Point ( 1 , 1 ) ;
1080
-
1081
1057
( int w , int h ) = Program . calculate ( FontSize . X ) ;
1082
1058
Resize ( w , h , w , h , false ) ;
1083
1059
}
@@ -1194,7 +1170,7 @@ public SpriteModel(int width, int height) {
1194
1170
public void Save ( Console renderer ) {
1195
1171
var fileName = Path . GetDirectoryName ( filepath ) + "/" + Path . GetFileNameWithoutExtension ( filepath ) ;
1196
1172
File . WriteAllText ( $ "{ fileName } .asc", ASECIILoader . SerializeObject ( this ) ) ;
1197
- File . WriteAllText ( $ "{ fileName } .dat", JsonConvert . SerializeObject ( sprite . exportData , SFileMode . settings ) ) ;
1173
+ File . WriteAllText ( $ "{ fileName } .dat", ASECIILoader . SerializeObject ( sprite . exportData ) ) ;
1198
1174
var preview = sprite . preview ;
1199
1175
StringBuilder str = new StringBuilder ( ) ;
1200
1176
for ( int y = sprite . origin . Y ; y <= sprite . end . Y ; y ++ ) {
0 commit comments