Results 1 to 6 of 6

Thread: [2005] DirectX Questions

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Lightbulb [2005] DirectX Questions

    Answer 1, 2, none, or whatever! Any input is loved!

    1) Be it VB .Net or C#, I am using C#, when I use a TextureLoader to create a texture, the Texture is compressed and looks horrible, and sometimes the file even changes size. Looks like a horribly compressed JPEG.

    However, if I create a Bitmap object, load the file into it, and create a Texture from the Bitmap object, it looks perfectly fine. However, this makes me create a BMP variable. Is there a way to keep using TextureLoader but keep the Bitmap looking normal?

    2) I know that when I am drawing a Sprite, I can draw only a portion of the Texture using a Rectangle object, but how can I have it so that I can CREATE a Texture object from only a portion of a Bitmap? Code example please

    3) Do I really need a Sprite object for everything? It seems all they are is an object that relates to the Device, not texture or anything. Could I just have a global Sprite variable and keep constanly Starting and Ending it? Why have a Sprite variable for every single Texture and Bitmap in your game? Because when you do that, it eventually ends up like this:

    Code:
                sprBullet = new Sprite(device);
                sprLives = new Sprite(device);
                sprEnemy01 = new Sprite(device);
                sprProjBomb = new Sprite(device);
                sprBomb = new Sprite(device);
                sprExplosion = new Sprite(device);
    4) When playing a Sound with a SecondaryBuffer with DirectSound like this:

    Code:
                DirectSound.Device soundDevice = new DirectSound.Device();
                soundDevice.SetCooperativeLevel(this, DirectSound.CooperativeLevel.Normal);
                soundLaser = new DirectSound.SecondaryBuffer("laserfire.wav", soundDevice);
    soundLaser.Play(0, DirectSound.BufferPlayFlags.Default);
    I play the sound in the MouseClick EventHandler, but when I click really fast, sometimes it skips. Is there any way to play the Sound from the beginning right when I click? If I click to fast it plays the sound, waits till it's done, and then you can play a new sound. I would prefer if it played again when I clicked whether or not the previously played sound is complete or not.

    5) There are Sprite Maps, and Texture maps, but are there also Sound Maps? Like have one SecondaryBuffer and one WAV with lots of sounds in it, and play parts of the file to parts of the file. Probably not probable or plausible or even ethical but it's worth knowing.

    6) Controls? I'm still looking on how to draw Textboxes and Buttons onto the screen in Full Screen Mode. I need to have Textboxes and a Button for my login screen for a game I am making with DX but I need to know how to draw controls onto the screen neatly.

    7) Is there an easier way to check if an event has occured rather than, in the Render Function, use a foreach with the Bullets Class and the Enemies class and see if they have collided or not? Checking every single time possible doesn't seem too speed-efficient. I know I should use properties, but there are two classes that are colliding? I know I should put some sort of if statement in the set statement of the X and Y property in Bullets and Enemies, but how can I link them? Is it even possible?

    8) Is there any other way to make a Texture transparent besides making a Bitmap Object, and passing the bitmap directory as a parameter, then calling the bitmap object and using the MakeTransparent property of the bitmap, and THEN create a texture out of that bitmap? It would probably be easier if I could use some sort of TextureLoader to load the bitmap automatically into the Texture and making it transparent with the color black or purple or whatever color the background color of the image is.


    Thanks for any help. Answer any of them you want, or answer none at all! Thanks for any future help, though!


  2. #2
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Re: [2005] DirectX Questions

    6) As far as i know you can't overlay windows controls on a DX surface. You've either got to remake the controls within your DX code (a lot of work) or make your logonscreen display before you start DX (or maybe in a seperate window, that appears above the one DX is rendered on).

    7) You could use C#'s delegates/events in order to link actions (e.g. an enemy beind killed) to an event (bullet hitting him) but you've still got to check for a hit somewhere (maybe in the bullet's 'think'/movement code). You'd then trigger the enemy's 'Ive Been Killed' code.

    8) TGA files save alpha levels, and i think the texture loader uses these. So you could have parts transparent, as well as partially so if you want. Just find a BMP -> TGA converter on the web and you're set.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2005] DirectX Questions

    OK thanks for the reply.

    6) I need a textbox and buttons in the game itself as well so I think that option is out >_>

    7) Do you still have to check every single time they move? If so, doesn't help much

    8) How can I set parts of the bitmap transparent so when I convert it to a TGA, it knows which part is transparent?

  4. #4
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Re: [2005] DirectX Questions

    6) Then you've got a lot of work ahead. Not sure if there are any good resources on creating a GUI within DX in C#, have seen a few C++ ones.

    7) Yes, otherwise the user may see a delay from the bullet hitting the object to it being killed.

    8) You'd have to look for a program that allowed you to either set transparent pixels once the BMP was read in, or automatically set a particular colour on the BMP to be transparent once converted to the TGA.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2005] DirectX Questions

    Got any advice/links for number 6? Also, for number 8, can you reccomend any?

    As for the others, anyone know?

  6. #6
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Re: [2005] DirectX Questions

    6) Here's a good article on creating a GUI in DirectX using C++
    http://www.gamedev.net/reference/pro.../features/gui/

    8) Never needed to convert a bmp to tga so can't recommend. a quick google should turn up some good results i guess.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width