Comments (5)
@albertvaka This is a design decision to use simple int for enums. Agree with @colesnicov @RobLoach commented points.
Just for completion, here a list of some unpopular raylib design decisions (critisized multiple times):
Technical decisions
- No prefixes
- No pointers, data mostly passed by value
- No typed enum values
- No
size_t
for sized values - No return error codes (with some exceptions)
- No advance/engine features: lighting, PBR, physics...
Non-technical design decisions
- No formal docs: use cheatsheet + examples
- No backward compatibility between releases (minor breaking changes)
- No youtube tutorials
- No reference books
from raylib.
Yeah, you'll see that a lot. Previously, enums were somehow not used in 'C', definitions were given priority and they are numerical.. Because the compiler doesn't care if it's an enum or a define, both are numerical.. C++ is strictly type-controlled, 'C' is a little more permissive
from raylib.
While they're somewhat the same, using an int
makes it easier to bind to other languages. Parsers don't need to map the enums before use, and the compiler doesn't mind.
from raylib.
@raysan5
So, since it's already here, I'll ask if you have a summary somewhere, why don't you use
pointers
but pass by value- why no
prefix
?
As for lightning
, physics
,.. that's clear. You didn't make a new Unity, but a lightweight cross-platform library that makes it easier to create simple games...
Error codes
, what could go wrong? Am I entering the wrong data? I have to take care of that myself.
I personally don't like using `size_t' either, it doesn't always have to be suitable.
You don't have to write it down here, but if you've already had a discussion like this somewhere and could post a link, I'd read it. Just out of curiosity.
from raylib.
@colesnicov Most of the original desing decisions were for simplicity. Library was intended to teach art students with no previous coding experience so I tried to minimize as much as possible elements that could add complexity to syntax and code.
About prefixes, the course syllabus was raylib
--> MonoGame
--> Unity
so keeping the same naming conventions between the 3 technologies was a good idea; my previous gamedev experience was also with MonoGame/C# and personally I didn't like prefixes.
About error codes, it looked way more simple, clean an intuitive to me that a LoadTexture()
returned a Texture
instead of an error code and a texture by reference. Same for other similar functions.
As said, most of the decisions were taken towards simplicity, despite I understand that most advance programmers could find them somewhat unconfortable.
from raylib.
Related Issues (20)
- [core] RPI Opengl - Wrong DRM connector? HOT 14
- [core] Should the defines MAX_* be part of the public API? HOT 5
- [rcore_desktop] Can't get size of the monitor before creating a window HOT 2
- [core] rlImGUI needs a way to consume input HOT 4
- [rcore] Calls to GetRandomValue(min, max) will always return min, if not call to InitWindow() HOT 1
- [core] PLATFORM_DRM rotate screen/window HOT 10
- Maybe possibly Invalid Default Texture? HOT 5
- requesting 5.0.1 version to fix incorrect PROJECT_VERSION in 5.0 HOT 2
- [rtextures] DDS / DXT1, DXT3 and DXT5: unit 0 GLD_TEXTURE_INDEX_2D is unloadable HOT 7
- [rcore] Replay record finish can't stop move (always keydown) HOT 2
- [rcore] The content can't be rendered correctly in fullscreen mode. HOT 3
- [rcore] `ToggleFullscreen()` not working as expected with HighDPI mode enabled HOT 2
- [rshape] Line drawing functions are no longer pixel-perfect HOT 1
- [rcore] Render issue when window is partially move outside of the monitor HOT 2
- [rcore] uncapped framerate not working properly with SDL platform HOT 3
- [rcore] Get keys that are pressed again, like chars HOT 1
- [rtextures.c] ColorToInt(RED) is UB HOT 12
- [raudio] WaveCrop() is broken HOT 1
- [rmodels] Read uninitialized values in `GenMeshTangents()` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raylib.