コード例 #1
0
        private void btnAddObject_Click(object sender, EventArgs e)
        {
            OpenGlObject objectToAdd = null;

            if (txtBxLeftRightPosition.Text != "")
            {
                float xMin = ((float.Parse(txtBxLeftRightPosition.Text)) - (float)(numericUpDownObjectWidth.Value / 2));
                float xMax = xMin + ((float)numericUpDownObjectWidth.Value);

                float yMin = (float)numericUpDownDistanceFromGround.Value;
                float yMax = yMin + (float)numericUpDownObjectHeight.Value;

                float zMin = -(float)this.customNumericUpDownPlaceObjectAt.Value;
                float zMax = zMin + (float)numericUpDownObjectDepth.Value;

                if (checkBoxUseTexture.Checked)
                {
                    objectToAdd = new Cube((int)numericUpDownImageNumber.Value, 1, 1, xMin, yMin, zMin, xMax, yMax, zMax);
                }
                else
                {
                    objectToAdd = new Cube(xMin, yMin, zMin, xMax, yMax, zMax);
                }

                m_objectsToDraw.Add(objectToAdd);


            }

        }
コード例 #2
0
        private void btnAddObject_Click(object sender, EventArgs e)
        {
            float xMin = ((float)Convert.ToDouble(txtBxLeftRightPosition.Text))-((float)numericUpDownCubeSize.Value/2);
            float xMax = xMin + ((float)numericUpDownCubeSize.Value);

            float yMin = (float)numericUpDownDistanceFromGround.Value;
            float yMax = yMin + (float)numericUpDownCubeSize.Value;

            float zMin = -(float)this.customNumericUpDownCurrentPosition.Value;
            float zMax = zMin + (float)numericUpDownCubeSize.Value;

            Cube objectToAdd = new Cube(4, 1, 1, xMin, yMin, zMin, xMax, yMax, zMax);

            SDL_Main.AddObjectToDrawList(objectToAdd);
        }