Hot answers tagged

7

First: // Create a Query to be able to wait for the completion of the drawing: D3D11_QUERY_DESC qd; ZeroMemory(&qd, sizeof(qd)); qd.Query = D3D11_QUERY_EVENT; hr = m_U->m_pd3dDevice->CreateQuery(&qd, &m_U->m_pEventQuery); if( FAILED( hr ) ) return hr; After the flush put the query in the queue (there is no call like begin in this ...


4

I think the proper way of syncronising the surfaces is using "Direct3D9Ex and DXGI Shared Surface Queue": More info: in the docs for the queue, in chapter Interoperability between Direct3D 9Ex and DXGI based APIs here Surface Sharing Between Windows Graphics APIs (Windows)


3

I would reiterate that neither WinForms nor WPF would be good, even for simple games. XNA is specifically made for this scenario. WinForms has an immediate graphics mode so you will have to refresh and repaint the window every "frame." The trouble is that GDI painting isn't great for performance and you have to play games with double buffering to prevent ...


2

Writing games with a WinForms or WPF UI is perfectly fine. There are thousands upon thousands of popular and enjoyable games that don't need or benefit from hardware support. Just think, if nothing else, of the classic Windows games Minesweeper, Solitaire, or Freecell. I could easily imagine those games being implemented today with Forms or WPF. In fact, ...


2

Seems like a bit of a loaded question. I would use neither as they are both for windows applications, not particularly good for writing games. Have you looked into the XNA framework? It uses c# which you seem to want to use, but is actually meant for writing games.


2

"I'm getting caught in collision detection and how to make a character jump and how to make a character walk up a slope or steps..." Why do you want to write it yourself? You could (if you want simple 2d graphics) use an existing framework for platformers and save a lot of time and energy. How to make characters walk up and down a slope or a stairway ...


2

Unity - not unlike some other game engines - provides as the backbone of its architecture a scene-graph that unifies all aspects of the MVC / MVVM triad. Trying to work around such fundaments of the platform will only cost you more in time than you think you might gain by adapting it to the architectural paradigm you mention... rest assured. Re your ...


2

I've spent a lot of time worrying about WPF performance and animations when writing the WPF Mind Mapping app NovaMind. On Stackoverflow I've written down some WPF animation best practices. Maybe those can help you. Regarding your question: I've experimented with DoubleAnimation and ThicknessAnimation both enable movement of the character, but the speed ...


1

I can't provide you with the code solution, but here's some formulas you might find useful to do it yourself: Calculate eyeball position: position = normalize(food_piece - head_center) * head_radius Vector normalization: unit_vector = vector / length(vector) be careful not to divide by zero here, so check length before performing division Vector length:...


1

If there is no roll in your FPS camera (typically, there is not in an FPS) then all you need to do to get a yaw angle (-π..π ) from the vector is the atan2() function. As suggested by DMGregory, the arcsin of the z component of the forward vector gives the tilt angle. #include <math.h> ... // calculate yaw const float yaw_angle = atan2f( cam_fwd.y, ...


1

Did you solve this? D3DImage only works with Direct3D 9Ex surface so it won't work with DXGI/Texture2D which are Direct3D 11... unless you arrange some very tricky DXGI surface sharing between 11 -> 9Ex in advance. I have all the numerous code fragments that prove this should be possible (i.e. accelerated Direct3D 11 video pipeline targeting WPF) but have ...


1

With WPF, the UI ( or render I guess ) thread is kind of special. It'll try and run every 60th of a second. All of your View->ViewModel bound property read/writes are sort of banked up and updated on the UI thread. So you can alter a property a ton of times on a background thread but it will be updated on the UI thread. Command bindings ( like a button click ...


1

Admittedly, this is an educated guess, so keep that in mind; WPF being the parent domain in this case means that all subprocesses like the XNA game are issued handles from that domain. I don't really know enough about the architecture behind WPF to adequately explain what it would be doing to cause the slowdown. However, as a possible fix, try automatically ...


1

I had to ask a friend that is good at 3D graphics this is what he did to make it right: ProjectionCamera camera = (ProjectionCamera) viewport.Camera; Vector3D ax1 = camera.LookDirection.Normalized(); Vector3D ax2 = Vector3D.CrossProduct(ax1, camera.UpDirection).Normalized() * -1; Vector3D ax3 = camera.UpDirection.Normalized(); Vector3D translation = (ax1*...


1

Since you're using WPF I expect you don't plan to use a lot of animation, so a better way to do this would be with a Grid: <!-- XAML --> <Grid x:Name="Board"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> <RowDefinition/> <RowDefinition/> ...


1

I am guessing you are using System.Draw methods to draw the rectangles (I hope you are not drawing labels or something cause that would kill performance). I would make a mouse down event on the form, and then use the mouse position value to get the rectangle that was clicked depending on the width/height of them. So say the user clicks at 250,250 and the ...


Only top voted, non community-wiki answers of a minimum length are eligible