If you want to limit your FPS then you could do some sort of test before each frame is drawn to make sure that you''re drawing the frames at the correct time intervals (using one of the many time functions).
However calculating the FPS means that you''re just counting how many frames passed during the last second.
I will not make a list of links... I will not make a list of links... I will not make a list of links...
Invader''s Realm
FPS?
Hey, I found something! FPS makes this triangle look better!
If I don''t use fps loop, the border around the polygon blinks! Is this one reason to use fps: to make better graphics?
I don''t see how the fps is making it stop blinking though!
----------
Take it to the Xtreme!
----------
#define WIN32_LEAN_AND_MEAN#include <windows.h>LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){ PAINTSTRUCT ps; HDC hdc; switch(msg) { case WM_CREATE: { return(0); } break; case WM_PAINT: { hdc = BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); return(0); } break; case WM_DESTROY: { PostQuitMessage(0); return(0); } break; default:break; } return(DefWindowProc(hwnd, msg, wparam, lparam));}int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int nshowcmd){ WNDCLASSEX winclass; HWND hwnd; MSG msg; HDC hdc; winclass.cbSize = sizeof(WNDCLASSEX); winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; winclass.lpfnWndProc = WindowProc; winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hInstance = hinstance; winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); winclass.hCursor = LoadCursor(NULL, IDC_ARROW); winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); winclass.lpszMenuName = NULL; winclass.lpszClassName = "WINCLASS1"; winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&winclass)) return(0); if(!(hwnd = CreateWindowEx(NULL, "WINCLASS1", "My Awesome Window!", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0,0, 500,500, NULL, NULL, hinstance, NULL))) return(0); while(1) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } hdc = GetDC(hwnd); DWORD start_time = GetTickCount(); //Create a pen HPEN white_pen = CreatePen(PS_SOLID, 1, RGB(255,255,0)); HPEN first_pen = (HPEN)SelectObject(hdc, white_pen); //Create a brush HBRUSH white_brush = CreateSolidBrush(RGB(255,0,0)); HBRUSH first_brush = (HBRUSH)SelectObject(hdc, white_brush); //Get ready to draw the triangle POINT poly[4] = {20,20,20,390,390,20,20,20}; Polygon(hdc, poly, 4); while((GetTickCount() - start_time) < 33); SelectObject(hdc, first_pen); SelectObject(hdc, first_brush); DeleteObject(white_pen); DeleteObject(white_brush); //Let go of the Device Context ReleaseDC(hwnd, hdc); }//while loop return(msg.wParam);}//winmain
If I don''t use fps loop, the border around the polygon blinks! Is this one reason to use fps: to make better graphics?
I don''t see how the fps is making it stop blinking though!
----------
Take it to the Xtreme!
----------
Wachar's Eternity <-<-<-<-<- Me own site!
Ack, Wachar, you sound like you are confused about FPS...you don''t USE FPS, you can CALCULATE them, or set a limit for your FPS, but you don''t use them in the sense you seem to mean. Calculating the FPS is checking the number of times your game runs through the main game loop every second...understand?
So, what does increasing the number of times your loop goes through the main game loop do?
----------
Take it to the Xtreme!
----------
----------
Take it to the Xtreme!
----------
Wachar's Eternity <-<-<-<-<- Me own site!
If you increase the number of times you go through the loop per second, your game screen is updated faster, allowing for smoother looking animation. If you limit the FPS, you only allow the screen to be updated that many times per second. If all you''re doing is calculating the FPS, there shouldn''t be a visual difference, as all that''s going on is that you are being told how many frames are shown every second...
So if you used while((GetTickCount() - start_time) < 500), it would look very smooth?
----------
Take it to the Xtreme!
----------
----------
Take it to the Xtreme!
----------
Wachar's Eternity <-<-<-<-<- Me own site!
Oh come on people, he is obviously just playing around with you all.
"I am governed by none other than the Laws of the Universe."
"I am governed by none other than the Laws of the Universe."
"I am governed by none other than the Laws of the Universe."
I''m really sorry to be discouraging, but this is probably the saddest progression of discussion I''ve seen in a long time.
However, I will not expound upon my frustrations here, and we''d all be better off if those who feel like being malicious would do the same.
Wachar: Bud, the only advice I can give you is, think about it.
Also, to answer your question, I believe that line would make your game run at 2 FPS. No, it wouldn''t be smooth. At that rate, it wouldn''t even be considered interactive.
Peace,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[if you have a link proposal, email me.]
However, I will not expound upon my frustrations here, and we''d all be better off if those who feel like being malicious would do the same.
Wachar: Bud, the only advice I can give you is, think about it.
Also, to answer your question, I believe that line would make your game run at 2 FPS. No, it wouldn''t be smooth. At that rate, it wouldn''t even be considered interactive.
Peace,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[if you have a link proposal, email me.]
[twitter]warrenm[/twitter]
quote: Original post by i8degrees
Oh come on people, he is obviously just playing around with you all.
If that''s the case then I hope he ceases and dissists. He''s using valuable time, and I''ll do everything I can to get him permanently banned.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[if you have a link proposal, email me.]
[twitter]warrenm[/twitter]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement