NisseBosseLasse

Members
  • Content count

    175
  • Joined

  • Last visited

Community Reputation

239 Neutral

About NisseBosseLasse

  • Rank
    Member
  1. An Adventure Game (Prolog blog)

    I encourage everybody to check out my friend's blog [url="http://prologomenon.wordpress.com"]The Blogging of Prolog[/url], and especially his five-part series titled [b]An Adventure Game[/b] where he goes through the process of implementing a sort of scripting engine a'la old Infocom games. Even if you're not into any logic programming it's a fun read, and contains many interesting ideas.
  2. win32 question!

    I've never used this function so I may be wrong. Regarding the ProcessDebugPort, MSDN also says this: Quote: It is best to use the CheckRemoteDebuggerPresent or IsDebuggerPresent function. Can you use those two instead? CheckRemoteDebuggerPresent and IsDebuggerPresent
  3. windows api - messages!

    As with most other Windows messages, the rest of the information for the message lies within the parameters wParam and lParam (passed to your window procedure). MSDN has an article about keyboard input here: http://msdn.microsoft.com/en-us/library/ms646268%28v=VS.85%29.aspx
  4. Good game idea

    Good read: Going to post your game idea? Read this first
  5. word "homeworld" trademarket?

    Whatever you do, don't call it Edge...
  6. Physics Performance Testing : Your input needed.

    30 fps on average AMD Athlon 64 Dual Core (6000+), 3.1 GHz
  7. [XML, C#] Saving a int[,] to a XML file

    Is the line break really necessary? How do you read the values back from the XML-file? I believe you can go with a number of choices here. One is that the visual representation of the tile map in the XML file doesn't really matter, as long as the parsing of the values is corrent. For example: the Layout-tag tells me that every row is 10 items wide, so all I need to keep track of is how many numbers you've read so far (every 10th is a new line). Because when you think of it, the new line is really just there for your own sake, so you can distinguish the view of the map easier. It isn't really necessary for the parser. Another way to do it is to store every row in a Row-tag, like this: <TileLayer> <Layout Width="10" Height="10"> <Row>1 0 0 0 0 0 0 0 0 0</Row> <Row>1 0 0 0 0 0 0 0 0 0</Row> <Row>1 0 0 0 0 0 0 0 0 0</Row> <Row>1 0 0 0 0 0 0 2 0 0</Row> <Row>1 0 0 0 0 0 0 0 0 0</Row> <Row>1 0 0 0 0 0 0 0 0 0</Row> <Row>1 1 1 1 1 1 1 1 1 1</Row> <Row>0 0 0 0 0 0 0 0 0 0</Row> <Row>0 0 0 0 0 0 0 0 0 0</Row> <Row>0 0 0 0 0 0 0 0 0 0</Row> </Layout> </TileLayer>
  8. Walter Cronkite 1916-2009

    Quote:Original post by LessBread According to Cronkite set standard for news anchors around the world, news anchors in Sweden are called Kronkiters and in the Netherlands, Cronkiters. Can anyone confirm this? As for Sweden, no. Maybe it's used by the people who work as news anchors, but I've never heard it. Naurava: no worry, you're right!
  9. Cool concept! I really recommend anyone reading this to give it a try, it's quite different.
  10. Up to Date & SwapBuffers

    Why are you calling GetCursorPos? The coordinates are stored in lParam.
  11. I quickly wrapped up your example in a small program: #include <iostream> #include <string> #include <vector> #include <cstdlib> void tokenize( const std::string &codeVec ) { size_t equalAt = 0, commaAt = 0, commentAt = 0; std::vector<std::string> retString ; equalAt = codeVec.find("="); commaAt = codeVec.find( "," ); commentAt = codeVec.find( "%" ); // equalAt = 5 // commaAt = 9 // commentAt = 4294967295 = std::string:npos } int main() { tokenize("print=100,asd"); } The reason you're getting that large number is because it equals to std::string::npos when the searched string isn't found. I compiled this under Visual C++ Express 2008.
  12. I may be on the wrong track here, but wouldn't an image with an alpha channel be more efficient, considering memory alignment (RGBA takes 4 bytes, instead of just pure RGB of 3 bytes)?
  13. Hotkey for a console application

    Ok, I've tested your code and believe there two potential pitfalls here: 1) the use of PeekMessage isn't right 2) you're not checking the result code from RegisterHotKey() I rewrote your code slightly and ended up with this: MSG aMessage = {0}; PeekMessage(&aMessage, NULL, 0, 0, PM_NOREMOVE); while (aMessage.message != WM_QUIT) { if (PeekMessage(&aMessage, NULL, 0, 0, PM_REMOVE) != 0) { switch (aMessage.message) { case WM_HOTKEY: ConPrint(L"Hotkey!"); break; default: break; } } else { // Do other stuff not related to messages } } This works, but then I noticed your register MOD_WIN + 'a' as your hotkey (I've used CTRL+B all the time). When I changed to MOD_WIN, I got an error from RegisterHotKey (zero as result). MSDN states: Quote: [i]MOD_WIN[i] Either WINDOWS key was held down. These keys are labeled with the Microsoft Windows logo. Keyboard shortcuts that involve the WINDOWS key are reserved for use by the operating system. GetLastError returned code 1409: "Hot key is already registered." So you can't register hotkeys with the Windows-key. Nevermind, it was mine code that was faulty! I registered MOD_WIN + 'b', which was taken. But MOD_WIN + 'a' actually works :)
  14. Hotkey for a console application

    Did you replace GetConsoleWindow() with NULL? I.e. PeekMessage(&aMessage, NULL, 0, 0, PM_NOREMOVE);
  15. Hotkey for a console application

    You don't need to peek into that window for retrieving that message (I believe) - just use NULL instead of GetConsoleWindow(). Here's an example I wrote (using Unicode-character set, Windows subsystem). It allocates a console, registers a hotkey (CTRL+B), and goes into its message loop. Switch to any other window and press CTRL+B. Text will pop up in the console window (as well as a message box, but that's just because we don't want the console window to disappear since the program ends when CTRL+B is pressed). #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <string> using std::wstring; void ConPrint(const wstring &text) { const wstring text_nl = text + L"\n"; DWORD written = 0; WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), text_nl.c_str(), text_nl.length(), &written, NULL); } int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { // Start up AllocConsole(); ConPrint(L"--- Start up ---"); // Register hot key (CTRL+B in this case) if (RegisterHotKey(NULL, 1, MOD_CONTROL, 'B')) { ConPrint(L"Hotkey registration succeeded."); } else { ConPrint(L"Hotkey registration failed, exiting..."); MessageBox(NULL, L"Pressing OK will close the console...", L"Hotkey example", MB_OK | MB_ICONINFORMATION); FreeConsole(); return -1; } // Main loop MSG msg = {0}; while (GetMessage(&msg, NULL, 0, 0) != 0) { TranslateMessage(&msg); DispatchMessage(&msg); // We got a hotkey message! if (msg.message == WM_HOTKEY) { ConPrint(L"Nice, CTRL+B pressed! Exiting..."); break; } else if (msg.message == WM_QUIT) { break; } } // Clean up ConPrint(L"--- Closing ---"); UnregisterHotKey(NULL, 1); MessageBox(NULL, L"Pressing OK will close the console...", L"Hotkey example", MB_OK | MB_ICONINFORMATION); FreeConsole(); return 0; }