Search found 44 matches
- December 23rd, 2019, 4:18 am
- Forum: Everything
- Topic: Is there a proper way to calculate frame rate?
- Replies: 2
- Views: 1715
Is there a proper way to calculate frame rate?
The following code is how I calculate frame rate: [Game.h] FrameTimer ft; float totalFrameTime = 0.0f; int frameCounter = 0; float fps = 0.0f; [Game.cpp] void Game::Go() { gfx.BeginFrame(); UpdateModel(); ComposeFrame(); gfx.EndFrame(); frameCounter += 1; } void Game::UpdateModel() { totalFrameTime ...
- December 18th, 2019, 5:31 am
- Forum: Everything
- Topic: Question about benchmark time of optimized debug build
- Replies: 4
- Views: 1996
Re: Question about benchmark time of optimized debug build
Was the test code something you followed along with or downloaded from GitHub? Last I knew chili's proc was an old Intel server CPU, so cache speed/size and such may have given him an advantage in that regard. Tell ya what, upload a copy of your project to the forum and I'll run it and see what I g...
- December 18th, 2019, 2:29 am
- Forum: Everything
- Topic: Question about benchmark time of optimized debug build
- Replies: 4
- Views: 1996
Question about benchmark time of optimized debug build
The mean benchmark time of surface optimized debug build run on my computer is around 322 ~ 400 ms, which is much slower than chili's (his benchmark time is 54.2862ms). Why there are huge time gap between mine and chili's, and what should I do to improve the benchmark time? Upgrade my PC? Here are s...
- November 15th, 2019, 2:35 am
- Forum: Everything
- Topic: Question about scaling sprites
- Replies: 15
- Views: 7007
Re: Question about scaling sprites
I just finish my version few weeks ago. Thanks albinopapa for the tip. I'll share my version here. template<typename E> void DrawSprite(int x, int y, RectI source, const RectI& clip, const Surface& surface, E effect, float scale = 1.0f) { assert(source.left >= 0); assert(source.right <= surface.GetW...
- October 17th, 2019, 1:18 am
- Forum: Everything
- Topic: Question about scaling sprites
- Replies: 15
- Views: 7007
Re: Question about scaling sprites
Thanks for your advice. I think I'll finish Intermediate and Advanced lessons first!AleksiyCODE wrote: ↑October 16th, 2019, 4:17 pmI tried going through 3Dfundamentals while watching Intermediate. At about 3Dfund Ep7 I stopped and decided to finish Intermediate and advanced first. It seems that it is the way tutorials are ment to be watched
- October 16th, 2019, 6:54 am
- Forum: Everything
- Topic: Question about scaling sprites
- Replies: 15
- Views: 7007
Re: Question about scaling sprites
Here's the corrected version: template<typename E> void DrawSprite( int x, int y, RectI srcRect, const RectI& clipRect, const Surface& s, E effect, Graphics& _graphics, float scale = 1.f )noexcept { auto const srcScale = 1.f / scale; auto const scaledWidth = int( srcRect.GetWidth() * scale ); auto ...
- October 10th, 2019, 1:59 am
- Forum: Everything
- Topic: Question about scaling sprites
- Replies: 15
- Views: 7007
Re: Question about scaling sprites
scale = .9f; for (int dy = 0; dy < (int)ceil(.9f); dy++) { for (int dx = 0; dx < (int)ceil(.9f); dx++) Does this help? Basically, you are only iterating from 0 to 1 ( ceil( .9f ) = 1.f ). Your code works for scaling up because the ratio for the sprite pixel to screen pixel is 2:1 or something like ...
- October 10th, 2019, 12:48 am
- Forum: Everything
- Topic: Question about scaling sprites
- Replies: 15
- Views: 7007
Re: Question about scaling sprites
Thanks, I'll give it a look!AleksiyCODE wrote: ↑October 9th, 2019, 7:17 pmWell, i made a quick (shitty) animated sprite tester for my friend, and there is simple scaling built in (arrow keys change animation playback speed and size)
https://gitlab.com/AleksiyCODE/st
you may be able to get some ideas from there (but the code is shit)
- October 8th, 2019, 5:05 am
- Forum: Everything
- Topic: Question about scaling sprites
- Replies: 15
- Views: 7007
Question about scaling sprites
After learning Intermediate Tutorial 12 [Animated Sprite Character]. I want to add the scaling effect to the sprite, which you can enlarge or shrink sprites. My code seems okay when enlarge the sprites. However, I have invisible cover when I shrink the sprites. How do I fix it? Here is my code: #inc...
- June 25th, 2019, 2:55 am
- Forum: Everything
- Topic: Beginning C++ Tutorial 14
- Replies: 9
- Views: 4510
Re: Beginning C++ Tutorial 14
Hi, DrewAmu, please check the Solution Configuration is switched to "Debug".
If the solution configuration is release mode. The assertion check will be skipped
UPDATED:
Be sure your value of x in PutPixel is between 0 and 799, y is between 0 to 599
If the solution configuration is release mode. The assertion check will be skipped
UPDATED:
Be sure your value of x in PutPixel is between 0 and 799, y is between 0 to 599