Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

222 Neutral

About Slaru

  • Rank
  1. Slaru

    Dual Monitor

    Look here. There should be some stuff that will help you. Like you said, if you don't want to copy and paste code, look into the functions at the bottom of that post. [EDIT] I changed the link. I messed it up the first time. Stephen
  2. Hello, You will need to get information about the available monitors on the system. Here's some code of mine I wrote recently (meaning it hasn't been tested much) that you can use as a base for enumerating monitors. EnumerateDisplays.h struct DisplayMode { DisplayMode() : width(-1), height(-1), refreshRate(-1), bpp(-1) {} DisplayMode(int w, int h, int r, int BPP) : width(w), height(h), refreshRate(r), bpp(BPP) {} int width; int height; int refreshRate; int bpp; }; // Class: Display // // A physical display on a computer. class Display { public: Display(); Display(int index, int x, int y, bool primary, string devName, string devString, const vector<DisplayMode>& displayModes); //bool Defaulted() const { return m_Index == -1; } // Function: GetName // // Retrieves the name of the display. string GetName() const; // Function: GetDisplayModes // // Retrieves a vector of available <DisplayModes> for the display. const vector<DisplayMode>& GetDisplayModes() const; // Function: SelectDisplayMode // // Selects the display mode to set this monitor to when a window is void SelectDisplayMode(DisplayMode mode); private: int m_Index; int m_XOffset, m_YOffset; bool m_PrimaryDisplay; string m_DeviceName, m_DeviceString; vector<DisplayMode> m_DisplayModes; DisplayMode m_SelectedDisplayMode; }; // Function: EnumerateDisplays // // Enumerates all displays available. // // Returns: // The vector of <Displays> filled with the list of displays. vector<Display>& EnumerateDisplays(); EnumerateDisplays.cpp Display::Display() : m_Index(-1), m_XOffset(-1), m_YOffset(-1), m_PrimaryDisplay(false), m_DeviceName(cs("UNKNOWN")), m_DeviceString(cs("UNKNOWN")) { } Display::Display(int index, int x, int y, bool primary, string devName, string devString, const vector<DisplayMode>& displayModes) : m_Index(index), m_XOffset(x), m_YOffset(y), m_PrimaryDisplay(primary), m_DeviceName(devName), m_DeviceString(devString), m_DisplayModes(displayModes) { } string Display::GetName() const { return m_DeviceString; } const vector<DisplayMode>& Display::GetDisplayModes() const { return m_DisplayModes; } void Display::SelectDisplayMode(DisplayMode mode) { m_SelectedDisplayMode = mode; } BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { MONITORINFOEX monInfo; monInfo.cbSize = sizeof(MONITORINFOEX); GetMonitorInfo(hMonitor, &monInfo); vector<Display>& displays = *((vector<Display>*)dwData); int ddIndex = 0; bool primaryDisplay = false; string deviceName = string(monInfo.szDevice), deviceString; vector<DisplayMode> displayModes; DISPLAY_DEVICE displayDevice; displayDevice.cb = sizeof(DISPLAY_DEVICE); for (ddIndex = 0; EnumDisplayDevices(0, ddIndex, &displayDevice, 0); ddIndex++) { if ((string(displayDevice.DeviceName) == deviceName) && !((bool)(DISPLAY_DEVICE_MIRRORING_DRIVER & displayDevice.StateFlags)) && !((bool)(DISPLAY_DEVICE_REMOVABLE & displayDevice.StateFlags))) { deviceString = string(displayDevice.DeviceString); primaryDisplay = (bool)(DISPLAY_DEVICE_PRIMARY_DEVICE & displayDevice.StateFlags); DEVMODE devMode; devMode.dmSize = sizeof(DEVMODE); for (int j = 0; EnumDisplaySettingsEx(displayDevice.DeviceName, j, &devMode, 0); j++) { if (devMode.dmPelsWidth < 640 || devMode.dmPelsHeight < 480 || devMode.dmBitsPerPel < 16) continue; POINTL position; position.x = monInfo.rcMonitor.left; position.y = monInfo.rcMonitor.top; devMode.dmPosition = position; devMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | DM_POSITION; LONG result = ChangeDisplaySettingsEx(displayDevice.DeviceName, &devMode, 0, CDS_TEST, 0); if (result != DISP_CHANGE_SUCCESSFUL) continue; displayModes.push_back(DisplayMode(devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmDisplayFrequency, devMode.dmBitsPerPel)); } break; } } displays.push_back(Display(ddIndex, monInfo.rcMonitor.left, monInfo.rcMonitor.top, primaryDisplay, deviceName, deviceString, displayModes)); return TRUE; } vector<Display>& sl::EnumerateDisplays() { static vector<Display> s_Displays; if (s_Displays.empty()) { if (!EnumDisplayMonitors(0, 0, MonitorEnumProc, (LPARAM)&s_Displays)) THROW_EXCEPTION("Could not enumerate available display devices"); } return s_Displays; } I haven't commented much in the above code. If you have any questions, just ask. If you look up the functions on MSDN (EnumDisplayMonitors MONITORINFOEX GetMonitorInfo DISPLAY_DEVICE EnumDisplayDevices EnumDisplaySettingsEx ChangeDisplaySettingsEx) you should get some good information. With that code, you should be able to create multiple windows that each span an entire monitor in fullscreen mode (this is what you need to do, isn't it?). It's simply a matter of creating the windows at the right position and the right size to match the monitor. This is unfortunately all I can help with for now due to lack of time. Setting up GL to address multiple windows shouldn't be too hard. It's just a matter of activating the correct rendering context. Slaru
  3. Slaru

    Copying data and corruption

  4. Hello, I'll be transferring all my files from one hard drive to another and then back again (because of reinstalling windows and switching hard drives). What is the reliability of this operation and it not corrupting the data? Do I have anything to fear? Does Windows verify the results of the copy with the source? I don't have any files that are very important not to lose but I don't want to lose anything. Slaru
  5. Slaru

    SDK Download down?

    Hey, Same for me. Dunno whats up with it.
  6. Hello, I was looking in the book discussion forum and noticed the two top threads ("Moved: GameDev.net's New Design" and "Moved: Get your GameDev.net gear! Visit our online store!"). I clicked one (and later the other) and neither of them take me to the correct page. Instead it ends up at the GDNet books page. I don't think that is what it is supposed to do... It appears it is using the http://www.gamedev.net/columns/books/bookdetails.asp page instead of the http://www.gamedev.net/community/forums/topic.asp page. Slaru
  7. Slaru

    Flying through a cloud

    Look here. Read Harris' paper, it is really good. It talks about your problem.
  8. Slaru

    best udp for beginners

    I might recommend using a higher level networking library that takes care of all the problems associated with UDP. ENet and RakNet are two I can think of off the top of my head. EDIT: Check this out. Slaru
  9. Slaru

    Visual Studio 2005 Express

    Have you installed the Platform SDK?
  10. Slaru

    Making a gui for my game

    Here is an article on creating a GUI with DirectX. I haven't read it, so I don't know if it is dated or how much help it will be. Slaru
  11. Slaru

    Making a gui for my game

    I believe that the DirectX SDK includes some sort of a GUI framework. I know all of the sample applications use it. You might look into that.
  12. Slaru

    Visual Studio 2005 Express

    Quote:Original post by Mantear How do most people handle their for-loop variables? Declare them at the top, ala C style? Or re-declare them each time? I declare them for each for-loop almost always. I figure compilers should be smart enough (at least smarter than me) to be able to optimize things best. This is just me though, and I'm definitely not a consumate (but I am proficient) C++ programmer.
  13. I don't know anything about the book, but I can help you with your question about how much math you should know. I started programming graphics when I was in the eighth grade. I was (and still am) in the top honors math class at my school and I didn't know any of the math that was used in computer graphics. I didn't know what matrices and vectors are. The book I was learning computer graphics from ("Introduction to 3D Game Programming with DirectX 9.0"-Frank D. Luna) had a math primer that explained them. I understood vectors fairly quickly, but matrices took me nearly a week to understand and I had to search the internet for some more resources on them also. I think you should be able to comprehend the math required with a little work. For matrices, even if you don't know how to implement them in code, if you can use a matrix class (very simple stuff) then you'll be okay for the time being. Slaru
  14. I have been using VC++ 2003. But, I am currently 98% of the way done downloading the new VC++ express edition. So this will do autocompletion? Slaru
  15. Hello, I have been using boost's smart pointers and have loved them. The only thing I miss is Intellisense's autocompletion. Is there any way to make Intellisense work with boost's smart pointers? Slaru
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!