diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-09-20 12:00:59 +0000 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-09-20 12:00:59 +0000 |
| commit | 9aec3f89e7239eded3fd18b5428947143463b213 (patch) | |
| tree | c5495b6212ef33c6470cd5560ab066d0a67309fd | |
| parent | 4b007c2b1f6791ca52e840a15c2edc9c754acf41 (diff) | |
tesselation, should be optionalwinBinary
43 files changed, 654 insertions, 148 deletions
@@ -1 +1,7 @@ # VkChess.net + +<p align="center"> + <a href="screenshot.png"> + <kbd><img src="screenshot.png" height="300"></kbd> + </a> +</p> diff --git a/src/BoardWidget.cs b/src/BoardWidget.cs index 7188a41..456bfe5 100644 --- a/src/BoardWidget.cs +++ b/src/BoardWidget.cs @@ -3,7 +3,9 @@ // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; +using System.Collections.Generic; using System.ComponentModel; +using System.IO; using Crow; using Crow.Drawing; //using vkvg; @@ -13,10 +15,13 @@ namespace vkChess public class BoardWidget : Widget { Picture sprites; + string filePath; + IList<string> moves; + string[,] currentBoard; Piece[,] board; [DefaultValue(null)] - public virtual Piece[,] Board { + public Piece[,] Board { get { return board; } set { if (board == value) { @@ -28,15 +33,84 @@ namespace vkChess RegisterForGraphicUpdate (); } } - public BoardWidget ():base() + public virtual IList<string> Moves { + get => moves; + set { + if (moves == value) + return; + + if (moves is ObservableList<string> ol) { + ol.ListAdd -= Lines_ListAdd; + ol.ListRemove -= Lines_ListRemove; + ol.ListClear -= Lines_ListClear; + } + + moves = value; + + if (moves is ObservableList<string> olNew) { + olNew.ListAdd += Lines_ListAdd; + olNew.ListRemove += Lines_ListRemove; + olNew.ListClear += Lines_ListClear; + } + + NotifyValueChanged ("Moves", moves); + + replayAllMoves (); + + RegisterForGraphicUpdate (); + } + } + public string FilePath { + get => FilePath; + set { + if (filePath == value) + return; + filePath = value; + NotifyValueChangedAuto (filePath); + RegisterForGraphicUpdate (); + + if (string.IsNullOrEmpty (filePath)) + resetCurrentBoard (); + else + loadFromFile (); + } + } + public BoardWidget (): base() { sprites = new SvgPicture ("data/Pieces.svg"); } + static readonly string[,] boardInit = { + {"wr", "wp", "", "", "", "", "bp", "br"}, + {"wk", "wp", "", "", "", "", "bp", "bk"}, + {"wb", "wp", "", "", "", "", "bp", "bb"}, + {"wq", "wp", "", "", "", "", "bp", "bq"}, + {"wK", "wp", "", "", "", "", "bp", "bK"}, + {"wb", "wp", "", "", "", "", "bp", "bb"}, + {"wk", "wp", "", "", "", "", "bp", "bk"}, + {"wr", "wp", "", "", "", "", "bp", "br"} + }; + void Lines_ListAdd (object sender, ListChangedEventArg e) + { + processMove (currentBoard, e.Element.ToString()); + RegisterForRedraw (); + } + void Lines_ListRemove (object sender, ListChangedEventArg e) + { + replayAllMoves (); + RegisterForRedraw (); + } + void Lines_ListClear (object sender, ListClearEventArg e) + { + resetCurrentBoard(); + RegisterForRedraw (); + } protected override void onDraw (Context gr) { base.onDraw (gr); + this.setFontForContext (gr); + /*gr.FontFace = Font.Name; gr.FontSize = (uint)Font.Size;*/ @@ -88,47 +162,108 @@ namespace vkChess } gr.Fill (); - if (board == null) - return; - for (int x = 0; x < 8; x++) { - for (int y = 0; y < 8; y++) { - if (board [x, y] == null) - continue; + if (board != null) { + for (int x = 0; x < 8; x++) { + for (int y = 0; y < 8; y++) { + if (board [x, y] == null) + continue; - string spriteName; - if (board [x, y].Player == ChessColor.White) - spriteName = "w"; - else - spriteName = "b"; + string spriteName; + if (board [x, y].Player == ChessColor.White) + spriteName = "w"; + else + spriteName = "b"; - switch (board[x,y].Type) { - case PieceType.Pawn: - spriteName += "p"; - break; - case PieceType.Rook: - spriteName += "r"; - break; - case PieceType.Knight: - spriteName += "k"; - break; - case PieceType.Bishop: - spriteName += "b"; - break; - case PieceType.King: - spriteName += "K"; - break; - case PieceType.Queen: - spriteName += "q"; - break; + switch (board[x,y].Type) { + case PieceType.Pawn: + spriteName += "p"; + break; + case PieceType.Rook: + spriteName += "r"; + break; + case PieceType.Knight: + spriteName += "k"; + break; + case PieceType.Bishop: + spriteName += "b"; + break; + case PieceType.King: + spriteName += "K"; + break; + case PieceType.Queen: + spriteName += "q"; + break; + } + sprites.Paint (IFace, gr,new Rectangle( + (int)(gridX + x * cellSize), + (int)(gridY + (7 - y) * cellSize), + (int)cellSize, + (int)cellSize),spriteName); + } + } + } else if (moves != null && currentBoard != null) { + for (int x = 0; x < 8; x++) { + for (int y = 0; y < 8; y++) { + if (string.IsNullOrEmpty(currentBoard [x, y])) + continue; + sprites.Paint (IFace, gr,new Rectangle( + (int)(gridX + x * cellSize), + (int)(gridY + (7 - y) * cellSize), + (int)cellSize, + (int)cellSize),currentBoard[x, y]); } - sprites.Paint (IFace, gr,new Rectangle( - (int)(gridX + x * cellSize), - (int)(gridY + (7 - y) * cellSize), - (int)cellSize, - (int)cellSize),spriteName); } } } + void loadFromFile () { + try { + using (Stream stream = new FileStream (filePath, FileMode.Open)) + using (StreamReader sw = new StreamReader (stream)) + Moves = sw.ReadLine ().Split (' '); + } catch (Exception ex) { + Crow.MessageBox.ShowModal (IFace, MessageBox.Type.Error, $"Failed loading {filePath}\n{ex.Message}"); + } + } + void resetCurrentBoard () => currentBoard = boardInit.Clone() as string[,]; + void replayAllMoves () { + resetCurrentBoard (); + if (moves == null) + return; + int i = 0; + + lock (VkChess.movesMutex) { + foreach (string move in moves) { + try { + processMove (currentBoard, move); + } catch { + Console.WriteLine ($"move: {move} i:{i}"); + } + i++; + } + } + } + void processMove (string[,] board, string move) { + ReadOnlySpan<char> m = move.AsSpan(); + Point p0 = VkChess.getChessCell (m.Slice (0, 2)); + Point p1 = VkChess.getChessCell (m.Slice (2, 2)); + + if (board[p0.X, p0.Y][1] == 'p') {//pawn + if (m.Length == 5) //pawnPromotion + board[p0.X, p0.Y] = board[p0.X, p0.Y][0].ToString() + m[4]; + else if (p0.X != p1.X && string.IsNullOrEmpty (board[p1.X, p1.Y]))//prise en passant + board[p0.X, p1.Y] = null; + }else if (board[p0.X, p0.Y][1] == 'K' && Math.Abs(p0.X - p1.X) > 1) {//rook + if (p0.X - p1.X < 0) {//small rock + board[5, p0.Y] = board[7, p0.Y]; + board[7, p0.Y] = null; + } else { //big rock + board[3, p0.Y] = board[0, p0.Y]; + board[0, p0.Y] = null; + } + } + board[p1.X, p1.Y] = board[p0.X, p0.Y]; + board[p0.X, p0.Y] = null; + } } } diff --git a/src/VkChess.cs b/src/VkChess.cs index f83b1d6..cfc1d9d 100644 --- a/src/VkChess.cs +++ b/src/VkChess.cs @@ -12,6 +12,8 @@ using Vulkan; using System.Reflection; using System.Net; using System.Runtime.InteropServices; +using Window = Crow.Window; +using System.Text; namespace vkChess { @@ -53,21 +55,34 @@ namespace vkChess app.Run (); } - public CommandGroup Commands => new CommandGroup ( - new CommandGroup ("Menu", - new Command ("New Game", () => loadWindow ("ui/newGame.crow", this)), - new Command ("Save", () => loadWindow ("ui/newGame.crow", this)), - new Command ("Load", () => loadWindow ("ui/newGame.crow", this)), - new Command ("Options", () => loadWindow ("ui/winOptions.crow", this)), - new Command ("Moves", () => loadWindow ("ui/winMoves.crow", this)), -#if DEBUG - new Command ("Log", () => loadWindow ("ui/winLog.crow", this)), -#endif - new Command ("Quit", () => Close()) - ), - new Command ("Undo", () => undo()) - //new Command ("Redo", () => Close()) - ); + public CommandGroup Commands, IconBar; + public Command CMDUndo, CMDOptions, CMDViewBoard, CMDViewMoves, CMDLoadSelectedFile; + public ToggleCommand CMDToggleHint; + void initCommands () { + CMDUndo = new ActionCommand ("Undo", () => undo(), "#icons.undo.svg"); + CMDOptions = new ActionCommand ("Options", () => loadWindow ("#ui.winOptions.crow", this), "#icons.options.svg"); + CMDViewMoves = new ActionCommand ("Moves", () => loadWindow ("#ui.winMoves.crow", this), "#icons.moves.svg"); + CMDViewBoard = new ActionCommand ("Mini Board", () => loadWindow ("#ui.winBoard.crow", this), "#icons.board.svg"); + CMDLoadSelectedFile = new ActionCommand ("Load", () => loadGameFromFile (selectedSavedGame), "#icons.load.svg"); + CMDToggleHint = new ToggleCommand (this, "Hint", new Binding<bool> ("EnableHint"), "#icons.hint.svg", null, true); + + IconBar = new CommandGroup (CMDOptions, CMDViewBoard, CMDViewMoves, CMDUndo, CMDToggleHint); + + Commands = new CommandGroup ( + new CommandGroup ("Menu", + new ActionCommand ("New Game", () => loadWindow ("#ui.winNewGame.crow", this), "#icons.flag.svg"), + new ActionCommand ("Save", () => loadWindow ("#ui.save.crow", this), "#icons.save.svg"), + new ActionCommand ("Load", () => loadWindow ("#ui.winLoad.crow", this), "#icons.load.svg"), + CMDOptions, + CMDViewBoard, + CMDViewMoves, + #if DEBUG + new ActionCommand ("Log", () => loadWindow ("#ui.winLog.crow", this), "#icons.load.svg"), + #endif + new ActionCommand ("Quit", () => Close(), "#icons.exit.svg") + ) + ); + } public override string [] EnabledInstanceExtensions => new string [] { @@ -127,6 +142,7 @@ namespace vkChess } protected override void initVulkan () { initLog (); + initCommands(); base.initVulkan (); @@ -182,9 +198,12 @@ namespace vkChess initBoard (); initStockfish (); - iFace.Load ("ui/chess.crow").DataSource = this; + iFace.Load ("#ui.menuOverlay.crow").DataSource = this; + iFace.Load ("#ui.chess.crow").DataSource = this; - loadCurrentGame (); + loadGameFromPositionString (Configuration.Global.Get<string> ("CurrentGame")); + + restoreSavedOpenedWindows (); } void createCamera () { camera = new Camera (Utils.DegreesToRadians (CameraFOV), 1f, 0.1f, 32f); @@ -388,6 +407,7 @@ namespace vkChess protected override void Dispose (bool disposing) { saveCurrentGame (); + saveOpenedWindowConfig (); Configuration.Global.Save(); if (disposing) { if (!isDisposed) { @@ -551,20 +571,13 @@ namespace vkChess loadWindow (@"ui/winSSR.crow", this); break; case Glfw.Key.F2: - /*loadWindow (@"ui/board.crow", this); - */ - //loadWindow (@"ui/scene.crow", this.renderer.model); - loadWindow (@"ui/board.crow", this); - NotifyValueChanged ("board", board); + saveGame (); break; case Glfw.Key.F3: checkBoardIntegrity (); break; case Glfw.Key.F4: - if (modifiers.HasFlag (Modifier.Shift)) - loadCurrentGame (); - else - saveCurrentGame (); + loadWindow (@"ui/winLoad.crow", this); break; case Glfw.Key.Keypad0: whitePieces [0].X = 0; @@ -685,7 +698,7 @@ namespace vkChess } } void onNewWhiteGame (object sender, MouseButtonEventArgs e) { - closeWindow ("ui/newGame.crow"); + closeWindow ("#ui.winNewGame.crow"); if (CurrentState < GameState.Play) return; Log(LogType.Custom1, "New White Game"); @@ -708,7 +721,7 @@ namespace vkChess Animation.StartAnimation (new AngleAnimation (this, "CameraAngleY", 0, 50)); } void onNewBlackGame (object sender, MouseButtonEventArgs e) { - closeWindow ("ui/newGame.crow"); + closeWindow ("#ui.winNewGame.crow"); if (CurrentState < GameState.Play) return; Log(LogType.Custom1, "New Black Game"); @@ -986,8 +999,91 @@ namespace vkChess Configuration.Global.Set ("OptGameIsExpanded", value); } } + string defaultSaveDirectory => System.IO.Path.Combine (Configuration.AppConfigPath, "SavedGames"); + public string[] SavedGames { + get { + if (!Directory.Exists (defaultSaveDirectory)) + return null; + return Directory.GetFiles (defaultSaveDirectory, "*.chess"); + } + } + string selectedSavedGame; + public string SelectedSavedGame { + get => selectedSavedGame; + set { + if (selectedSavedGame == value) + return; + selectedSavedGame = value; + NotifyValueChanged (selectedSavedGame); + if (string.IsNullOrEmpty (selectedSavedGame)) + CMDLoadSelectedFile.CanExecute = false; + else if (File.Exists (selectedSavedGame)) + CMDLoadSelectedFile.CanExecute = true; + } + } + void saveCurrentGame() { + if (historyIdx > 0) + StockfishMoves = savedMoves; + Configuration.Global.Set ("CurrentGame", stockfishPositionCommand); + } + + void loadGameFromPositionString (string positions) { + if (string.IsNullOrEmpty (positions)) + return; + + stockfishMoves = new ObservableList<string> (positions.Split (' ')); + + if (currentState < GameState.Play) + return; + resync3DScene (); + } + void saveGame (string fileName = null) { + if (!Directory.Exists (defaultSaveDirectory)) + Directory.CreateDirectory (defaultSaveDirectory); + + if (string.IsNullOrEmpty (fileName)) + fileName = $"{DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss")}.chess"; + else if (!fileName.EndsWith (".chess")) + fileName += ".chess"; + + string filePath = System.IO.Path.Combine (defaultSaveDirectory, fileName); + using (Stream stream = new FileStream (filePath, FileMode.Create)) + using (StreamWriter sw = new StreamWriter (stream)) + sw.WriteLine (stockfishPositionCommand); + } + void loadGameFromFile (string fullPath) { + closeWindow ("#ui.winBoard.crow"); + if (string.IsNullOrEmpty (fullPath) && !File.Exists (fullPath)) + return; + using (Stream stream = new FileStream (fullPath, FileMode.Open)) + using (StreamReader sw = new StreamReader (stream)) + loadGameFromPositionString (sw.ReadLine ()); + } + void saveOpenedWindowConfig () { + StringBuilder sb = new StringBuilder(100); + foreach (Window win in iFace.GraphicTree.OfType<Window>()) + sb.Append ($"{win.Name};{win.Left};{win.Top};{win.Width};{win.Height};{win.HorizontalAlignment};{win.VerticalAlignment}|"); + Configuration.Global.Set<string> ("OpenedWindows", + sb.Length > 0 ? sb.ToString (0, sb.Length - 1) : ""); + } + void restoreSavedOpenedWindows () { + string wins = Configuration.Global.Get<string> ("OpenedWindows"); + if (string.IsNullOrEmpty (wins)) + return; + foreach (string w in wins.Split ('|')) { + string [] tmp = w.Split (';'); + loadWindow (tmp[0], this); + Widget win = iFace.FindByName (tmp[0]); + win.Left = int.Parse (tmp[1]); + win.Top = int.Parse (tmp[2]); + win.Width = Measure.Parse (tmp[3]); + win.Height = Measure.Parse (tmp[4]); + win.HorizontalAlignment = EnumsNET.Enums.Parse<HorizontalAlignment> (tmp[5]); + win.VerticalAlignment = EnumsNET.Enums.Parse<VerticalAlignment> (tmp[6]); + } + } #endregion #region LOGS @@ -995,7 +1091,7 @@ namespace vkChess ObservableList<LogEntry> logs = new ObservableList<LogEntry>(); public ObservableList<LogEntry> MainLog => logs; void initLog () { - LogContextMenu = new CommandGroup (new Command("Clear Log", () => ResetLog())); + LogContextMenu = new CommandGroup (new ActionCommand("Clear Log", () => ResetLog())); } public void Log(LogType type, string message) { if (string.IsNullOrEmpty (message)) @@ -1019,7 +1115,8 @@ namespace vkChess if (historyIdx == 0) { //save current positions - savedMoves = StockfishMoves; + lock (movesMutex) + savedMoves = StockfishMoves; } historyIdx = value; @@ -1027,12 +1124,15 @@ namespace vkChess if (historyIdx == 0) { //restore current saved positions - StockfishMoves = savedMoves; + lock (movesMutex) + StockfishMoves = savedMoves; savedMoves = null; resync3DScene (); startTurn (); } else { - StockfishMoves = savedMoves.Take (savedMoves.Count - historyIdx).ToList(); + lock (movesMutex) + StockfishMoves = savedMoves.Take (savedMoves.Count - historyIdx).ToList(); + CurrentState = GameState.Play; resync3DScene (); } } @@ -1044,7 +1144,7 @@ namespace vkChess #endregion #region Stockfish - object movesMutex = new object (); + public static object movesMutex = new object (); Process stockfish; volatile bool waitAnimationFinished; //Queue<string> stockfishCmdQueue = new Queue<string> (); @@ -1169,24 +1269,6 @@ namespace vkChess get => stockfishMoves; set { stockfishMoves = value; } } - void saveCurrentGame() { - if (historyIdx > 0) - StockfishMoves = savedMoves; - Configuration.Global.Set ("CurrentGame", stockfishPositionCommand); - } - void loadCurrentGame() { - - resetBoard (false); - - string curGame = Configuration.Global.Get<string> ("CurrentGame"); - if (string.IsNullOrEmpty (curGame)) - return; - stockfishMoves = new ObservableList<string> (curGame.Split (' ')); - - if (currentState < GameState.Play) - return; - resync3DScene (); - } void resync3DScene () { replaySilently (); @@ -1669,20 +1751,6 @@ namespace vkChess board [p.initX, p.initY] = p; } } - void saveGame (string fileName = "default.chess") { - string defaultSaveDirectory = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".config", - System.Reflection.Assembly.GetEntryAssembly ().GetName().Name, "SavedGames"); - if (!Directory.Exists (defaultSaveDirectory)) - Directory.CreateDirectory (defaultSaveDirectory); - - string filePath = System.IO.Path.Combine (defaultSaveDirectory, fileName); - using (Stream stream = new FileStream (filePath, FileMode.Create)) - using (StreamWriter sw = new StreamWriter (stream)) - sw.WriteLine (stockfishPositionCommand); - } - void loadGame (string fileName = "default.chess") { - - } void addPiece (ChessColor player, PieceType _type, int col, int line) { Piece p = new Piece (player, _type, col, line, player == ChessColor.White ? WhiteColor : BlackColor); @@ -2012,15 +2080,14 @@ namespace vkChess preview_Captured = null; } string getChessCell (Point cell) => getChessCell (cell.X, cell.Y); - string getChessCell (int col, int line) { + public static string getChessCell (int col, int line) { if (col < 0 || line < 0) return null; char c = (char)(col + 97); return c.ToString () + (line + 1).ToString (); } - Point getChessCell (string s) { - return new Point ((int)s [0] - 97, int.Parse (s [1].ToString ()) - 1); - } + public static Point getChessCell (ReadOnlySpan<char> s) + => new Point ((int)s [0] - 97, int.Parse (s [1].ToString ()) - 1); Vector3 getCurrentCapturePosition (Piece p) { float x, y; if (p.Player == ChessColor.White) { diff --git a/ui/Button.tmp b/ui/Button.tmp index 4fcdde1..f3e6f22 100644 --- a/ui/Button.tmp +++ b/ui/Button.tmp @@ -4,7 +4,7 @@ MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black};{caption.Foreground=White}" MouseLeave="{Foreground=Transparent};{caption.Foreground=LightGrey}" MouseDown="{Foreground=vgradient|0:Black|0.05:Grey|0.85:Grey|1:White}" - MouseUp="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}" + MouseUp="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}" > <Label Font="{./Font}" Name="caption" Margin="3" Foreground="LightGrey" Text="{./Caption}"/> </Border> diff --git a/ui/Spinner.tmp b/ui/Spinner.tmp new file mode 100644 index 0000000..825b095 --- /dev/null +++ b/ui/Spinner.tmp @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}"> + <HorizontalStack Spacing="1"> + <TextBox Style="ControlEditableText" Foreground="{./Foreground}" Font="{./Font}" Width="Stretched" + Text="{²./Value}" TextAlignment="Right" /> + <VerticalStack Width="16" Height="Stretched" Spacing="0" Margin="0"> + <Shape KeepProportions="false" Margin="1" Style="ArrowBut" Height="50%" MouseDown="./onUp" Size="10,10" Path="M 4.5,0.5 L 9.5,9.5 L 0.5,9.5 Z F"/> + <Shape KeepProportions="false" Margin="1" Style="ArrowBut" Height="50%" MouseDown="./onDown" Size="10,10" Path="M 0.5,0.5 L 9.5,0.5 L 4.5,9.5 Z F"/> + </VerticalStack> + </HorizontalStack> +</Border>
\ No newline at end of file diff --git a/ui/Window.template b/ui/Window.template index 0b9c4ea..1e2b3f0 100644 --- a/ui/Window.template +++ b/ui/Window.template @@ -1,8 +1,10 @@ <?xml version="1.0"?> <Border Name="SizeHandle" Style="winBorder" CornerRadius="{./CornerRadius}" Background="{./Background}" > <VerticalStack Spacing="0"> - <Group Margin="2" Height="Fit"> - <Label Font="serif, 18" Name="MoveHandle" Width="90%" Foreground="${WindowTitleBarForeground" Margin="1" TextAlignment="Center" Text="{./Caption}" /> + <Group Margin="2" Height="Fit" Name="MoveHandle" Background="${WindowTitleBarBackground}"> + <Image Margin="1" Width="20" Height="20" HorizontalAlignment="Left" Path="{./Icon}"/> + <Label Font="serif, 18" Fit="true" Foreground="${WindowTitleBarForeground}" Margin="1" TextAlignment="Center" Text="{./Caption}" + VerticalAlignment="Center"/> <ListBox Data="{./Commands}" Fit="true" HorizontalAlignment="Right" VerticalAlignment="Top"> <Template> <HorizontalStack Name="ItemsContainer" /> diff --git a/ui/board.crow b/ui/board.crow deleted file mode 100644 index 1386807..0000000 --- a/ui/board.crow +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<Window Font="droid bold, 10" Caption="Mini Board" Width="350" Height="350" HorizontalAlignment="Right" Top="300"> - <Container> - <BoardWidget Margin="1" Board="{board}" Font="droid, 10" /> - </Container> -</Window>
\ No newline at end of file diff --git a/ui/chess.crow b/ui/chess.crow index 6657492..0a12378 100644 --- a/ui/chess.crow +++ b/ui/chess.crow @@ -12,9 +12,6 @@ </MenuItem> </ItemTemplate> </Menu> - <CheckBox Caption="Hint" IsChecked="{²EnableHint}" Height="Stretched" - Background="Transparent" Foreground="White" - Unchecked = "{Background=Transparent}"/> <Widget Width="Stretched"/> <VerticalStack Style="hsStatus" Width="160"> <Label Style="labStatus" Text="State:" /> diff --git a/ui/chess.style b/ui/chess.style index 66c1db2..3198ae7 100644 --- a/ui/chess.style +++ b/ui/chess.style @@ -1,17 +1,52 @@ //ControlHighlight = "0.2,0.3,0.8,0.9"; ControlHighlight = "MidnightBlue"; +ControlForeground = "Grey"; LogFont = "consolas, 10"; WindowBackground = "0.01,0.01,0.02,0.8"; -ContainerBackground = "0.01,0.01,0.01,0.9"; +WindowTitleBarBackground = "0.01,0.1,0.4,0.8"; +ContainerBackground = "0.2,0.2,0.21,0.9"; StateCtrlInactiveBackground = "0.02,0.02,0.02,0.9"; StateCtrlInactiveForeground = "White"; StateCtrlHighlightForeground = "Black"; StatusElementBackground = "#040404"; -MenusBackground = "0.1,0.1,0.1,0.7"; +MenusBackground = "0.1,0.1,0.1,0.2"; +ControlCaption { + Foreground = "${ControlForeground}"; + //MouseEnter = "{Foreground=${ControlCaptionHoverColor}}"; + //MouseLeave = "{Foreground=${ControlForeground}}"; +} icon { - Width="14"; - Height="14"; + Width="24"; + Height="24"; +} + +icoButton { + Template = "ui/icoButton.tmp"; + MinimumSize = "1,1"; + Width="Fit"; + Height="Fit"; + CornerRadius="15"; + Foreground = "Transparent"; + Background = "${ContainerBackground}"; +} +icoToggle { + Template = "ui/icoToggle.tmp"; + MinimumSize = "1,1"; + Width="Fit"; + Height="Fit"; + CornerRadius="15"; + Foreground = "Transparent"; + Background = "${ContainerBackground}"; +} +CheckBox { + Template = "#ui.checkBox.tmp"; + MinimumSize = "80, 30"; + Width="Fit"; + Height= "Fit"; + Background="${StateCtrlInactiveBackground}"; + Checked="{Background=${ControlHighlight}}"; + Unchecked = "{Background=${StateCtrlInactiveBackground}}"; } hsStatus { @@ -36,7 +71,7 @@ labStatus2 { } CheckBox { - Template = "ui/checkBox.tmp"; + Template = "#ui.checkBox.tmp"; MinimumSize = "80, 30"; Width="Fit"; Height= "Fit"; @@ -44,6 +79,10 @@ CheckBox { Checked="{Background=${ControlHighlight}}"; Unchecked = "{Background=${StateCtrlInactiveBackground}}"; } +Spinner { + Template = "#ui.Spinner.tmp"; + +} RadioButton { Template = "ui/checkBox.tmp"; MinimumSize = "80, 30"; @@ -65,8 +104,13 @@ Window { Template="ui/Window.template"; AllowedStates="Normal"; CornerRadius="0"; + MinimumSize="100,100"; Background="${WindowBackground}"; } +WindowIconBorder { + Height="18"; + Width="18"; +} Expandable { Background="${ContainerBackground}"; } @@ -124,7 +168,6 @@ winBorder { StickyMouseEnabled="true"; StickyMouse="10"; } - chessPceButtonMargin = "5"; chessPceButtonImageMargin = "2"; diff --git a/ui/icoButton.tmp b/ui/icoButton.tmp new file mode 100644 index 0000000..ce83d14 --- /dev/null +++ b/ui/icoButton.tmp @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<Border Name="Content" Margin="2" Width="40" Height="40" BorderWidth="1" + Background="${ContainerBackground}" Tooltip="{./Caption}" + Foreground="Transparent" CornerRadius="{./CornerRadius}" + MouseEnter="{Foreground=White}" + MouseLeave="{Foreground=Transparent}" + MouseDown="{Background=${ControlHighlight}}" + MouseUp="{Background=${ContainerBackground}}" + ClipToClientRect="true"> + <Image Style="icon" Name="caption" Path="{./Icon}" /> +</Border> diff --git a/ui/icoToggle.tmp b/ui/icoToggle.tmp new file mode 100644 index 0000000..bb4e3a0 --- /dev/null +++ b/ui/icoToggle.tmp @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<Border Name="Content" Margin="2" Width="40" Height="40" BorderWidth="1" + Background="${ContainerBackground}" Tooltip="{./Caption}" + Foreground="Transparent" CornerRadius="{./CornerRadius}" + MouseEnter="{Foreground=White}" + MouseLeave="{Foreground=Transparent}" + MouseDown="{Background=${ControlHighlight}}" + MouseUp="{Background=${ContainerBackground}}" + ClipToClientRect="true"> + <Group DataSource="{./Command}" > + <Widget Background="${ControlHighlight}" IsVisible="{IsToggled}" CornerRadius="15"/> + <Image Style="icon" Name="caption" Path="{./Icon}" /> + </Group> +</Border> diff --git a/ui/icons/board.svg b/ui/icons/board.svg new file mode 100644 index 0000000..654cb3f --- /dev/null +++ b/ui/icons/board.svg @@ -0,0 +1,11 @@ +<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"> + <g id="Layer_1"> + <title>Layer 1</title> + <g id="svg_5" transform="rotate(45, 16, 16)"> + <rect fill="#191919" stroke="#000" stroke-width="0" x="5" y="5" width="11" height="11" id="svg_1"/> + <rect fill="#cccccc" stroke="#000" stroke-width="0" x="5" y="16" width="11" height="11" id="svg_2"/> + <rect fill="#191919" stroke="#000" stroke-width="0" x="16" y="16" width="11" height="11" id="svg_3"/> + <rect fill="#cccccc" stroke="#000" stroke-width="0" x="16" y="5" width="11" height="11" id="svg_4"/> + </g> + </g> +</svg>
\ No newline at end of file diff --git a/ui/icons/clock.svg b/ui/icons/clock.svg new file mode 100644 index 0000000..9deec4a --- /dev/null +++ b/ui/icons/clock.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M7.5 0c-4.1 0-7.5 3.4-7.5 7.5s3.4 7.5 7.5 7.5 7.5-3.4 7.5-7.5-3.4-7.5-7.5-7.5zM7.5 13c-3 0-5.5-2.5-5.5-5.5s2.5-5.5 5.5-5.5 5.5 2.5 5.5 5.5-2.5 5.5-5.5 5.5z"></path> +<path fill="#dddddd" d="M8 3h-1v5h4v-1h-3z"></path> +</svg> diff --git a/ui/icons/crossed-arrows.svg b/ui/icons/crossed-arrows.svg new file mode 100644 index 0000000..dc4fd59 --- /dev/null +++ b/ui/icons/crossed-arrows.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M15 5v-4h-4l1.3 1.3-4.3 4.3-4.3-4.3 1.3-1.3h-4v4l1.3-1.3 4.3 4.3-4.3 4.3-1.3-1.3v4h4l-1.3-1.3 4.3-4.3 4.3 4.3-1.3 1.3h4v-4l-1.3 1.3-4.3-4.3 4.3-4.3z"></path> +</svg> diff --git a/ui/icons/dashboard.svg b/ui/icons/dashboard.svg new file mode 100644 index 0000000..23dd2d9 --- /dev/null +++ b/ui/icons/dashboard.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M16 10.1c0-4.4-3.6-8.1-8-8.1s-8 3.7-8 8.1c0 1.4 0.3 2.9 0.9 3.9h4.9c0.5 0.6 1.3 1 2.2 1s1.7-0.4 2.2-1h4.9c0.6-1 0.9-2.5 0.9-3.9zM14 7v1l-4.1 3.5c0 0.1 0.1 0.3 0.1 0.5 0 1.1-0.9 2-2 2s-2-0.9-2-2 0.9-2 2-2c0.3 0 0.6 0.1 0.8 0.2l4.2-3.2h1zM10 4h1v1h-1v-1zM5 4h1v1h-1v-1zM2 12h-1v-1h1v1zM3 8h-1v-1h1v1zM15 12h-1v-1h1v1z"></path> +<path fill="#dddddd" d="M9 12c0 0.552-0.448 1-1 1s-1-0.448-1-1c0-0.552 0.448-1 1-1s1 0.448 1 1z"></path> +</svg> diff --git a/ui/icons/exit-symbol-1.svg b/ui/icons/exit-symbol-1.svg new file mode 100644 index 0000000..f4d28d6 --- /dev/null +++ b/ui/icons/exit-symbol-1.svg @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M10 0c1.1 0 2 0.9 2 2 0 0.9-0.6 1.7-1.5 1.9 0 0 0 0.1 0 0.1 0.4 0 0.7 0.2 1 0.5l1.3 1.3c0.1 0.1 0.3 0.2 0.5 0.2h1.7v-6h-5z"></path> +<path fill="#dddddd" d="M11.8 14.5l-3.8-4.5v2.5c0 0.8-0.7 1.5-1.5 1.5h-3.5c-0.6 0-1-0.4-1-1s0.4-1 1-1h2.5c0.3 0 0.5-0.2 0.5-0.5v-2c0-0.7 0.1-1.3 0.4-2l0.7-1.5h-0.8c-0.5 0-0.9 0.2-1.2 0.6l-0.5 0.7c-0.2 0.4-0.7 0.5-1.2 0.3-0.4-0.3-0.6-0.9-0.2-1.3l0.6-0.8c0.7-1 1.9-1.5 3.1-1.5h2l0.1-0.3c-0.6-0.3-1-1-1-1.7 0-1.1 0.9-2 2-2h-7v4.9l-0.6 0.8c-0.3 0.4-0.5 0.9-0.4 1.5 0.1 0.5 0.4 1 0.9 1.3 0 0 0 0 0 0v2.5c-1.1 0-2 0.9-2 2s0.9 2 2 2v1h11.6c-1.1 0-2.1-0.6-2.7-1.5z"></path> +<path fill="#dddddd" d="M11.4 7.3l-0.7-0.8-0.6 1.5c-0.2 0.5-0.3 0.9 0 1.3l4.9 6.1v-7.4h-2.1c-0.6 0-1.1-0.2-1.5-0.7z"></path> +</svg> diff --git a/ui/icons/exit.svg b/ui/icons/exit.svg new file mode 100644 index 0000000..4fa7969 --- /dev/null +++ b/ui/icons/exit.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M14 6h-1.7c-0.2 0-0.4-0.1-0.6-0.2l-1.3-1.3c-0.2-0.3-0.6-0.5-1.1-0.5h-0.3c1.1 0 2-0.9 2-2s-0.9-2-2-2-2 0.9-2 2c0 0.7 0.4 1.4 1 1.7l-0.2 0.3h-2c-1.1 0-2.3 0.5-3 1.5l-0.6 0.8c-0.4 0.4-0.2 1 0.2 1.3 0.4 0.2 0.9 0.1 1.2-0.3l0.5-0.7c0.3-0.4 0.7-0.6 1.2-0.6h0.8l-0.7 1.6c-0.3 0.6-0.4 1.2-0.4 1.9v2c0 0.3-0.2 0.5-0.5 0.5h-2.5c-0.6 0-1 0.4-1 1s0.4 1 1 1h3.5c0.8 0 1.5-0.7 1.5-1.5v-2.5l3.8 4.5c0.6 0.9 1.7 1.5 2.8 1.5h0.9l-5.4-6.7c-0.3-0.4-0.2-0.8 0-1.3l0.6-1.5 0.7 0.8c0.4 0.4 1 0.7 1.6 0.7h2c0.6 0 1-0.4 1-1s-0.4-1-1-1z"></path> +</svg> diff --git a/ui/icons/exit2.svg b/ui/icons/exit2.svg new file mode 100644 index 0000000..112ccc3 --- /dev/null +++ b/ui/icons/exit2.svg @@ -0,0 +1,7 @@ +<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"> + <g id="Layer_1"> + <title>Layer 1</title> + <rect fill="#ffffff" stroke="#ffffff" stroke-width="2" x="2.08598" y="7.40272" width="27.82805" height="17.19457" id="svg_2" fill-opacity="0"/> + <text fill="#ffffff" stroke="#000" stroke-width="0" x="3.95626" y="19.50679" id="svg_1" font-size="10" font-family="monospace" text-anchor="start" xml:space="preserve" font-weight="bold" font-style="normal">EXIT</text> + </g> +</svg>
\ No newline at end of file diff --git a/ui/icons/expand-arrows-1.svg b/ui/icons/expand-arrows-1.svg new file mode 100644 index 0000000..5a77b1d --- /dev/null +++ b/ui/icons/expand-arrows-1.svg @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M5.3 6.7l1.4-1.4-3-3 1.3-1.3h-4v4l1.3-1.3z"></path> +<path fill="#dddddd" d="M6.7 10.7l-1.4-1.4-3 3-1.3-1.3v4h4l-1.3-1.3z"></path> +<path fill="#dddddd" d="M10.7 9.3l-1.4 1.4 3 3-1.3 1.3h4v-4l-1.3 1.3z"></path> +<path fill="#dddddd" d="M11 1l1.3 1.3-3 3 1.4 1.4 3-3 1.3 1.3v-4z"></path> +</svg> diff --git a/ui/icons/flag.svg b/ui/icons/flag.svg new file mode 100644 index 0000000..a69f898 --- /dev/null +++ b/ui/icons/flag.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M4 2c0-1.1-0.9-2-2-2s-2 0.9-2 2c0 0.7 0.4 1.4 1 1.7v12.3h2v-12.3c0.6-0.3 1-1 1-1.7z"></path> +<path fill="#dddddd" d="M4 4c0 0 1-3 3.6-3 2.7 0 2.3 1 4.4 1 2.4 0 4-1 4-1v8c0 0-0.7 2-4 2-2.2 0-2.3-1-5-1-2.3 0-3 2-3 2v-8z"></path> +</svg> diff --git a/ui/icons/hint.svg b/ui/icons/hint.svg new file mode 100644 index 0000000..4193a75 --- /dev/null +++ b/ui/icons/hint.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#FFFFFF" d="M11.7 1.9c-1-1.2-2.6-1.9-4.2-1.9s-3.2 0.7-4.2 1.9c-1 1.1-1.4 2.6-1.2 4 0.2 1.5 0.8 2.6 2.1 3.7 0.5 0.4 0.7 0.8 0.9 1.2 0 0.1 0.1 0.2 0.1 0.3-0.1 0.1-0.2 0.2-0.2 0.4 0 0.3 0.2 0.5 0.5 0.5-0.3 0-0.5 0.2-0.5 0.5s0.2 0.5 0.5 0.5c-0.3 0-0.5 0.2-0.5 0.5s0.2 0.5 0.5 0.5c-0.3 0-0.5 0.2-0.5 0.5s0.2 0.5 0.5 0.5h0.5c0 0.5 0.7 1 1.5 1s1.5-0.5 1.5-1h0.5c0.3 0 0.5-0.2 0.5-0.5s-0.2-0.5-0.5-0.5c0.3 0 0.5-0.2 0.5-0.5s-0.2-0.5-0.5-0.5c0.3 0 0.5-0.2 0.5-0.5s-0.2-0.5-0.5-0.5c0.3 0 0.5-0.2 0.5-0.5 0-0.2-0.1-0.3-0.2-0.4 0-0.1 0.1-0.1 0.1-0.2 0.2-0.4 0.4-0.8 0.9-1.2 1.3-1.1 1.9-2.2 2.1-3.8 0.2-1.4-0.2-2.8-1.2-4zM12 5.8c-0.2 1.3-0.7 2.2-1.8 3.2-0.6 0.5-0.9 1-1.2 1.4-0.2 0.5-0.3 0.6-0.5 0.6h-2c-0.2 0-0.3-0.1-0.5-0.6-0.2-0.4-0.5-1-1.1-1.6-1.3-1.1-1.6-2-1.8-3-0.2-1.1 0.2-2.3 0.9-3.2 0.9-1 2.2-1.6 3.5-1.6s2.6 0.6 3.5 1.6c0.7 0.9 1.1 2.1 1 3.2z"></path> +<path fill="#FFFFFF" d="M11 5h-1c0-0.7-0.8-2-2-2v-1c1.8 0 3 1.8 3 3z"></path> +</svg> diff --git a/ui/icons/human.svg b/ui/icons/human.svg new file mode 100644 index 0000000..c9d0ae3 --- /dev/null +++ b/ui/icons/human.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M8 0c-5.6 0-2.9 7.3-2.9 7.3 0.6 1 1.4 0.8 1.4 1.5 0 0.6-0.7 0.8-1.4 0.9-1.1 0-2.1-0.2-3.1 1.6-0.6 1.1-0.9 4.7-0.9 4.7h13.7c0 0-0.3-3.6-0.8-4.7-1-1.9-2-1.6-3.1-1.7-0.7-0.1-1.4-0.3-1.4-0.9s0.8-0.4 1.4-1.5c0 0.1 2.7-7.2-2.9-7.2z"></path> +</svg> diff --git a/ui/icons/load.svg b/ui/icons/load.svg new file mode 100644 index 0000000..8c0ffa1 --- /dev/null +++ b/ui/icons/load.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M11 10v2h-6v-2h-5v6h16v-6h-5zM4 14h-2v-2h2v2z"></path> +<path fill="#dddddd" d="M13 5l-5-5-5 5h3v6h4v-6z"></path> +</svg> diff --git a/ui/icons/move-arrows.svg b/ui/icons/move-arrows.svg new file mode 100644 index 0000000..ecbb2f9 --- /dev/null +++ b/ui/icons/move-arrows.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M16 8l-3-3v2h-4v-4h2l-3-3-3 3h2v4h-4v-2l-3 3 3 3v-2h4v4h-2l3 3 3-3h-2v-4h4v2z"></path> +</svg> diff --git a/ui/icons/moves.svg b/ui/icons/moves.svg new file mode 100644 index 0000000..86ea298 --- /dev/null +++ b/ui/icons/moves.svg @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M16 8l-3-3v2h-4v-4h2l-3-3-3 3h2v4h-4v-2l-3 3 3 3v-2h4v4h-2l3 3 3-3h-2v-4h4v2z"></path> +<path fill="#dddddd" d="M5.3 6.7l1.4-1.4-3-3 1.3-1.3h-4v4l1.3-1.3z"></path> +<path fill="#dddddd" d="M6.7 10.7l-1.4-1.4-3 3-1.3-1.3v4h4l-1.3-1.3z"></path> +<path fill="#dddddd" d="M10.7 9.3l-1.4 1.4 3 3-1.3 1.3h4v-4l-1.3 1.3z"></path> +<path fill="#dddddd" d="M11 1l1.3 1.3-3 3 1.4 1.4 3-3 1.3 1.3v-4z"></path> +</svg> diff --git a/ui/icons/open-book.svg b/ui/icons/open-book.svg new file mode 100644 index 0000000..feb3441 --- /dev/null +++ b/ui/icons/open-book.svg @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M8.1 3.1v0 0z"></path> +<path fill="#dddddd" d="M15.1 3.2v0-0.2z"></path> +<path fill="#dddddd" d="M9.9 1.5c-1.3 0-2 0.4-2.4 0.8-0.4-0.4-1.1-0.8-2.4-0.8-3.5 0-5.1 2-5.1 2v0 0 10.9l6.5-0.9c0 0 0.2 0.4 0.3 0.5h1.3c0.1-0.1 0.3-0.5 0.3-0.5l6.5 0.9v-10.9c0.1 0-1.4-2-5-2zM7 12c-0.6-0.2-1.3-0.3-2.3-0.4-0.1 0-0.1 0-0.2 0-1.4 0-2.6 0.4-3.5 0.7v-8.7c0.5-0.4 1.8-1.5 4.1-1.5 1.7 0 1.9 0.9 1.9 1 0 0 0 0 0 0v8.9zM14 12.3c-1-0.4-2.1-0.7-3.5-0.7-0.1 0-0.2 0-0.2 0-1 0-1.3 0.2-2.3 0.4v-8.9c0 0 0 0 0 0 0-0.2 0.2-1 1.9-1 2.3 0 4 1 4 1.5v8.7z"></path> +</svg> diff --git a/ui/icons/options.svg b/ui/icons/options.svg new file mode 100644 index 0000000..b0c3ffa --- /dev/null +++ b/ui/icons/options.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M16 9v-2l-1.7-0.6c-0.2-0.6-0.4-1.2-0.7-1.8l0.8-1.6-1.4-1.4-1.6 0.8c-0.5-0.3-1.1-0.6-1.8-0.7l-0.6-1.7h-2l-0.6 1.7c-0.6 0.2-1.2 0.4-1.7 0.7l-1.6-0.8-1.5 1.5 0.8 1.6c-0.3 0.5-0.5 1.1-0.7 1.7l-1.7 0.6v2l1.7 0.6c0.2 0.6 0.4 1.2 0.7 1.8l-0.8 1.6 1.4 1.4 1.6-0.8c0.5 0.3 1.1 0.6 1.8 0.7l0.6 1.7h2l0.6-1.7c0.6-0.2 1.2-0.4 1.8-0.7l1.6 0.8 1.4-1.4-0.8-1.6c0.3-0.5 0.6-1.1 0.7-1.8l1.7-0.6zM8 12c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"></path> +<path fill="#dddddd" d="M10.6 7.9c0 1.381-1.119 2.5-2.5 2.5s-2.5-1.119-2.5-2.5c0-1.381 1.119-2.5 2.5-2.5s2.5 1.119 2.5 2.5z"></path> +</svg> diff --git a/ui/icons/options2.svg b/ui/icons/options2.svg new file mode 100644 index 0000000..5326f19 --- /dev/null +++ b/ui/icons/options2.svg @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#FFFFFF" d="M10.3 8.2l-0.9 0.9 0.9 0.9-1.2 1.2 4.3 4.3c0.6 0.6 1.5 0.6 2.1 0s0.6-1.5 0-2.1l-5.2-5.2zM14.2 15c-0.4 0-0.8-0.3-0.8-0.8 0-0.4 0.3-0.8 0.8-0.8s0.8 0.3 0.8 0.8c0 0.5-0.3 0.8-0.8 0.8z"></path> +<path fill="#FFFFFF" d="M3.6 8l0.9-0.6 1.5-1.7 0.9 0.9 0.9-0.9-0.1-0.1c0.2-0.5 0.3-1 0.3-1.6 0-2.2-1.8-4-4-4-0.6 0-1.1 0.1-1.6 0.3l2.9 2.9-2.1 2.1-2.9-2.9c-0.2 0.5-0.3 1-0.3 1.6 0 2.1 1.6 3.7 3.6 4z"></path> +<path fill="#FFFFFF" d="M8 10.8l0.9-0.8-0.9-0.9 5.7-5.7 1.2-0.4 1.1-2.2-0.7-0.7-2.3 1-0.5 1.2-5.6 5.7-0.9-0.9-0.8 0.9c0 0 0.8 0.6-0.1 1.5-0.5 0.5-1.3-0.1-2.8 1.4-0.5 0.5-2.1 2.1-2.1 2.1s-0.6 1 0.6 2.2 2.2 0.6 2.2 0.6 1.6-1.6 2.1-2.1c1.4-1.4 0.9-2.3 1.3-2.7 0.9-0.9 1.6-0.2 1.6-0.2zM4.9 10.4l0.7 0.7-3.8 3.8-0.7-0.7z"></path> +</svg> diff --git a/ui/icons/pause.svg b/ui/icons/pause.svg new file mode 100644 index 0000000..33f4c86 --- /dev/null +++ b/ui/icons/pause.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M0 1h7v14h-7v-14z"></path> +<path fill="#dddddd" d="M9 1h7v14h-7v-14z"></path> +</svg> diff --git a/ui/icons/play.svg b/ui/icons/play.svg new file mode 100644 index 0000000..91ee85d --- /dev/null +++ b/ui/icons/play.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M2 1v14l12-7z"></path> +</svg> diff --git a/ui/icons/save.svg b/ui/icons/save.svg new file mode 100644 index 0000000..1aca525 --- /dev/null +++ b/ui/icons/save.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M16 10h-5.5l-2.5 2.5-2.5-2.5h-5.5v6h16v-6zM4 14h-2v-2h2v2z"></path> +<path fill="#dddddd" d="M10 6v-6h-4v6h-3l5 5 5-5z"></path> +</svg> diff --git a/ui/icons/undo.svg b/ui/icons/undo.svg new file mode 100644 index 0000000..f78f134 --- /dev/null +++ b/ui/icons/undo.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M0 7.9l6-4.9v3c0 0 1.1 0 2 0 8 0 8 8 8 8s-1-4-7.8-4c-1.1 0-1.8 0-2.2 0v2.9l-6-5z"></path> +</svg> diff --git a/ui/icons/warning.svg b/ui/icons/warning.svg new file mode 100644 index 0000000..f5a2573 --- /dev/null +++ b/ui/icons/warning.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#dddddd" d="M8 1l-8 14h16l-8-14zM8 13c-0.6 0-1-0.4-1-1s0.4-1 1-1 1 0.4 1 1c0 0.6-0.4 1-1 1zM7 10v-4h2v4h-2z"></path> +</svg> diff --git a/ui/menuCommand.itmp b/ui/menuCommand.itmp index 8e572e3..0d57248 100644 --- a/ui/menuCommand.itmp +++ b/ui/menuCommand.itmp @@ -1,10 +1,11 @@ <?xml version="1.0"?> <Button Command="{}" Width="Stretched" Height="Stretched"> <Template> - <Container Width="Stretched" Height="Stretched" Margin="6" + <HorizontalStack Width="Stretched" Height="Stretched" Margin="5" Spacing="5" MouseEnter="{Background=${ControlHighlight}}" MouseLeave="{Background=Transparent}"> - <Label Text="{./Caption}" HorizontalAlignment="Left" /> - </Container> + <Image Style="icon" Path="{./Icon}"/> + <Label Text="{./Caption}" HorizontalAlignment="Left" Margin="5"/> + </HorizontalStack> </Template> </Button> diff --git a/ui/menuItem.itmp b/ui/menuItem.itmp index cb09180..c4ee8ef 100644 --- a/ui/menuItem.itmp +++ b/ui/menuItem.itmp @@ -7,7 +7,7 @@ <Template> <Label Text="{./Caption}" Width="Stretched" Height="Stretched" Margin="3" Background="{./Background}"/> - </Template> + </Template> <VerticalStack Margin="0" Name="ItemsContainer" Fit="true" Background="Jet"/> </Popper> </ItemTemplate> diff --git a/ui/menuItem.template b/ui/menuItem.template index bca07bf..cf19b4f 100644 --- a/ui/menuItem.template +++ b/ui/menuItem.template @@ -5,9 +5,9 @@ <Template> <Container Background="{./Background}" Width="Stretched" Height="Stretched" Margin="6"> <Label Text="{./Caption}" HorizontalAlignment="Left" /> - </Container> + </Container> </Template> - <VerticalStack Margin="5" Name="ItemsContainer" Fit="true" Background="${MenusBackground}" /> + <VerticalStack Margin="0" Name="ItemsContainer" Fit="true" Background="${MenusBackground}" /> </Popper> diff --git a/ui/menuOverlay.crow b/ui/menuOverlay.crow new file mode 100644 index 0000000..46af1b5 --- /dev/null +++ b/ui/menuOverlay.crow @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<Menu Width="Fit" Height="Fit" HorizontalAlignment="Left" Data="{IconBar}"> + <Template> + <HorizontalStack Name="ItemsContainer" Spacing="10" Margin="10"/> + </Template> + <ItemTemplate DataType="Crow.ToggleCommand"> + <Button Style="icoToggle" Command="{}" /> + </ItemTemplate> + <ItemTemplate DataType="Crow.Command"> + <Button Style="icoButton" Command="{}" /> + </ItemTemplate> +</Menu>
\ No newline at end of file diff --git a/ui/winBoard.crow b/ui/winBoard.crow new file mode 100644 index 0000000..4135b4f --- /dev/null +++ b/ui/winBoard.crow @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<Window Font="droid bold, 10" Caption="Mini Board" Width="200" Height="200" HorizontalAlignment="Right" Top="10" + Icon="#icons.board.svg" > + <Container> + <BoardWidget Margin="1" Moves="{StockfishMoves}" Font="droid, 10" /> + </Container> +</Window>
\ No newline at end of file diff --git a/ui/winLoad.crow b/ui/winLoad.crow new file mode 100644 index 0000000..b3e4ebf --- /dev/null +++ b/ui/winLoad.crow @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<Window Caption="Saved Games" Width="80%" Height="80%" Icon="#icons.load.svg" > + <VerticalStack> + <ListBox Data="{SavedGames}" SelectedItem="{²SelectedSavedGame}"> + <Template> + <Wrapper Name="ItemsContainer"/> + </Template> + <ItemTemplate> + <ListItem Fit="True" Margin="0" Focusable="true" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <BoardWidget Margin="0" FilePath="{}" Font="droid, 10" Width="200" Height="200" /> + </ListItem> + </ItemTemplate> + </ListBox> + <Button Command="{CMDLoadSelectedFile}"/> + </VerticalStack> +</Window> + diff --git a/ui/winMoves.crow b/ui/winMoves.crow index 5a80573..bd8f822 100644 --- a/ui/winMoves.crow +++ b/ui/winMoves.crow @@ -1,7 +1,7 @@ <?xml version="1.0"?> -<Window Caption="Moves" Top="10" Left="10" Width="100" Height="50%" > +<Window Caption="Moves" Top="60" Left="10" Width="120" Height="50%" Icon="#icons.moves.svg" > <VerticalStack> - <MoveHistoryWidget Margin="10" Moves="{StockfishMoves}" CurrentMoveIndex="{²HistoryMoveIndex}"/> + <MoveHistoryWidget Margin="5" Moves="{StockfishMoves}" CurrentMoveIndex="{²HistoryMoveIndex}"/> </VerticalStack> </Window> diff --git a/ui/newGame.crow b/ui/winNewGame.crow index f4f3e8a..3896537 100644 --- a/ui/newGame.crow +++ b/ui/winNewGame.crow @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<Window Font="droid bold, 40" Height="50%" Width="60%" Caption="New Game"> +<Window Font="droid bold, 40" Height="50%" Width="60%" Caption="New Game" Icon="#icons.flag.svg" > <VerticalStack Margin="30" Spacing="5"> <HorizontalStack Margin="0" Spacing="0"> <Container Width="50%" Margin="20"> diff --git a/ui/winOptions.crow b/ui/winOptions.crow index 5d58924..0f7a96e 100644 --- a/ui/winOptions.crow +++ b/ui/winOptions.crow @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<Window Caption="Options" Top="10" Width="60%" Height="Fit" > +<Window Caption="Options" Top="10" Width="60%" Height="Fit" Icon="#icons.options.svg" > <VerticalStack Spacing="10" Margin="10" > <VerticalStack Height="Fit" Background="${ContainerBackground}" Margin="5"> <HorizontalStack > @@ -12,7 +12,7 @@ </HorizontalStack> </VerticalStack> <!--<HorizontalStack Height="Fit">--> - <Expandable Caption="Game" IsExpanded="{²OptGameIsExpanded}"> + <Expandable Caption="Game" IsExpanded="{²OptGameIsExpanded}" Background="${ContainerBackground}"> <VerticalStack Height="Fit" Spacing="3" Margin="10"> <HorizontalStack Height="Fit"> <Label Width="Stretched" Text="Whites Level:"/> @@ -50,7 +50,7 @@ </HorizontalStack> </VerticalStack> </HorizontalStack>--> - <Expandable Caption="Camera" IsExpanded="{²OptCameraIsExpanded}"> + <Expandable Caption="Camera" IsExpanded="{²OptCameraIsExpanded}" Background="${ContainerBackground}"> <VerticalStack Height="Fit" Margin="10"> <Vector3Widget Caption="Rotation" Value="{²CameraRotation}" SmallIncrement="0.01" LargeIncrement="0.1" Minimum="-7.0" Maximum="7.0" Decimals="2"/> <Vector3Widget Caption="Position" Value="{²CameraPosition}" SmallIncrement="0.1" LargeIncrement="1.0" Minimum="-20.0" Maximum="20.0" Decimals="1"/> @@ -60,7 +60,7 @@ </HorizontalStack> </VerticalStack> </Expandable> - <Expandable Caption="Rendering" IsExpanded="{²OptRenderingIsExpanded}"> + <Expandable Caption="Rendering" IsExpanded="{²OptRenderingIsExpanded}" Background="${ContainerBackground}"> <VerticalStack Height="Fit" Margin="10"> <HorizontalStack Style="Slid" > <Label Text="Exposure:" Width="100"/> @@ -84,7 +84,7 @@ </EnumSelector> </VerticalStack> </Expandable> - <Expandable Caption="Colors" IsExpanded="{²OptColorIsExpanded}"> + <Expandable Caption="Colors" IsExpanded="{²OptColorIsExpanded}" Background="${ContainerBackground}"> <VerticalStack Height="Fit" Margin="10"> <Vector3Widget Caption="Black color" Value="{²BlackColor}" SmallIncrement="0.01" LargeIncrement="0.1" Maximum="1.0" Decimals="2"/> <Vector3Widget Caption="White color" Value="{²WhiteColor}" SmallIncrement="0.01" LargeIncrement="0.1" Maximum="1.0" Decimals="2"/> diff --git a/vkChess.net.csproj b/vkChess.net.csproj index a03fbf8..131c5e8 100644 --- a/vkChess.net.csproj +++ b/vkChess.net.csproj @@ -1,30 +1,58 @@ -<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <OutputType>WinExe</OutputType> - <TargetFrameworks>netcoreapp3.1</TargetFrameworks> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <!--<TargetFrameworks>netcoreapp3.1</TargetFrameworks>--> <TargetFramework>netcoreapp3.1</TargetFramework> + <EnableDefaultNoneItems>false</EnableDefaultNoneItems> <EnableDefaultCompileItems>false</EnableDefaultCompileItems> <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath> <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)\</IntermediateOutputPath> - </PropertyGroup> + </PropertyGroup> <ItemGroup> <GLSLShader Include="shaders\**\*.frag;shaders\**\*.vert;shaders\**\*.comp;shaders\**\*.geom;shaders\**\*.tesc;shaders\**\*.tese" /> + <EmbeddedResource Include="ui\icons\*.*"> + <LogicalName>icons.%(Filename)%(Extension)</LogicalName> + </EmbeddedResource> + <EmbeddedResource Include="ui\*.*"> + <LogicalName>ui.%(Filename)%(Extension)</LogicalName> + </EmbeddedResource> <None Include="data\**\*.*;ui\**\*.*"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <EmbeddedResource Include="ui\*.style" /> </ItemGroup> + + <ItemGroup> + <Compile Include="src\**\*.cs" /> + </ItemGroup> + + <ItemGroup> - <PackageReference Include="VkCrowWindow" Version="0.3.5-beta" /> + <!--<PackageReference Include="Crow" Version="0.9.7-beta" />--> + + <PackageReference Include="VkCrowWindow" Version="0.3.6-beta" /> <PackageReference Include="vke" Version="0.2.1-beta" /> <PackageReference Include="SpirVTasks" Version="0.1.44" /> <PackageReference Include="vke.EnvironmentPipeline" Version="0.2.1-beta" /> <PackageReference Include="vke.gltfLoader" Version="0.2.1-beta" /> </ItemGroup> - <ItemGroup> - <Compile Include="src\**\*.cs" /> - </ItemGroup> + + + <PropertyGroup> + <TestProperty>notset</TestProperty> + </PropertyGroup> + <Target Name="CrowEditResolveTargetPath" AfterTargets="GetTargetPath" + Outputs="$(TestProperty)"> + <CreateProperty Value="$(TargetPath)"> + <Output TaskParameter="Value" PropertyName="TestProperty"/> + </CreateProperty> + + <!--<ItemGroup> + <TestItemGroup> + <TestProperty>this is a test string</TestProperty> + </TestItemGroup> + </ItemGroup>--> + </Target> </Project> |