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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Capturing active 2d sprite

Capturing active 2d sprite

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsgame-devquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Oskars
    wrote on last edited by
    #1

    Hi! I am new in DirectX programming and have some difficulties with getting mouse position and active sprite on Device screen. Maybe I don`t understand completely principles of IDirectInputDevice8. I am creating some LPD3DXSPRITE and LPDIRECT3DTEXTURE9 on screen and using LPDIRECTINPUTDEVICE8 to capture mouse. But I can`t completely get texture or sprite under mouse. Is there some simple principles to get elements above mouse cursor? Maybe sample or something? :confused: :mad: :wtf:

    B 1 Reply Last reply
    0
    • O Oskars

      Hi! I am new in DirectX programming and have some difficulties with getting mouse position and active sprite on Device screen. Maybe I don`t understand completely principles of IDirectInputDevice8. I am creating some LPD3DXSPRITE and LPDIRECT3DTEXTURE9 on screen and using LPDIRECTINPUTDEVICE8 to capture mouse. But I can`t completely get texture or sprite under mouse. Is there some simple principles to get elements above mouse cursor? Maybe sample or something? :confused: :mad: :wtf:

      B Offline
      B Offline
      Bob Ciora
      wrote on last edited by
      #2

      Even though you're trying to capture a 2D sprite, you're using Direct3D, right? So in reality, you're trying to click on a section of a plane in 3D space. This presents additional computation, since you have to convert the mouse position on the screen into a Ray in 3D space. It's not as simple as the 2D case, I'm afraid :( It takes a bit of explanation, and I'm in the process of compiling an article on the subject, but there really isn't room to describe the process here. You may want to poke around the internet for some keywords like "3D hit testing" "ray picking" and the like. Bob Ciora

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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