I could find a set of java 2D game tutorials and android game tutorials which uses only native graphics libraries.
I'm looking for something similar in C# ( without DirectX or XNA)
I found this game loop skeleton , but it doesn't tell how to Render the Graphics.
Target is to simulate a simple Electronic device.
I need to show some graphical output as user "presses" some keys on the keyboard quickly.Hence it looks like an arcade game.
For example As the user presses one of the arrow keys a pointer(an image) will move accordingly.
I guess I can't do this with typical Windows Forms Application can I?
For example use a PictureBox
control and move it in KeyPress
event of the Form
.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
The native rendering framework for .NET winforms apps is GDI+. There are many tutorials online for drawing simple shapes/graphics using GDI+
If you want to make dynamic drawings, you can use the WPF Canvas for these purposes. It doesn't support gaming or such, but it is a simple way of drawing primitive forms and images as you would do in a website.
Here's a simple game using
WinForms
and aTimer
, usingGraphics
to draw (encapsulates GDI+).It adds a timer that 'ticks' every 10 milliseconds. Each tick it performs game logic, then draws to an off screen bitmap. This is as opposed to using a continual loop as in the example in the link.
The form handles key events separately (as opposed to doing something like
GetKeyState
)When the form is resized, and when it first loads it'll create the backbuffer bitmap of the right size.
Create a new form and replace all code with below. Control the ball using arrow keys. There's no notion of dying.