• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

220 Neutral

About simon10k

  • Rank
  1. File input and output, help plz

    You can also write the size of the vector to the file so you know how many elements to read.
  2. A C++ Timer?

    I think this will help you. timer.h #ifndef _TIMER_ #define _TIMER_ #include <ctime> class Timer { clock_t counter; public: Timer(): counter(0) {}; bool elasped(clock_t ms) { clock_t tick = std::clock(); if(tick - counter >= ms) { counter = tick; return true; } return false; } }; #endif main.cpp #include <iostream> #include "timer.h" int main() { Timer timer; while(true) { if(timer.elasped(1000)) std::cout << "ding!\n"; } }
  3. visual C 8 game loop

    My game loop looks like this MSG msg = {}; while(msg.message != WM_QUIT) { if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg); else RunFrame(); }
  4. Computing PI

    I know PI is approx 3.142... but how did "they" work that out? I don't think it was with a string and a ruler, unless it was a very big circle. I heard somewhere that there was a computer program working out the defininate value of PI, that it is a very long number and doesn't seem to have an end. How could I conjure up something in C++ to compute the value of PI without a constant, or just typing it -for learning purposes.
  5. Looking for a Good Win32 compiler

    I think you can only run VC++ Express on the computer you installed it on, I'm not sure though, I'm going by the fact that my VC++ Express programs don't run at college. And when I uninstalled VC++ Express the programs stop running too.
  6. Could someone show me an example of how to resize the client area of the window to a certain width and height? Using the WS_OVERLAPPEDWINDOW flag.
  7. VC++ 2005 Express Problem - Platform SDK Install

    Quote:Original post by pulpfist Suddenly you go quiet :D I guess we finally nailed it... I think that was his suicide note [grin]
  8. How do I find the frequency of the cpu so I can convert the rdtsc into milliseconds.
  9. Frames Per Second question

    We get an approximation, but then again, your probably right about the GPU.
  10. rdtsc help

    Another thing, can I convert the rdtsc into ms?
  11. Frames Per Second question

    I think vsync is good, but I like to be able to use the frame_rate as a benchmark, so I don't include the flip/present() in my time tests so my code might look like int start = clock(); RunFrame(); int frame_rate = clock() - start; Text("frame rate: ", frame_rate); Flip();
  12. rdtsc help

    I was just wondering if this is the correct way to use the rdtsc unsigned __int64 get_cpu_tick() { DWORD dwLow, dwHigh; __asm { rdtsc mov dwLow, eax mov dwHigh, edx } return ((unsigned __int64) dwHigh << 32 | dwLow); } or am I missing something? Thanks. ~edit~ I found another function, unsigned __int64 __rdtsc(void); Which does what I need, another question, does QueryPerformanceFrequency() return the frequency of the processsor?
  13. You can make a call to timeBeginPeriod at the start of your application, and a call, with the same parameter to timeEndPeriod at the end of your application. int main() { timeBeginPeriod(1); //use timers timeEndPeriod(1); } As I understand it.
  14. The timeBeginPeriod function sets the minimum timer resolution for an application or device driver. timePeriodBegin(1); Sleep(1); timeEndPeriod(1);
  15. win32 app

    You can put #undef UNICODE at the top of your source files -i.e. before <windows.h>, which is good for converting an old project to work on the new compiler.
  • Advertisement