Click here to Skip to main content
15,883,535 members
Articles / Multimedia / DirectX

Endogine sprite engine

Rate me:
Please Sign up or sign in to vote.
4.84/5 (53 votes)
17 Jul 200615 min read 715.2K   22.1K   216  
Sprite engine for D3D and GDI+ (with several game examples).
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Endogine.Editors.ColorEditors
{
    public partial class SwatchesForm : Form, Endogine.Editors.ISwatchesForm
    {
        public SwatchesForm()
        {
            InitializeComponent();

            this.SwatchesForm_Resize(null, null);
        }

        public SwatchesPanel Swatches
        {
            get { return this.swatchesPanel1; }
        }

        void SwatchesForm_Resize(object sender, System.EventArgs e)
        {
            this.panel1.Width = this.ClientSize.Width - this.panel1.Left;
            this.panel1.Height = this.ClientSize.Height - this.panel1.Top;// +(this.Height - this.ClientSize.Height);

            this.swatchesPanel1.SuspendLayout();
            this.swatchesPanel1.Width = this.ClientSize.Width - this.swatchesPanel1.Left;
            //this.swatchesPanel1.Height = this.Height - this.swatchesPanel1.Top + (this.Height - this.ClientSize.Height);

            if (this.swatchesPanel1.Height > this.panel1.Height)
            {
                this.swatchesPanel1.Width -= this.panel1.AutoScrollMinSize.Width + 20;
            }
            this.swatchesPanel1.ResumeLayout();
        }

        public void LoadPalette(string filename)
        {
            this.swatchesPanel1.LoadPalette(filename); //@"C:\Documents and Settings\Jonas\Desktop\Color Swatches\Windows.act"); //Web Spectrum.aco Web Spectrum.aco
        }
        private void loadReplaceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.DefaultExt = "aco";
            ofd.Filter = "Palettes (*.aco,*.act,*.txt,*pal)|*.aco;*.act;*.txt;*.pal|All files (*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.LoadPalette(ofd.FileName);
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Sweden Sweden
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions