Commit Graph

57 Commits

Author SHA1 Message Date
sukibaby 934fc54b8a BitmapText::DrawPrimitives noexcept
This function indirectly determines the amount of average audio latency, this is why changes to BitmapText can affect global offset significantly. Aim to make the function as fast as possible to minimize latency.

1) make BitmapText::DrawPrimitives noexcept
   -  note: RollingNumbers::DrawPrimitives has to also become noexcept as a consequence

2) Define repeated calculations as constexpr functions defined within an anonymous namespace

3) Fix some formatting stuff
2024-09-22 11:00:41 -07:00
sukibaby 21088502b9 Remove clamp macro
Doesn't really need to exist since  all it's doing is inlining std::clamp.
2024-09-03 20:50:48 -07:00
sukibaby 36892b4e56 Create RandomSeed.h (mt19937 RNG)
This exists to replace the use of RageTimer as a RNG seed, which results in fewer GetTimeSinceStart() calls and better entropy.
2024-08-07 10:05:13 -07:00
phantom10111 208494b735 Fix coloring of BitmapText with overlapping attributes
When AddAttribute() is called multiple times with overlapping ranges, old
attributes need to be removed and/or fixed. Otherwise the old colors might
show up when the text is rendered.
2024-04-09 00:34:47 -07:00
phantom10111 c0c0d58219 Fix coloring of multiline BitmapText
BitmapText internally stores characters with newlines removed, since they don't
need to be rendered. Due to this, BitmapText::AddAttributes() needs to
recalculate attribute positions and lengths in order to apply them in the
correct place. Unfortuantely the code would calculate the position incorrectly
and completely ignore length. Fix it so that everything is correct even in
multiline text.
2024-03-12 16:15:48 -07:00
Martin Natano bacecae1f7 Decouple <vector> 2023-04-21 22:13:41 +02:00
Martin Natano 78fb2e9fc3 Decouple <cstddef> 2023-04-20 11:21:29 +02:00
Martin Natano b68ca517e6 Clean up math functions
- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include

e.g. floorf(x) -> std::floor(x)
2023-04-19 19:31:40 +02:00
Brian Phlipot d079940fea Address PR feedback. 2023-02-02 11:54:17 -08:00
Brian Phlipot 4a6b1a743c Enable more compiler warnings and treat them as errors. 2023-02-02 11:54:17 -08:00
Michael Sundqvist 0cba3579de Remove global "using namespace std;" declarations, use "std::" prefixes on all std elements
Fix whitespace changes
2022-07-31 22:14:38 +02:00
teejusb 7e3789b131 Integrate C++11 branch into 5_1-new 2019-06-22 12:35:38 -07:00
ranma 1ca5809da5 Improve DrawQuads batching in the font render. (#1654)
Currently only identical glyphs are merged into one DrawQuads call.
This fixes the comparison so that all glyphs with the same texture can
be merged, which greatly improves the font rendering performance.
2018-03-10 11:44:45 -08:00
Flameshadowxeroshin e92c8f80a3 support for distance field fonts 2017-10-02 17:00:11 -05:00
Kyzentun Keeslala 9f40c6d044 Added mult_attrs_with_diffuse to BitmapText. Added some convenience macros to LuaBinding for generic get/set functions. Updated changelog. 2015-10-18 14:09:08 -06:00
Kyzentun 50ab63b573 Changed asserts and exceptions in Font to non-fatal error messages. Changed BitmapText::CropToWidth to ask the font how many glyphs will fit instead of removing one glyph at a time. 2015-02-27 17:38:30 -07:00
Ben "root" Anderson bde705ab0b Place characters of right-to-left alphabets correctly. 2015-02-22 22:05:27 -06:00
Kyzentun 4f95bf08ad Function chaining for actors and singletons. 2014-12-01 22:31:30 -07:00
Kyzentun 5487362902 Fixed ScreenPrompt::AnswerOnCommand metrics by calling LOAD_ALL_COMMANDS after the name was set. 2014-11-05 22:26:25 -07:00
Kyzentun 2834cded9e Created tween queue and functions for BitmapText so the stroke color can be tweened. 2014-11-01 18:49:48 -06:00
Kyzentun 33a9b042b2 Added MaxDimensionUsesZoom to BMT copy constructor. 2014-09-07 22:56:50 -06:00
freem 4f84621244 add missing return statement to max_dimension_use_zoom lua binding 2014-09-04 20:10:02 -05:00
Kyzentun b75679f3c1 Actually use the argument in SetMaxDimUseZoom. 2014-09-04 18:21:39 -06:00
Kyzentun c6f598890b Added max_dimension_use_zoom lua function to control whether an individual BitmapText uses the zoom in maxwidth calculations. 2014-09-04 18:04:51 -06:00
Kyzentun f2fdaa0cf5 Massively improved Config Key/Joy Mappings screen.
Warning is dismissable now, and cursor does not start in a position that will change a setting.
New special actions added:  ClearToDefault, ReloadFromDisk, SaveToDisk, SetListMode.  Exit is a special action.
Player is prompted to save when exiting screen instead of saving after every action.
Special actions fallback on Graphics/SMC action if they don't have their own.
Moved SMC overlay to Graphics/SMC warning.
Metrics for configuring input lock time, warning autodismiss time, lines visible, and NoSetListPrompt autodismiss time.
Header row added for cursor to start on.
ScreenMapControllers2 deleted as obsolete.
BitmapText:maxwidth changed to factor the zoom of the actor into the calculation.
2014-09-04 01:23:28 -06:00
sigatrev d8b86fa3c5 make internal diffuse apply to bmt attributes
diffuse from BitmapText attributes were not receiving internal diffuse
from their parent ActorFrames. This change waits until after the draw
cycle to reset the internal diffuse and glow, so any color applications
separate from generic diffuse can use the internal diffuse when desired.
2014-08-16 16:38:26 -05:00
Kyzentun 076d67132d Reverted BitmapText::LoadFromNode back to previous logic.
BitmapText now looks up font names in Fonts/ if the path doesn't resolve, so LoadFont is obsolete.
Added optional arg to ActorUtil::ResolvePath and GetAttrPath to make them not report an error when something is optional.
2014-07-29 12:09:40 -06:00
Kyzentun 273b76d3c7 ActorUtil::ResolvePath updated for error reporting. Changed BitmapText to work with either a font name or a path. ThemeManager::GetPathInfoRaw fixed to use correct error dialog. ThemeManager::GetPathInfo fixed to report correct error for missing theme elements. 2014-07-14 18:02:28 -06:00
Kyzentun 6cf23c4dc3 Changed many parts of GameCommand to improve error reporting. Fixed GameCommand setpref to not set when loading the command. Minor fix to ScreenOptionsExample.ini to explain that SongInCurrentSongGroup is unusable. CommonMetrics, CourseContentsList, HoldJudgent, OptionRowHandler all have minor changes to fix crashes on malformed theme data. 2014-07-14 15:41:04 -06:00
Kyzentun 026f968fa4 Changed many uses of Dialog::OK and LOG->Warn to use ReportScriptError. 2014-07-07 00:39:27 -06:00
Devin J. Pohly 59674ad6f2 BitmapText: check both File and Font as path
Allow BitmapText to specify font from Theme/Fonts as well as locally,
using either the Font or the old-style File attribute.
2014-02-20 10:59:49 -05:00
Kyzentun 88ad09d293 Added distort function to BitmapText. 2014-02-12 18:13:49 -07:00
Jason Felds 28e5148dec The big NULL replacement party part 5.
Right. ' = NULL' would get a lot of these.
2013-05-03 23:39:52 -04:00
Jason Felds ba59dd1656 The big NULL replacement party part 2.
This may take a bit. Trying to do this by operator/command.
2013-05-03 23:11:42 -04:00
Jason Felds 9f24627bf9 The big NULL replacement party part 1.
This is meant to be a safer alternative since
NULL can often be 0. Let's not rely on that.

And yes, I know this is a lot of files. This is
a safer thing to do in big commits vs for loops.
2013-05-03 23:01:54 -04:00
Jason Felds c67419ecc8 There goes the macro file.
This is one of my bigger commits in this branch.

Still, shouldn't cause a problem.
2013-05-01 23:54:39 -04:00
Jason Felds 181de94f3d Now the "simple" loops. 2013-04-28 16:43:50 -04:00
Jason Felds a15cbc431d War on -Werror, part 14: More hodgepodge. 2012-12-27 12:45:04 -05:00
Jason Felds e86aeb66a8 war on -Werror, part 10: more informals. 2012-12-27 11:01:51 -05:00
Jason Felds a085d0d1da Line endings...be normalized! 2011-03-17 01:47:30 -04:00
Colby Klein bcd87f8c17 Disable setting texture states, leave a comment. 2011-03-08 10:58:35 -08:00
Colby Klein 70d59c1c9b Revert my original font change. I did mostly fix my optimization for it but it really was problematic. This whole block would probably have to be written differently. 2011-03-08 10:21:21 -08:00
AJ Kelly 76865a9a19 very minor whitespace removal 2011-03-02 01:19:53 -06:00
Colby Klein 5fe1ed811d Don't try to draw nothing. 2011-02-27 20:47:11 -08:00
Colby Klein e1e7db4758 Draw strings in batches. This results in glDrawArrays calls being dramatically reduced, although it's still not perfect. Note: This breaks drawing strings which use multiple maps. 2011-02-27 20:30:44 -08:00
AJ Kelly 8d4fa6a289 change comment order 2011-02-23 23:54:03 -06:00
Jason Felds 9d13036e08 Add @briefs to the Luna classes.
Yeah...there was a lot. */
2011-02-19 12:26:18 -05:00
Jason Felds 1bed6d3630 De-Python-ize REGISTER_ACTOR_CLASS(*). 2011-02-18 23:55:41 -05:00
AJ Kelly c630eea400 simplify textglowmode check 2011-01-11 14:12:39 -06:00
AJ Kelly acb9099c75 comment/cleanup 2010-06-30 00:04:52 -05:00