Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Thrash505

@Thrash505
About
Posts
11
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Disable the Maximize button in WPF
    T Thrash505

    I haven't written a post on my blog on disabling both the minimize and maximize button on a WPF window through attached properties in XAML-markup. In the future I will implement disabling the icon as well. For disabling the close button, I see no need for this and believe this to be bad design; therefore it will be unlikely that I will ever implement this functionality unless specifically requested. http://thrash505.wordpress.com/2010/04/19/wpf-window-disable-minimize-and-maximize-buttons-through-attached-properties-from-xaml/

    WPF csharp wpf tutorial

  • Working with 2D in DirectX using C# (Newest version as of 07/22/2008) ???
    T Thrash505

    I've finally figured out why my code wasn't working... I had to set the view transform and turn off lighting. Then I had to put in the BeginScene(), EndScene(), and Present() calls when rendering. Here's the new version of the GameForm.cs file:

    // *************************************************************************************************
    // ***** Project: 2D DirectX9 Test
    // ***** Author: Thrash505
    // ***** Created: 07/24/2008
    // *************************************************************************************************

    // *************************************************************************************************
    // ***** Using Directives
    // *************************************************************************************************
    #region Using Directives
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using Microsoft.DirectX;
    using Microsoft.DirectX.Direct3D;
    #endregion

    namespace _2D_DirectX9_Test {
    // *********************************************************************************************
    // ***** GameForm Class
    // *********************************************************************************************
    #region GameForm Class
    public partial class GameForm : Form {
    // *****************************************************************************************
    // GameForm - Attributes
    // *****************************************************************************************
    #region GameForm - Attributes
    private Device _graphicsDevice;
    private Sprite _spriteManager;
    private GraphicsSprite gs;
    #endregion

        // \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
        // GameForm - Properties
        // \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
        #region GameForm - Properties
        private Device GraphicsDevice {
            get { return \_graphicsDevice; }
            set { \_graphicsDevice = value; }
        }
        private int ScreenWidth {
            get { return 1024; }
        }
        private int ScreenHeight {
            get { return 768; }
        }
        public Sprite SpriteManager {
            get { return \_spriteManager; }
            set { \_spriteManager = value; }
        }
        #endregion
    
        // \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
    
    Graphics tutorial algorithms csharp c++ graphics

  • Working with 2D in DirectX using C# (Newest version as of 07/22/2008) ???
    T Thrash505

    I still need help on this topic, but to make it easier for someone to help me I put together a project myself. However, it should be working, but its not; The image never shows up on the form. Here's the link to the project files: http://www.freewebs.com/thrash505/2D\_DirectX9\_Test.zip Program.cs

    // *************************************************************************************************
    // ***** Project: 2D DirectX9 Test
    // ***** Author: Thrash505
    // ***** Created: 07/24/2008
    // *************************************************************************************************

    // *************************************************************************************************
    // ***** Using Directives
    // *************************************************************************************************
    #region Using Directives
    using System;
    using System.Windows.Forms;
    #endregion

    namespace _2D_DirectX9_Test {
    // *********************************************************************************************
    // ***** Program Class
    // *********************************************************************************************
    #region Program Class
    public static class Program {
    /// /// The main entry point for the application.
    ///
    [STAThread]
    public static void Main( ) {
    GameForm gameForm = new GameForm( );
    gameForm.Show( );
    while( gameForm.Created ) {
    gameForm.RenderGraphics( );
    Application.DoEvents( );
    }
    }
    }
    #endregion
    }

    GameForm.cs

    // *************************************************************************************************
    // ***** Project: 2D DirectX9 Test
    // ***** Author: Thrash505
    // ***** Created: 07/24/2008
    // *************************************************************************************************

    // *************************************************************************************************
    // ***** Using Directives
    // *************************************************************************************************
    #region Using Directives
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using Microsoft.DirectX;
    using Microsoft.DirectX.Direct3D;
    #endregion

    namespace _2D_DirectX9_Test {
    // ********************************

    Graphics tutorial algorithms csharp c++ graphics

  • Working with 2D in DirectX using C# (Newest version as of 07/22/2008) ???
    T Thrash505

    Okay, here it goes... [My rant] I've been searching for weeks now on how to work with 2D images in DirectX using C#. However, I've been completely unsuccessful in doing so. The help files that come with DirectX are horrible because they are organized by classes and such. Meaning that a person like me who has never worked with DirectX before, will be completely lost. The help files should take you through DirectX in order of complexity, showing you the simplest things first, but they don't. They are more like a reference guide. But, anyways they are no help to DirectX newbies like me. I've looked around on the internet a lot trying to get some information on this topic and then attempting to piece it together. However, I've been completely unsuccessful. 90% of all examples are using out-dated versions of DirectX, meaning they are irrelevant to me. The other 10% are either in C++, which I do not understand. I've seen some rare occurrences of 2D DirectX projects in C#, but they are using older versions of C#, which didn't fully support DirectX and were workarounds (so they've said). When I try to convert them to the newest version of a C# solution they fail to compile. There is a sample that comes with DirectX that supposed to show you how to perform "Simple 2D". However, it actually not very simple and is a rather large project in my world. But, the killer is that it also fails to run on my computer, most likely because they are trying to use some advanced feature when its supposed to be "Simple 2D". I'm pretty sure my computer is capable of displaying some 2D images and then move them around a little. [/My rant] So that's enough of my complaining, I just wanted anyone who reads this thread to know that I did try to figure this out on my own before coming here. Basically what I'm asking for is for someone to either explain to me very simply how to get a basic 2D C# project using DirectX up and running or create one for me so I can pick it apart and try to figure out what's going on. I only want the simplest example. Like displaying some 2D images and maybe moving them around or rotating them. Nothing fancy. Many thanks in advance to anyone who can help me out. :)

    Graphics tutorial algorithms csharp c++ graphics

  • Wrap values with upper and lower bound? [modified]
    T Thrash505

    Nice, it works :) The function:

    private int WrapValue( int val, int lowerBound, int upperBound ) {
    int result = lowerBound + ( val - lowerBound ) % ( upperBound - lowerBound );
    if( result < lowerBound ) {
    result += ( upperBound - lowerBound );
    }
    return result;
    }

    I tried it with all different bounds and values and it works great. Thanks a ton :)

    Algorithms csharp help tutorial question

  • Wrap values with upper and lower bound? [modified]
    T Thrash505

    So I could check to see whether originalValue is negative or not and if it is I do what?

    Algorithms csharp help tutorial question

  • Wrap values with upper and lower bound? [modified]
    T Thrash505

    Well it's closer... Using this function:

    private int WrapValue( int val, int lowerBound, int upperBound ) {
    return lowerBound + ( val - lowerBound ) % ( upperBound - lowerBound );
    }

    WrapValue( 1023, 0, 360 ) gives me 303. But WrapValue( -5, 0, 360 ) gives me -5, but it shouldn't it give me 355?

    Algorithms csharp help tutorial question

  • Wrap values with upper and lower bound? [modified]
    T Thrash505

    hmmm... When I try this function:

    private int WrapValue( int val, int lowerBound, int upperBound ) {
    return val - ( val - lowerBound ) % ( upperBound - lowerBound );
    }

    with: WrapValue( 1023, 0, 360 ) I get 720 as a result. when I try this function:

    private int WrapValue( int val, int lowerBound, int upperBound ) {
    return val - ( val - lowerBound ) / ( upperBound - lowerBound );
    }

    with: WrapValue( 1023, 0, 360 ) I get 1021 as a result. But, shouldn't I be getting 303 still? I haven't tried with negatives or a different lower bound yet.

    Algorithms csharp help tutorial question

  • Wrap values with upper and lower bound? [modified]
    T Thrash505

    I've created a wrapvalue function in C#, but I can't figure out how to make it work with a lower bound, like a negative. Here's the function at the moment:

    private int WrapValue( int val, int upperBound ) {
    return val - ( upperBound * ( val / upperBound ) );
    }

    WrapValue( 1023, 360 ) would return 303. By the way ( val / upperBound ) is integer division. It works great for positive values, but not negatives and you can't specify a lower bound. Does anyone know how I to make it work with negatives and a lower bound so I could do something like this: WrapValue( int val, int lowerBound, int upperBound ) WrapValue( -300, -500, 123 ) Thanks in advance. By the way I'm using this to scroll a semi-transparent image over another image in the shape of a circle to create the illusion of a rotating sphere. The semi-transparent image needs to wrap around in a certain way and this function will help me accomplish that if I can get working correctly.

    modified on Sunday, July 20, 2008 5:19 PM

    Algorithms csharp help tutorial question

  • Convert a value in one number range to a value in another number range?
    T Thrash505

    Nice, it works. So 10000 / 40 = 250... I knew it was something simple. Thanks a ton :)

    Algorithms csharp graphics game-dev help question

  • Convert a value in one number range to a value in another number range?
    T Thrash505

    I can't seem to figure this out... I have a value within the range of 0 to 40 and I want to be able to convert that into a value in the range of 0 to 10,000. This is for a simple music player that I have built into one of my programs. I'm using C# and DirectX.AudioVideoPlayback to play mp3 files. I have a working custom slider control that has a range from 0 to 40. This will be used to adjust the volume of an mp3. The problem is that volume in DirectX.AudioVideoPlayback ranges from 0 to 10,000 (technically -10,000 to 0... 0 being max volume). Therefore I need to figure out a formula to convert a value from my custom slider control that is in the range 0 to 40, to a value DirectX.AudioVideoPlayback can use which is in the range of 0 to 10,000. Also these values are integers and the conversion doesn't have to be exact, just close enough. I'm bad at math, so any ideas?

    Algorithms csharp graphics game-dev help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups