private void buttonExecute_Click(object sender, EventArgs e) { string strCode = textBoxMain.Text.Replace(";;", ";"); Code code = RasterLib.RasterApi.CreateCode(strCode); _hc = new DownSolver(code, DownSolver.enables.QuickView); UpdateDisplay(); }
private void modelToolStripMenuItem_Click(object sender, EventArgs e) { string resultName = FileIo.GetOpenFilename("Open a model File", "Stereolithography file (*.STL)|*.stl|OBJ file (*.OBJ)|*.obj|All files (*.*)|*.*"); if (resultName != null) { Triangles triangles = RasterLib.RasterApi.StlToTriangles(resultName); Grid grid = RasterLib.RasterApi.CreateGrid(16, 16, 16, 4); RasterLib.RasterApi.Renderer.RenderTrianglesToGrid(triangles, grid); _hc = new DownSolver(grid, DownSolver.enables.QuickView); UpdateDisplay(); } }
private void comboBoxGly_SelectedIndexChanged(object sender, EventArgs e) { string strCode = comboBoxGly.Text; textBoxMain.Text = strCode.Split('*')[0]; textBoxMain.Text = textBoxMain.Text.Replace(";", "\r\n"); Code code = RasterLib.RasterApi.CreateCode(strCode); //codeString = RasterApi.CodeToRescaledCode(codeString, 64, 64, 64); _hc = new DownSolver(code, DownSolver.enables.QuickView); UpdateDisplay(); }
private void openGlyphicsFileToolStripMenuItem_Click(object sender, EventArgs e) { string filename = FileIo.GetOpenFilename("Open a GlyphC File", "Glyphics file (*.GLYC)|*.glyc|All files (*.*)|*.*"); if (filename != null && filename.Length > 1) { //filename = @"C:\Github\Glyphics2\Glyph Cores\Game.glyc"; string strCode = RasterLib.RasterApi.ReadGlyc(filename); textBoxMain.Text = strCode;// strCode.Split('*')[0]; textBoxMain.Text = textBoxMain.Text.Replace(";", "\r\n"); strCode = Linearize(strCode); // strCode = strCode.Replace(';','\n'); Code code = RasterLib.RasterApi.CreateCode(strCode); _hc = new DownSolver(code, DownSolver.enables.QuickView); UpdateDisplay(); } }
private void WinGlyphics_Load(object sender, EventArgs e) { const string codeString = @"PrintableNexus,Size3D4 64 64 64;Spawn 25 5 25;PenColorD4 31 127 255 255; PenShape 1;WallCube 1; PenColorD4 255 255 255 255; PenSize 1 2 1; Rect 0 0 0 31 0 31; Rect 0 0 32 31 0 63; Rect 32 0 0 63 0 31; Rect 32 0 32 63 0 63; Rect 16 0 16 48 0 48; PenSize 1 1 1;PenColorD4 31 127 255 255; FillRect 17 0 17 47 0 47;FillRect 16 1 49 48 16 63; PenColorD4 0 0 0 0; FillRect 17 1 49 47 15 63; Rect 0 1 0 63 63 63; ImgEdgeX 255 255 255 255; ImgEdgeY 255 255 255 255; ImgEdgeZ 255 255 255 255; PenShape 2;PenColorD3 255 255 255;FillRect 26 17 51 36 28 62; PenColorD3 127 255 127;FillRect 2 1 2 13 12 13; PenColorD3 255 127 127;FillRect 2 1 18 13 12 29; PenColorD3 127 127 255;FillRect 2 1 34 13 12 45; PenColorD3 255 255 127;FillRect 2 1 50 13 12 61; PenColorD3 255 127 255;FillRect 18 1 2 29 12 13; ImgMirrorX "; textBoxMain.Text = codeString; _hc = new DownSolver("..\\..\\..\\..\\Glyph Cores\\default.gly", DownSolver.enables.QuickView); foreach (Code code in _hc.Codes) { comboBoxGly.Items.Add(code.ToString()); } comboBoxGly.Text = _hc.Codes.GetCode(0).ToString(); }
public static int Analyze(string inputFilenameWithPath, Digest digest, string outputFolder, RasterLib.DownSolver.enables enables) { string filename = Path.GetFileNameWithoutExtension(inputFilenameWithPath); List <CodeCompilerError> results = new List <CodeCompilerError>(); Console.WriteLine("Analyzing: " + inputFilenameWithPath); string buildFolder = outputFolder; DateTime dt = File.GetLastWriteTime(inputFilenameWithPath); using (StreamReader reader = File.OpenText(inputFilenameWithPath)) { string name = reader.ReadLine().TrimEnd().TrimEnd(','); if (name.CompareTo(filename) != 0) { results.Add(new CodeCompilerError(inputFilenameWithPath, 0, String.Format("Filename '{0}' mismatch to '{1}'", filename, name), CodeCompilerError.Severity.Warning)); } string fullcode = ""; while (!reader.EndOfStream) { string line = reader.ReadLine(); if (line.Length > 0 && line[0] == '#') { //Ignore comment } else { fullcode += line + "\n"; } } DownSolver ds = new DownSolver(inputFilenameWithPath, enables); CompiledCode ca = new CompiledCode(); ca.name = name; ca.minimalCode = MultiLineCodeToSingleLineCode(fullcode); ca.filename = filename + ".glyc"; ca.path = ".";// Path.GetDirectoryName(inputFilenameWithPath); ca.timestamp = dt; if (digest.FindByName(ca.name) != null) { results.Add(new CodeCompilerError(inputFilenameWithPath, 0, String.Format("{0} already exists in digest!", name), CodeCompilerError.Severity.Error)); } else { digest.codes.Add(ca); } ca.tokenCount = ds.Tokens.Count; if (ds.Rects != null) { ca.rectCount = ds.Rects.Count; } if (ds.Quads != null) { ca.quadCount = ds.Quads.Count; } if (ds.Triangles != null) { ca.triCount = ds.Triangles.Count; } ca.SizeX = ds.Grid.SizeX; ca.SizeY = ds.Grid.SizeY; ca.SizeZ = ds.Grid.SizeZ; if (ds.SerializedRects != null) { ca.SerializedRects = ds.SerializedRects.SerializedData; } if (ds.SerializedRectsMipMap != null) { ca.SerializedRectsMipMapX16 = ds.SerializedRectsMipMap.SerializedData; } if (ds.GridIsometricLarge != null) { ca.isometricGridLargeFilename = buildFolder + filename + "_isometric_large.png"; GraphicsApi.SaveFlatPng(ca.isometricGridLargeFilename, ds.GridIsometricLarge); } if (ds.GridIsometric != null) { ca.isometricGridFilename = buildFolder + filename + "_isometric.png"; GraphicsApi.SaveFlatPng(ca.isometricGridFilename, ds.GridIsometric); } if (ds.GridIsometricThumb != null) { ca.isometricGridThumbFilename = buildFolder + filename + "_isometric_thumb.png"; GraphicsApi.SaveFlatPng(ca.isometricGridThumbFilename, ds.GridIsometricThumb); } if (ds.GridOrthogonal != null) { ca.orthogonalGridFilename = buildFolder + filename + "_orthogonal.png"; GraphicsApi.SaveFlatPng(ca.orthogonalGridFilename, ds.GridOrthogonal); } if ((enables & RasterLib.DownSolver.enables.DoDocs) != 0) { GraphicsLib.Creators.DocumentationCreator.DocumentByCode(outputFolder, name, ca.minimalCode); } foreach (CodeCompilerError result in results) { Console.WriteLine(result); if (result.severity == CodeCompilerError.Severity.Error) { return(-1); } } if (results.Count > 0) { Console.WriteLine(); } return(0); } }