public unsafe void RetroVideoRefreshCallback(void *data, uint width, uint height, uint pitch) { if (GraphicsProcessor != null) { int intWidth = (int)width; int intHeight = (int)height; int intPitch = (int)pitch; switch (Game.PixelFormat) { case retro_pixel_format.RETRO_PIXEL_FORMAT_0RGB1555: { GraphicsProcessor.ProcessFrame0RGB1555((ushort *)data, intWidth, intHeight, intPitch / sizeof(ushort)); } break; case retro_pixel_format.RETRO_PIXEL_FORMAT_XRGB8888: { GraphicsProcessor.ProcessFrameARGB8888((uint *)data, intWidth, intHeight, intPitch / sizeof(uint)); } break; case retro_pixel_format.RETRO_PIXEL_FORMAT_RGB565: { GraphicsProcessor.ProcessFrameRGB565((ushort *)data, intWidth, intHeight, intPitch / sizeof(ushort)); } break; default: { throw new ArgumentOutOfRangeException(); } } } }
public static Font FromTtfStream(GraphicsProcessor gpu, Stream stream, int defaultSize = 16) { var data = new byte[stream.Length]; stream.Read(data, 0, data.Length); return(new FontStashFont(gpu, data, defaultSize)); }
public ConfigurationDefault(ReadonlyMemory memory, RandomAccessMemory ram, GraphicsProcessor graphicsProcessor, Accumulator accumulator, InputDevice inputDevice, Random random) : base(memory) { RAM = ram; GraphicsProcessor = graphicsProcessor; Accumulator = accumulator; InputDevice = inputDevice; Random = random; }
public static Font FromResource(GraphicsProcessor gpu, Assembly ass, string resource) { if (Resource.GetStream(ass, resource, out var stream)) { return(FromTtfStream(gpu, stream)); } throw new InvalidOperationException("Resource not found."); }
public static InstalledContentPack FromPak(GraphicsProcessor gpu, string pakPath) { var pakFile = PakUtils.OpenPak(pakPath); var fs = FileSystem.FromPak(pakFile); try { if (!fs.FileExists("/meta")) { throw new InvalidOperationException("Missing metadata file."); } if (!fs.FileExists("/meta.icon")) { throw new InvalidOperationException("Missing world icon."); } if (!fs.FileExists("/meta.boot")) { throw new InvalidOperationException("Missing boot logo."); } if (!fs.FileExists("/wallpaper")) { throw new InvalidOperationException("Missing wallpaper."); } using var metaStream = fs.OpenFile("/meta"); using var reader = new BinaryReader(metaStream, Encoding.UTF8); var name = reader.ReadString(); var author = reader.ReadString(); var description = reader.ReadString(); var icon = Texture2D.FromPak(gpu, fs.OpenFile("/meta.icon")); var wallpaper = Texture2D.FromPak(gpu, fs.OpenFile("/wallpaper")); var boot = Texture2D.FromPak(gpu, fs.OpenFile("/meta.boot")); var pack = new InstalledContentPack(); pack.Name = name; pack.Description = description; pack.Author = author; pack.Icon = icon; pack.Backdrop = wallpaper; pack.BootLogo = boot; pack._dataReader = () => File.OpenRead(pakPath); return(pack); } catch (Exception ex) { pakFile.Dispose(); throw new InvalidOperationException("Bad world pak", ex); } pakFile.Dispose(); return(null); }
public PostProcessor(GraphicsProcessor gpu) { Settings = new PostProcessSettings(this); _gpu = gpu; _basicEffect = new(_gpu); _matrix = Matrix4x4.CreateOrthographicOffCenter(0, 1, 1, 0, -1, 1); _basicEffect.Programs.First().Parameters["projection"].SetValue(_matrix); }
private void Form1_Load(object sender, EventArgs e) { graphicsProcessor = new GraphicsProcessor(HelpSelectedItem); KeyPreview = true; findItemDialog.form = this; groupItemsDialog.form = this; setNameDialog.form = this; DoubleBuffered = true; this.CustomRefresh(); }
private void NewToolStripMenuItem_Click(object sender, EventArgs e) { this.Items = new List <ITransformable>(); this.SelectedItem = null; this.groupOfItems = null; this.copied = null; graphicsProcessor = new GraphicsProcessor(HelpSelectedItem); openFileDialog1.FileName = String.Empty; saveFileDialog1.FileName = String.Empty; this.CustomRefresh(); }
public static Font GetDefaultFont(GraphicsProcessor gpu) { var result = false; if (Resource.GetStream(typeof(Font).Assembly, "Thundershock.Core.Resources.BuiltinFont.ttf", out Stream stream)) { result = true; return(FromTtfStream(gpu, stream)); } Debug.Assert(false, "Couldn't find built-in engine font resource."); return(null); }
public override void MatchReviewAndProductSubstring(DistinctReviewList <Review> reviewList, Dictionary <string, bool> stopWords, ref ReviewProductLinks reviewProductLinks) {//linking method which uses the title.contains(productToken) way for linking List <string> productTokens = SplitStringToTokens(Model.ToLower() + " " + GraphicsProcessor.ToLower() + " " + Manufacturer.ToLower()); productTokens = RemoveRestrictedTokens(productTokens, stopWords); List <Review> matchingReviews = new List <Review>(); foreach (int searchNumber in prunNumbers) { if (reviewList.prunGroups.ContainsKey(searchNumber)) { matchingReviews.AddRange(reviewList.prunGroups[searchNumber]); } } foreach (var review in matchingReviews) { List <string> reviewTitleWithoutStopWordTokens = RemoveRestrictedTokens(SplitStringToTokens(review.Title.ToLower()), stopWords); string reviewTitleWithoutStopWords = ""; foreach (var token in reviewTitleWithoutStopWordTokens) { reviewTitleWithoutStopWords += token; } if (MatchReviewTitleWithProductStringsSubstring(reviewTitleWithoutStopWords, productTokens)) { reviewMatches.Add(review); //add review to list of reviews that link to this product review.linkedProducts.Add(this); //add this GPU product to review list of products it links to if (!reviewProductLinks.productList.Contains(this)) { reviewProductLinks.productList.Add(this); } if (!reviewProductLinks.reviewList.Contains(review)) { reviewProductLinks.reviewList.Add(review); } } } }
private void OpenFileDialog1_FileOk(object sender, CancelEventArgs e) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read, FileShare.None); Items = (List <ITransformable>)formatter.Deserialize(stream); foreach (ITransformable item in this.Items) { if (item.GetType().Name == "GroupOfItems") { this.groupOfItems = (GroupOfItems)item; } } stream.Close(); ToggleSelection = 1; SelectedItem = null; graphicsProcessor = new GraphicsProcessor(HelpSelectedItem); saveFileDialog1.FileName = openFileDialog1.FileName; this.CustomRefresh(); }
// ---------------------------------------------------------------------------------------------------- // Constructor method public MainWindow() { InitializeComponent(); mainWindowTabs.DrawItem += new DrawItemEventHandler(mainWindowTabs_DrawItem); Manager = new DataSetManager(); GraphicsManager = new GraphicsProcessor(Manager); DecisionTree = new DecisionTree(Manager.Data, "price_range"); LibraryDecisionTree = new LibraryDecisionTree(); chartsControl1.Initialize(GraphicsManager); dataViewerControl.Initialize(Manager, chartsControl1); decisionTreeControl.Initialize(DecisionTree, LibraryDecisionTree, predictControl); predictControl.Initialize(DecisionTree, LibraryDecisionTree); }
public override void MatchReviewAndProductTokens(DistinctReviewList <Review> reviewList, Dictionary <string, bool> stopWords, ref ReviewProductLinks reviewProductLinks) { string productStrings = Model.ToLower() + " " + GraphicsProcessor.ToLower() + " " + Manufacturer.ToLower(); List <string> productTokens = RemoveRestrictedTokens(SplitStringToTokens(productStrings), stopWords); List <Review> matchingReviews = new List <Review>(); foreach (int searchNumber in prunNumbers) { if (reviewList.prunGroups.ContainsKey(searchNumber)) { matchingReviews.AddRange(reviewList.prunGroups[searchNumber]); } } foreach (var review in matchingReviews.Distinct()) { { if (CompareReviewTitleWithProductStringsToken(review.Title.ToLower(), productTokens, stopWords)) { //add review id to product reviewMatches.Add(review); review.linkedProducts.Add(this); if (!reviewProductLinks.productList.Contains(this)) { reviewProductLinks.productList.Add(this); } if (!reviewProductLinks.reviewList.Contains(review)) { reviewProductLinks.reviewList.Add(review); } } } } }
public RenderTarget(GraphicsProcessor gpu, int width, int height) : base(gpu, width, height) { _gpu = gpu; _rtID = gpu.CreateRenderTarget(this.Id); }
protected virtual void OnLoad(GraphicsProcessor gpu) { }
public void Load(GraphicsProcessor gpu) { OnLoad(gpu); }
// ---------------------------------------------------------------------------------------------------- // Initialize method public void Initialize(GraphicsProcessor manager) { this.graphicsManager = manager; UpdateCharts(); }
public override void Draw(SpriteBatch spriteBatch) { GraphicsProcessor.Draw(spriteBatch); }
public EffectParameterList(GraphicsProcessor gpu, Effect.EffectProgram program) { _gpu = gpu ?? throw new ArgumentNullException(nameof(gpu)); _program = program ?? throw new ArgumentNullException(nameof(program)); }
public FontTextureManager(GraphicsProcessor gpu) { _gpu = gpu ?? throw new ArgumentNullException(nameof(gpu)); }
public GlTextureCollection(GraphicsProcessor gpu, GL gl) : base(gpu) { _textures = new Thundershock.Core.Rendering.Texture[32]; _gl = gl; }
public RenderTarget2D(GraphicsProcessor gpu, int width, int height) : base(gpu, width, height) { }
public override void SetTextures(Texture2D onTexture, Texture2D offTexture) { GraphicsProcessor.SetTextures(onTexture, offTexture); }