Jump to content
  • Advertisement

marshdabeachy

Member
  • Content Count

    93
  • Joined

  • Last visited

Community Reputation

100 Neutral

About marshdabeachy

  • Rank
    Member
  1. marshdabeachy

    [.net] Form flickering

    Thanks for the reply. I tried all 3 suggestions (on all three forms, no less), and the flickering still persists. Is it necessary to double-buffer all the parent forms if a child form needs to be double-buffered? I would think not, but I'm trying anything to get this working. Any other ideas?
  2. I'm having issues where a UserControl of mine is flickering on redraw. The form is several layers deep inside of some UserControls I have. So the hierarchy is Main Form > Panel > DayDisplay (UserControl) > Panel > PersonDisplay (UserControl) > Panel. Inside of my PersonDisplay, I've overridden the Paint call on the final Panel do some draws with DrawLine / FillRectangle, and this is where it's flickering. Now, I've tried setting PersonDisplay's DoubleBuffering flag to true, with no effect. I then also tried setting it on the parent controls (DayDisplay and the main form), also to no effect. I then went through and added this line into the ctor's for all 3: SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); Also to no effect. I'm out of ideas. Anyone else have any? Thanks!
  3. marshdabeachy

    Storing function pointers

    Thanks Richy, that looks like it will work. It'll take me a bit to go through everything though. Out of curiosity, can you provide BcTypes.h?
  4. I'm writing an input manager that will provide callbacks to other classes that register with it. The idea is that when, for example, you press 'a', every class that has registered with DIK_A will be notified. When registering, I pass in the instance of the class to notify, as well as the member function within the class to notify. I've got this part working. Looks like this: template <class T> void InputManager::RegisterKeyboardCallback(unsigned key, T* instance, void (T::*function)(float)) { // sample function call (*instance.*function)(1.0f); } However, the problem comes in storing this information. There doesn't seem to be a way, at least that I've figured out, to keep track of every instance/function that's registered inside of InputManager so when the key is actually pressed it can look up all of the instances/functions to call, simply because it's so generic. Any ideas?
  5. I want to implement a global high score table in our game by communicating with a PHP script on some remote web server. I've done this with Flash before with no problems. However, this time I'm doing it in C++. What is the best way to go about this? I'm able to connect and submit to a server using this code: struct addrinfo hints, *res; int sockfd; memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; getaddrinfo(web_address.c_str(), "80", &hints, &res); // make a socket: sockfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (sockfd == INVALID_SOCKET) return false; // connect! if (connect(sockfd, res->ai_addr, res->ai_addrlen) == -1) return false; if (send(sockfd, dataStr.c_str(), dataStr.size(), 0) == -1) return false; shutdown(sockfd, 2); So, this will connect to something like "www.example.com" just fine. However, I want to submit it to "www.example.com/myfile.php", which I'm not able to do. Maybe I'm just confused on how socket connections work to web servers. How do I do a POST to my PHP script? Thanks!
  6. marshdabeachy

    Bit manipulation

    That looks like a much cleaner solution than anything I was attempting. One thing I want to clarify... I tried stuffing 1 million bools into a vector to see what would happen to memory, and it barely made an impact. I take it that the vector specialization of bool only uses 1 bit instead of the normal 8? I'm going to be keeping track of a lot of bits.
  7. marshdabeachy

    Bit manipulation

    It's been a few years since I've done direct bit manipulation, so I'm trying to figure out the best way to go about this. I'm implementing a replay feature into a game with a fixed timestep. So I will effectively just be logging inputs, spawning, and the associated frame number, and feed the data back into the engine so it can recreate it. I'm keeping track of the frame number, the operation performed, and the data associated with the operation. Since the game could theoretically last for several hours, I need to compress the record keeping as much as possible, so I'm making ever bit count. With the frame counter, I figured I could fit about five hours into 20 bits (2^20 can hold quite a lot), so I'm sticking with that number. I have a total of 6 possible actions, so that's 3 more bits for the action. Data is associated with the action and thus varies, but it's anywhere from 1 to 15 extra bits. What I want to do is just stack this data end to end, and then break it apart later when I load the replay back up. Effectively, I don't want to waste a single bit. The problem I'm running into is breaking this up over multiple bytes. I've got 20 bytes for the frame number, and then I've got to stuff 3 more bits into that third byte after the 20th bit, and then a varying amount of data packed behind that... and then when the next action is logged, nothing's falling at the beginning of a byte anyway, so it's a big mess. Spreading data across two or more bytes gets complicated, especially when it doesn't start at the beginning of the byte. I'm rather fluent in C++'s bitwise operations but am not sure about the best way to go about getting this to work. Any tips?
  8. marshdabeachy

    XInput - Detecting new controllers

    Alright, that's what I figured. I'm always on the lookout for better ways to do things, so I thought I'd at least ask.
  9. I was just curious if the XInput interface provided any kind of notification when a new controller becomes active. Obviously I could constantly poll for new controllers every frame, but that seems rather wasteful. I checked Microsoft's documentation but I didn't see anything. Anyone know of a magic function that provides this?
  10. marshdabeachy

    XInput not working with multiple controllers

    FYI for anyone else looking for a solution on this... It turns out the DirectX SDK I was using was busted. I upgraded to the latest version (March 08) and now all the controllers work.
  11. I've got an odd problem... XInput works, but only for one controller. For everything else it just gives me a ERROR_DEVICE_NOT_CONNECTED error. Code is rather basic, I'm just checking to see if the controller is there... for (int i=0; i<4; i++) { XINPUT_STATE temp; memset(&temp, 0, sizeof(XINPUT_STATE)); DWORD result = XInputGetState(i, &temp); if (result == ERROR_SUCCESS) { // controller available } } Like I said, index 0 returns a result of 0 and can successfully get the controller's state. All other controllers (1-3) just return error code 1167... ERROR_DEVICE_NOT_CONNECTED. In Vista's gamepad manager, all controllers show up correctly and I can test them all with no problems. I'm using a USB wireless receiver to connect the controllers. Any ideas?
  12. marshdabeachy

    [.net] [C#] Generics Array Access

    Yeah I was looking into that earlier. I tried implementing something like this... abstract public class GenericCollectionPropertyDescriptor<Base, BaseCollection> : PropertyDescriptor where BaseCollection: CollectionBase { ... } (Pardon my crappy naming convention.) It apparently doesn't guarentee array indexing though. I'm not entirely sure what will. Hmm, oh well. It's not a big deal, but I thought I'd ask.
  13. I'm dealing with C#'s PropertyGrid component, and I'm dealing with collections of objects, such as my own custom classes Users and Labs. I've been following this tutorial (http://www.codeproject.com/KB/tabs/customizingcollectiondata.aspx) for implementation details. Anyway, long story short, I'm using C#'s generics to implement a base class that handles a lot of the trivial stuff, and then deriving from that base class to handle class-specific (Users and Labs) implementation details. Basically, I've got these two functions here in the base class that are now broken: public override object GetValue(object component) { return this.collection[index]; } public override Type PropertyType { get { return this.collection[index].GetType(); } } They're giving me this error: Quote:Cannot apply indexing with [] to an expression of type 'BaseCollection' Where BaseCollection is the Generic type. This USED to work before I implemented Generics, because the classes that are deriving from this have the array access operator implemented. However, obviously C# cannot assume such. I can fix this just by copying these two functions into the classes that derive from this class, but that seems wasteful. Is there a way I can tell the compiler that the indexing operator is in fact implemented?
  14. I have an app that does a lot of line drawing, which just draws straight onto the form. This is working fine. However, the assignment called for a trackbar, so I put it on the form. It also works fine. The problem that arises, however, is that the trackbar has stolen focus from the form. Keyboard and scroll wheel functionality that used to work now gets redirected to the trackbar. The only way the trackbar should change is if the user directly clicks on it. Is it possible to disable everything else associated with focus for the trackbar?
  15. marshdabeachy

    [.net] C# - Panels and Forms

    Yeah, that did it. I had never heard of a UserControl before, but it's exactly what I needed. It's working now. Thanks everyone!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!