- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 8
- Posts with Upvotes
- 7
- Upvoting Members
- 5
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
I am moving an object around from one node to another. I need to tell the object to stop moving when it has reached its destination node. I am currently using this algorithm for movement and node checking [CODE] if (!isFinished) { // If the level has arrived at the … |
|
I have two settings classes one abstract base class from which the second settings class derives public abstract class BaseFooSettings { public int a; public int b; public float c; } public class DerivedBarSettings : BaseFooSettings { public float d; } I then have two classes one base class and … |
|
I have two classes. One main Game class and an Entity class that needs to point to the Game class so it can call its various functions # Entity.h # class Game; class Entity { public: Entity(Game *game); ~Entity(void); void Draw(float dt); void Update(float dt); protected: Game *m_game; // Missing … |
|
Is it better to use structs over classes for serializing class settings? Class settings can have initial default values. [code] [Serializable] public class LevelSettings { // Default level values public int Depth = 3; public int Height = 3; public TileSettings[] TileSettings = new TileSettings[27]; public int[] TriangleIndices = new … |
|
Hi folks, I was wondering how I can differentiate between file types when using OpenFileDialog. I would like to be able to have the option to load different file types (as denoted by the Filter property) and handle each type in a different way. For example [CODE] Stream stream; OpenFileDialog … |
|
I've got a font as a sprite sheet with individual characters arranged in the exactly same way as a .ttf file. How can I get the index of the characters from a string so that I can know the index of the source rectangle to use to grab the correct … |
|
If I have a class which has a property that I wish to be serializable [CODE] public string Name { get { return name; } set { name = value; } // How can this be private and be used for XML serialization? } [/CODE] How can I prevent other … |
|
I have a Ref class [code] public class Ref<T> { private Func<T> getter; private Action<T> setter; /// <summary> /// For XML Serialization /// </summary> private Ref() { } public Ref(Func<T> getter, Action<T> setter) { this.getter = getter; this.setter = setter; } public Func<T> Getter { get { return getter; } … |
|
I've created a ray distribution method that generates rays over a fixed angle with an even distribution along the xz plane. [CODE] /// <summary> /// Generates rays that are evenly distrbuted in a circular formation around a point but are restricted to an angle /// </summary> /// <param name="point">The point … |
|
I would like to allow only certain keys to be valid for my TextBox control. I have set it up as follows and it works fine. [CODE] private void TextBox_MapInputMin_KeyDown(object sender, KeyEventArgs e) { if (!IsFloatingPointTextBoxValid(e, textBox_MapInputMin)) { // 'Handled' property stops key from being entered into the control e.Handled … |
|
If anyone has used Unity 3D ([URL="http://unity3d.com/"]http://unity3d.com/[/URL]) then they will know that on the right hand side there is a tree view control that allows the user to click on a node and drag it into the environment to create an object. Is there a control in Winforms that allows … |
|
I have a class which stores my camera settings [CODE] public class SaveData { public CameraFreeLookSettings CameraSettings; /// <summary> /// Parameterless constructor for XML Serialization/Deserialization /// </summary> private SaveData() { } public SaveData(CameraFreeLookSettings cameraSettings) { CameraSettings = cameraSettings; } } [/CODE] I'm trying to save those settings using a SaveFileDialog … |
|
I'm trying to avoid using a singleton pattern with my finite state machine. My agent is changing states based on enumerated messages: [code] public enum MessageType : byte { PathFollow, AlertStatusStart } [/code] Each state is derived from the following class that has access to a Game1 class: [code] public … |
|
I'm currently using the following for counting forwards and backwards through an array depending on the current index. If the index increments past the end of the array it now decrements and vice versa. [CODE] isReversed = isReversed ? index - 1 != -1 : index + 1 == array.Length; … |
|
I have a 1D array. Each element in the array is arranged to emulate a 3D index: [CODE] for (int x = 0; x < depth; ++x) { for (int y = 0; y < height; ++y) { for (int z = 0; z < width; ++z) { int index … |
|
I have a method the finds the nearest cell in a grid using ray traversal. The method may or may not find a cell. I would like to return the cell location value from the method if it is found but null if it isn't. The value is non nullable … |
|
I'm after an efficient way of detecting whether a List object has changed from one frame to the next. [CODE] List<int> intList = new List<int>(); [/CODE] I have my list as a member variable and will check to see if it has changed each Update() method call. The only way … |
|
I have a method that is called each frame that will object a GUI window based on the selected object's properties. [CODE] private void Update_Window_Properties() { if (objectSelected == null) { return; } Entity e = objectSelected.Entity; Vector3 position = e.InternalCenterPosition; textBox_PositionX.Text = position.X.ToString(); textBox_PositionY.Text = position.Y.ToString(); textBox_PositionZ.Text = position.Z.ToString(); … |
|
I'm currently on the look out for algorithms that generate uv coordinates for various primitives, including: - Sphere - Cylinder - Cone - Capsule Can anyone point me in the direction of any books, tutorials or code that could be of interest? Thank you. |
|
I would like to sort an array of objects by their distance. The problem is that the distance value is a floating point and IComparer only will accept an integer as a return value. [CODE] class SortDistanceAscending : IComparer<ObjectDistance> { static IComparer<ObjectDistance> comparer = new SortDistanceAscending(); public int Compare(ObjectDistance a, … |
|
I have a simple class that creates unique ID numbers: [CODE] public static class ID { private static int iD = 0; public static int GetNextID() { return iD++; } } [/CODE] If I want each instance of an abstract class to automatically get a new non changeable ID when … |
|
I'm creating an array of vertex formats which I know will always come in groups of 3 as models are generally made for triangles which have 3 vertices. My loop was originally [CODE] for (int i = 0; i < batchVertices.Length; ++i) { batchVertices[i] = new VertexFormat(vertices[i], normals[i], textureCoordinates[i]); } … |
|
Let's say I have 5 boolean values: [CODE] bool a; bool b; bool c; bool d; bool e; [/CODE] If they evaluate as true 'a', 'b', 'c' and 'd' should have their associated code run. If 'e' evaluates as true then only its associated code is run and the values … |
|
I would like to write a class that handles a series of timed events for an object. I would need to deal with class properties not being set, and therefore making no change to the object. I've gone with the "?" nullable operator for my first attempt but I would … |
|
Here are 3 integers and 1 bool. [CODE] int a; int b; int c; bool bHasChangedValue; [/CODE] The boolean value bHasChangedValue depends on the value of b changing. If I update b each frame [CODE] public void Update() { a = b; b += c; bHasChangedValue = a != b; … |
|
I have 3 methods [CODE] MethodA() MethodB() MethodC() [/CODE] All 3 methods [U]must[/U] be run at least once per frame/update. MethodA generates a integer count, let's call it 'intCount'. If the count is 0 then MethodB and MethodC don't need to be called. All 3 methods will continue to be … |
|
I've got a simple struct. [CODE] struct Data { public float Size; public Data(float size) { Size = size; } } [/CODE] If I create an array of the struct above, the array does not initialise each element to null. How can I change this? |
|
In C++ the ternary operator below will return 1. [CODE] true ? 0 : 1 [/CODE] In C# it will return 0. If the following is written in C++ [CODE] int x = ((a < b) ? 1 : ((a > b) ? -1 : 0)); [/CODE] what the heck … |
|
Here's a simple integer array. [CODE] int[] intArray = new int[5]; [/CODE] Now I make the first element equal to a variable. [CODE] a = 10; intArray[0] = a; [/CODE] How can I change the variable so the array automatically updates without using referring to the array? E.g. [CODE] a … |
|
I have 3 classes: Foo, Bar and Jim. [CODE] public class Foo { public float a = float.MaxValue; } public class Bar { public float a = float.MaxValue; } public class Jim { public float a = float.MaxValue; } [/CODE] I create a list that holds pairs of objects (classes … |