Questions tagged [windows-forms]
Windows Forms is a graphical API of Microsoft .NET Framework, a wrapper providing access to native Microsoft Windows interface elements.
58 questions
17
votes
3
answers
6k
views
Game loop isn't performing well enough, so my frame rate is too low (Windows Form + GDI+)
I decided to learn about building games, so I picked up C# to use it along with Windows Form - I already have C# experience, so that was the main reason I did so. That said, I tasked myself to build a ...
0
votes
1
answer
194
views
0
votes
0
answers
782
views
Playing Video Files in Windows Forms with MediaPlayer
With the following encoding, only the audio part of the video is played, but the video itself is not shown:
...
1
vote
0
answers
180
views
How to implement texture slicing
I'm making a simple game in C# and i'm trying to slice my UI images into 9 smaller rectangles, so the image doesn't get stretched when drawing to different resolutions, but i'm having lots of problems ...
0
votes
2
answers
587
views
Rectangle collision not working!
I'm making a simple game in C# and i'm having some problems with rectangle collisions.
What i'm doing is checking if two rectangles intersects, checking the side of collision and then moving the ...
0
votes
1
answer
174
views
Move two sprites together with offset?
I'm making a simple game in C# for practice and i'm having some problems when dragging a sprite
and making another sprite follow it.
What i'm trying to achieve:
When dragging a sprite, i want ...
0
votes
1
answer
713
views
How to keep objects in the same position relative to their parent?
I'm writing a simple game in C# and i'm having some difficulty to calculate the local position of a sprite.
What i'm aiming to achieve:
Calculate the sprite "local position" relative to the ...
0
votes
1
answer
1k
views
Window handle is invalid
I'm trying to implement an input listener for FNA (modern version of XNA). Since FNA does not supply any sort of way to listen to native input this has to be done through the windows API and native ...
1
vote
1
answer
264
views
How to properly manage game music and sounds?
I'm developing a WinForms customized version of Pac-Man for a Software Engineering project and I reached the point where I have to implement music and sound effects. I used the MVC architectural ...
0
votes
0
answers
168
views
Getting a control name/Displaying tooltip text
I am developing a character creator using Windows Forms (because apparently I can't create menus in Unity), and I want to display some tips and descriptions in a ...
1
vote
1
answer
883
views
Monogame sprite rotation issue
I'm having interesting problem with rotating a sprite in MonoGame. Here is how origin, destination rectangle and scale are created:
...
0
votes
1
answer
2k
views
Multiple glControl on same winform is not working - OpenTK C#
I have to show frames from two cameras in two openGl control separately at same time. For that I have put two opengl control in my form and pass those frames to opengl accordingly. But when running ...
0
votes
2
answers
226
views
How do I hide the bug image once it's hit by a bullet?
I have almost solved my problem. I am able to shoot a bullet and hit a bug and it then draws a collision bitmap. but then it redraws a bug, I want to clear the bug bitmap after the collision happens.
...
1
vote
2
answers
251
views
How do I replace the enemy with a different graphic when it gets hit?
I am able to draw my space ship and a an enemy (called "bug_one" in the code below) and move my bullet. When the bullet hits the enemy, it draws a collision bmp.
But currently my code draws both the ...
1
vote
1
answer
504
views
Bitmap drawn with Graphics.DrawImage flickers
I am working on a space invaders clone using bugs as aliens. Everything works ok but the bug bitmap flickers on the screen.
...
0
votes
4
answers
523
views
How do I move the paddle with the arrow keys?
I am making a pong game using gdi+ and c#. I want to move the paddle using the arrow keys by using the move variable, but it does not work; the paddle does move when I use the int move=0; global ...
1
vote
0
answers
60
views
MonoGame minimises when I click on second game window
I've problem with my MonoGame project. I have one full-screen game window and one window form with some info (part of the game too). And the problem lies in when I click on the window form, the main ...
1
vote
1
answer
1k
views
System.Windows.Form.Control.FromHandle returns null for current window
I was following the book "XNA 4.0 Game Development By Example" and in the eighth chapter, the author adds windows form to an XNA game. I was following the book for a MonoGame project, but I get null ...
0
votes
1
answer
1k
views
Windows Forms game loop
There is a very good game loop in the link which is tailored for windows forms. I need it in c++/cli so I converted the code as below. Here is my main loop.
...
1
vote
0
answers
332
views
Monogame intermediateSerializer with winforms
I want my xml files to be game ready on save in my winforms. Right now I am trying to serialize a simple object like this and it is accessing the XML file, but not outputting anything. Am I missing ...
2
votes
1
answer
2k
views
Monitor external window events with SDL2
I'm trying to render my game (SDL2, C++) in a Windows Form application (C#) using C++/CLI to interface with my underlying C++ code. The purpose of the form is to create an editor which can monitor/...
0
votes
1
answer
321
views
Stuck the ball in the board (pingpong game)
this game isn't completed yet, i've created the part where the ball hits the board, but there's problem in playing and that's the ball stucking in the board. For a better comprehension and ...
2
votes
3
answers
448
views
In XNA, how do I get forms to display in front of my full-screen game?
I'm trying to open a form in front of my game, which is full-screen. However, the form seems to appear only behind the game window.
At the moment, I'm doing this:
...
1
vote
1
answer
94
views
Strange anomalies when using WinForms with XNA
I haven't seen any questions related to my issue, and this leads me to believe I'm missing something minor, however;
The Problem
I'm creating a game that is effectively launched from a windows form. ...
2
votes
3
answers
2k
views
Arrow key control on winforms RichTextBox
I am making a faux console using winforms for the game I am working on. Right now I am moving a '0' across the screen using the arrow keys.
In order to provide fine grain formatting on the text, I ...
1
vote
0
answers
153
views
Custom Keyboard run by Arduino not working in XNA
I'm trying to make a stenotype-teaching game using the stenoboard as input. The Stenoboard emulates an NKRO keyboard, using this code: https://github.com/caru/StenoFW/blob/master/StenoFW.ino, with an ...
0
votes
1
answer
1k
views
How can I load another form containing a new level when my player reaches the current level's exit?
I am coding a very basic side-scrolling game in C#, using Windows Forms.
I want to connect my game's levels with 'exit points'. When the player touches an exit point, a new form should be loaded ...
0
votes
1
answer
402
views
XNA/Winforms - Nothing being drawn after calling SetRenderTarget(null)
I'm creating a basic scene/level editor using XNA/Winforms using the base classes from http://xbox.create.msdn.com/en-US/education/catalog/sample/winforms_series_1
Everything works fine and gets drawn ...
1
vote
2
answers
769
views
How to show my XNA game in form C#
I have a game in XNA, I want to connect this game with WindowForm to show for example the distance and the position.
I tried to apply many tutorials that talking about this.
but here is my problem :
...
0
votes
1
answer
712
views
How do I handle window resizing in SlimDX?
I'm considering the use of SlimDX in a managed Windows Forms Application. Available with DirectX is DXUT. I use DXUT to handle events such as window resizing and 'lost devices.'
How well does SlimDX ...
41
votes
3
answers
35k
views
What is the standard C# / Windows Forms game loop?
When writing a game in C# that uses plain-old Windows Forms and some graphics API wrapper like SlimDX or OpenTK, how should the main game loop be structured?
A canonical Windows Forms application has ...
0
votes
1
answer
381
views
How to call game Update from another form
I have three projects in one solution:
a form with some tool (see it as a level-editor), in which there is PictureBox where I want to redirect drawing of the game.
My game, with some methods and its ...
1
vote
1
answer
483
views
Write my own level editor, questions [closed]
I just finished to code the most important parts of my game engine (not a tile-map one), such as lights, shadows, objects update/draw, input, ecc. Now I'm making a level editor to simplify the ...
1
vote
2
answers
381
views
Spritebatch not working in winforms
I'm using the Winforms sample on the app hub and everything is working fine except my spritebatch won't draw anything unless I call Invalidate in the Draw method. I have this in my initialize method:
...
0
votes
0
answers
73
views
Invalidate not working (winforms & xna) [duplicate]
I'm using winforms with xna.
Everything's working so far except for the drawing because invalidate won't refresh the screen unless repeated. This is the initial code I had:
...
1
vote
1
answer
153
views
How can I show xna graphics content in a control on a form in xna?
I was able to create a form in xna using "Add Windows Form", named "Form1" then adding:
...
0
votes
1
answer
2k
views
Problems when randomizing x and y position of a picturebox [closed]
So, I'm making a simple game. It's like snake but the picturebox doesn't grow. In the game, you have to get fruits and other objects.
Look at berry's code:
...
1
vote
2
answers
3k
views
Winform + XNA (Microsoft Example) - Issues with Drawing Texture2D
Before I get started I would just like to say that I have been using the Microsoft Winform + Xna examples found here:
WinForms Series 1: Graphics Device
I think I somewhat understand how its working ...
0
votes
1
answer
1k
views
Client Server Multiplayer Project
I have reviewed the relevant WinForms/XNA samples here and here.
However, my requirements are slightly different.
Given the following:
I am developing a multiplayer (Client - Server) game
There will ...
1
vote
2
answers
322
views
2D tilemap editor UI--how do I disable editing while save/load dialog is open?
I'm working on a basic 2D tilemap editor in C#/XNA. Currently, it displays the map through a picturebox through which XNA's output is being routed, and editing is accomplished through simply checking ...
1
vote
2
answers
431
views
Set vertex position
Can anyone tell me how to set the positions of model vertices? I want to be able to change the position of some of the vertices of a Model. Is there any way to make that happen? And make the changed ...
1
vote
2
answers
277
views
Point[] and Tri not "could not be found"
Hi I'm trying to learn how to load a .obj file using OpenTK in windows Forms. I have seen a lot of examples out there, but I do see almost everyone uses ...
6
votes
1
answer
1k
views
Does using [STAThread] with XNA have any negative implications?
I'm working on a game in XNA, which has an inbuilt level editor. To facilitate this I want use the FileOpenDialog from Winforms. I followed the instructions as per ...
2
votes
2
answers
266
views
Re-sizing the form without scaling the GUI
I am writing a turn based strategy game in C#. My GUI implementation consists of class that extends Form containing a class that extends Panel. When I render the GUI I draw to the paint method in ...
3
votes
1
answer
8k
views
XNA + Windows Forms: How make them work together without making the trick of the custom GraphicsDeviceControl?
What I've found is a solution where you have to code a custom GraphicsDeviceControl to put inside the form (the well known tutorial from the APPHub), but that's not what I'm searching for.
I would ...
0
votes
2
answers
2k
views
How can I guarantee a solvable Fifteen Puzzle shuffle?
I am making a 15 Puzzle game in C# that allows the user to enter a custom row and column value up to a maximum of a 10 x 10 puzzle. I am having problems with the shuffle method.
I want to make it so ...
0
votes
2
answers
224
views
MenuStrip in XNA 4.0
Is it possible to place a MenuStrip into a XNA 4.0 project. This project is intended for PC-s only and I already have openFile dialogs, but I cant get the MenuStrip drawn. If this is not possible what ...
1
vote
3
answers
2k
views
interaction with WinForm and Xna
Okay, this is may be very simple.
I embedded my XNA project in WinForms through "this tutorial" and it works fine even with XNA 4. Now I have a 3D CoilSpring object and the number of loops for this ...
6
votes
4
answers
2k
views
Game Editor - When screen is clicked, how do you identify which object that is clicked?
I'm trying to create a Game Editor, currently just placing different types of Shapes and such. I'm doing this in Windows Forms while drawing the 3D with XNA. So, if I have a couple of Shapes on the ...
1
vote
1
answer
284
views
Present fails randomly on mixed C++ Direct3D9 app
I have a mixed .NET application (managed and unmanaged code bridged by C++/CLI wrappers) which uses unmanaged Direct3D9 9.0c to do rendering inside a control which is wrapped inside a C++/CLI class ...