Tag Info

Hot answers tagged

10

The Win32 API is not a must. Professional games can be developed in anything from AGS to Flash to XNA to low-level C++. The Win32 API is only used for some Windows games, and not at all on non-Windows systems. I will note, however, that a skilled general-purpose game developer would be able to pick up the Win32 API and learn how to use it if it was the best ...


9

Actually that "while loop" that you wrote there is the source of your problem. GetMessage puts your application to sleep until a message arrives. This is good for GUI applications but obviously is not good for games. The right way of doing the game loop is using PeekMessage instead so that your application is not put to sleep and can just keep spinning. ...


5

I'd like to know if the way i'm checking if the OpenGL version of choice (3.3) is availible. Allow me to state this more clearly: The only way to know if your OpenGL implementation supports a particular version is to attempt to create a context with that version and see if you get a valid context as a result. wglCreateContextAttribsARB will either ...


4

When the main thread signals the rendering thread to terminate, you can use a mutex and condition to wait for the rendering thread to exit before allowing the main thread to proceed. You need to make sure this is the first thing you do on shutdown - before you delete anything related to rendering.


4

The vast majority of game devs I've worked with have had only a passing knowledge of Win32 at best. Only a teeny tiny fraction of a game's codebase is going to use any platform-specific APIs in general, and unless you're the engine dev who's writing the abstraction layers for those, you can get away without knowing anything about Win32. Most indie games ...


4

Two things: GDI and GDI+ are not going anywhere. Deprecated and Obsolete have two very different meanings, and GDI/GDI+ are just Deprecated. This means that there are better ways to do the same things you used to do with GDI/GDI+, namely DirectX, DirectComposition and WIC, but I don't foresee Microsoft actually removing GDI/GDI+ from the kernel anywhere in ...


3

To my knowledge, the onlything that works is: DwmEnableComposition(DWM_EC_DISABLECOMPOSITION); at the start of your application and: DwmEnableComposition(DWM_EC_ENABLECOMPOSITION); before quitting. For the transitions, proceed as usual. I have tried InvalidateRect(NULL, NULL, true) just after switching to fullscreen to no avail. Hope this helps.


3

You need to while that PeekMessage, and then loop. Something like bool DoMessages() { while(PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) return false; TranslateMessage(&msg); DispatchMessage(&msg); } return true; } while(DoMessages()) { Draw(); } It's not common ...


3

I don't know where you got the idea of doing it like this, but it doesn't sound very game design like at all. For a simple game like this you shouldn't need multiple windows and multiple threads. Also events aren't commonly used in game development because they break the flow of your game loop. Anyway why not try something like this: Build a game loop that ...


3

You can use GetGlyphOutLine() with a format of GGO_GRAY8_BITMAP to extract individual character images, along with the metrics that tell you about placement and spacing. Without using those metrics, rendering the bitmaps in the correct position is much more difficult. Ideally you'd also use data from GetKerningPairs() to improve spacing between characters ...


2

Yes this is a good idea in general though I would consider splitting the server side out and making a dedicated server. Secondly here is how you launch a Win32 thread and get it to call a function in a class. class MyClass { public: static void ThreadStartLoc(void* MyClassPtr) { ((MyClass*)MyClassPtr)->InternalThreadRun(); } ...


2

the message loop thread signals the render loop thread to exit. As far as I can tell before the render loop thread can even process the signal it tries SwapBuffers and that fails. And therein lies your problem: your "message loop thread" should be your "render loop thread". They should be the same thread. Attempting to do rendering outside of the main ...


2

I've run into something sort of similar, and the quick answer is that once windows starts processing the quit, you don't have a lot of time. Controls and resources start getting destroyed immediately, and it is entirely possible that by the time your thread gets around to referencing the resource, it's already extinct. I got around this by intercepting the ...


2

This quote answers most of your questions: You cannot control whether a driver does triple buffering. You could try to implement it yourself using a FBO. But if the driver is already doing triple buffering, your code will only turn it into quadruple buffering. Which is usually overkill. http://www.opengl.org/wiki/Common_Mistakes#Triple_Buffering ...


2

Yes, you should use WM_INPUT for things like camera movement. Why? Because it doesn't matter what the mouse's factory DPI is. Pretty much all games give the user a "mouse sensitivity" setting, where they can tweak a custom DPI value (they don't need to know it's the DPI!) to fit their preferences. When it comes to GUI, you should still use the ...


1

Pseudo code: currentKeyboardState previousKeyboardState void UpdateInput() store currentstate to previousstate get new state to currentstate Now that we have stored the last state and we know the current state, we can check if key was NOT pressed in last frame and is now pressed. So we know if key was pressed down just now. ...


1

You're indeed not the only one facing this issue. First thing to check: make sure you're using the latest/beta/top-notch drivers for the video card you're using. Now, I'd say that there's only a small chance that you can get this working better than the automatic DXGI implementation. This kind of issue is highly dependent on the adapter vendor, driver ...


1

If I understand you correctly, you simply want to hide the mouse when your gesture starts, and then make the mouse appear again on the position it disappeared. Get the mouse position before hiding: POINT posRelative; POINT posAbsolute; GetCursorPos(&posAbsolute); posRelative.x = posAbsolute.x; posRelative.y = posAbsolute.y; ScreenToClient(hwnd, ...


1

No, you generally cannot interact with your main window from not the main thread. Since the GL context is tied to the HWND, you cannot generally issue GL commands from threads that are not the main thread. "Multithreaded rendering" is only about doing data processing and whatnot. You can do all kinds of math and processing on worker threads. But OpenGL ...


1

Well I decided to change to a much easier approach. float radius = Array_norm<float>(move_vector,3); current_y_angle = acos(move_vector[1]/radius) + mouse_move_y * input::MOUSE_sensitivity * 0.017; current_x_angle = atan2(move_vector[2],move_vector[0]) + mouse_move_x * input::MOUSE_sensitivity * 0.017; move_vector[0] = ...


1

No. Consider that many, many games are now made for and sold on platforms that don't even have the Win32 API; I doubt many Android or iOS game developers have a daily need for Win32. But even if you work on a PC/XBOX only title, chances are you will be using multiplatform middleware or your company's game engine and someone else has already done the Win32 ...


1

Win32 API is simply an interface one uses to natively hook up one's game into the infrastructure of Windows. Managing the application handler, creating windows pertaining to your application/game and registering with the system. This is what most indie game developers deem as boilerplate code, the bare minimum that has to be done on a specific platform in ...


1

Use duplicated data synchronized with message passing via 1 directional ques. It lets you scrap any kind of locking. It should also be a very flexible system. Here are a few pointers, it's basically a system I worked out to tie in threading, multiplayer network replication and saving/loading. It's only theoretical, i've never implemented it so I cant say ...


1

Assuming your Update() methods look like this: for each entity in allEntities { entity.Update() } You'd need to either synchronize (aka lock) the entire loop: lock(allEntities) { for each entity in allEntities { entity.Update() } } Preventing almost any multi-threading gain. The other way would be to synchronize around each and ...


1

Try this: (You'll need to call this three times, once for Roll, Yaw, and Pitch). This should work, I've used it in my own game, and it has been unit-tested. Of course, if your vector/point class has its overloaded operators defined differently then it may not give similar results. Here is my vector implementation (as of a few months ago). point3D ...


1

Yeah, D3DPRESENT_PARAMETERS has a BOOL called "Windowed" in it; you want to set that to false at the time you make your call to CreateDevice on your IDirect3D9 pointer.


1

Limiting the mouse movement has previously been discussed here: Mouse aim in an FPS



Only top voted, non community-wiki answers of a minimum length are eligible