xna-4.0

Compiling f# for xbox360

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 19:11:53
问题 I've been trying to compile some libraries I've written in f# to work in a game I'm writing for the xbox360, except I keep getting an error saying "The module/namespace 'System.Net.WebRequest' from compilation unit 'System' did not contain the namespace, module or type 'WebRequest' . The command I've been using to compile it is "C:\Program Files (x86)\Microsoft F#\v4.0\fsc.exe" -o:obj\Release\XBox360.dll --standalone --noframework --define:TRACE --optimize+ --tailcalls+ -r:"C:\Program Files

Windows Phone custom shaders error?

自闭症网瘾萝莉.ら 提交于 2019-12-10 18:58:28
问题 In Windows Phone XNA 4.0, I am receiving the following error when compiling: the windows phone platform does not support custom shaders . This is really annoying, because I have an Xbox 360 version of the project, and a Windows version of the project as well. I tried using the compilation based #if !WINDOWS_PHONE and #endif , but with no luck. It seems as if it ignores this. How can I make this file be excluded or ignored when compiled in the Windows Phone project? 回答1: As a workaround, you

Redraw unchanging background on every Draw?

梦想的初衷 提交于 2019-12-10 18:08:16
问题 This might be a very simple question, but I searched and found no other way to do it. It doesn't make sense to redraw the background on every Draw. Is there a way to draw some things and leave them on the screen? I've tried to comment-out the GraphicsDevice.Clear(Color.CornflowerBlue); But that doesn't help. (What is its purpose?) 回答1: The dark purple colour you are seeing is used by XNA and DirectX to indicate an uninitialised buffer. XNA will also clear buffers to this colour to emulate the

The dream to inherit from a struct in c#

房东的猫 提交于 2019-12-10 13:25:58
问题 There I am making a 2D game in C# XNA 4.0, and run across yet again a petty annoyance of mine; the Rectangle . For those using basic collision, this is almost a necessity. For almost any game object created you need to have a rectangle. Then I go to change the X, check collision, or anything else. And there I begin the never-ending battle of objectName.Rectangle.Whatever . To get around this I of course give the class of objectName properties/methods that access these for me. Then I dared to

How to make an object “scalable” while rendered in a form

只谈情不闲聊 提交于 2019-12-10 12:48:04
问题 I am rendering my game in a Winform in the same way as done in this sample: WinForms Series 1: Graphics Device In my game I have some object, for example a rectangle that I can already put and move, in my game world, once created. My project here is a level-editor. What I want to do is to make every object "sizable" or "scalable" (sorry if this isn't the correct word) in the same way as done in every software we commonly use, I mean: I have a class like: public abstract class GameObject {

c# overriding enum

99封情书 提交于 2019-12-10 11:49:23
问题 I know that maybe this question has been asked before, but I can't seem to find a proper solution (having in mind that I am not a C# expert but a medium level user)... I prepared a base class including an enum (AnimationStates) for animation states that my screen objects might have (for example a Soldier might have different states whereas a bird could have another set of states..) .. The base class is serving the purpose of storing update methods and other things for my animated screen

XNA - Mouse.Left Button gets executed more than once in Update

对着背影说爱祢 提交于 2019-12-09 16:43:22
问题 I am making a Tic-Tac-Toe game. I need to check if a player is clicking on a square they have already clicked. Problem is error is shown in the first click itself. My update code is: MouseState mouse = Mouse.GetState(); int x, y; int go = 0; if (mouse.LeftButton == ButtonState.Pressed) { showerror = 0; gamestate = 1; x = mouse.X; y = mouse.Y; int getx = x / squaresize; int gety = y / squaresize; for (int i = 0; i < 3; i++) { if (go == 1) { break; } for (int j = 0; j < 3; j++) { if (getx == i

Making sure my XNA game has focus before handling mouse and keyboard events

穿精又带淫゛_ 提交于 2019-12-08 15:20:45
问题 I'm developing a game that is mixed with winforms (for the map editor). The problem I am facing is that even if the main game window isn't in focus, it still receives mouse change events (such as clicking and moving the mouse). Is there a way to make sure my application is in focus before continuing on to handle these events are is there some kind of built in method? Thanks! 回答1: Use the Game.IsActive property to check if you should deal with mouse and keyboard input. 回答2: If you add a

Farseer Meter/Pixel Ratio

心不动则不痛 提交于 2019-12-08 10:26:47
问题 I've done a lot with box2d in c++, and am giving C# a try. It looks like Farseer is generally used in place of Box2D (I'm aware of Box2DXNA, but it seems a little outdated.) So, Farseer is what I've been using. When I was using C++ and Box2D, everyone always advised against using a 1pixel/meter ratio (For what reason, I don't know,) and usually suggested using somewhere around 30pixels/meter. As I've been researching Farseer, I've seen a lot of conflicting statements. Some say to use 1pixel

XNA game components

一笑奈何 提交于 2019-12-08 02:25:33
问题 I an confused about how to pass values of variables from 1 gamecomponent to another. I am using xna 4.0. I created two gamecomponents, the drawstring and the inputmanager. I want to read the keyboard input of the user and pass it onto drawstring where it will update the position. I cant add components on drawstring(drawablegamecomponent). I can do it on class but not on gamecomponent. Can you guys post some examples here. For beginners. 回答1: Use GameComponent for something that you would want