blah/README.md

55 lines
1.8 KiB
Markdown
Raw Normal View History

2020-08-26 15:38:59 +08:00
## blah
2020-08-28 09:06:48 +08:00
a small C++ game framework for 2D games.
2020-08-28 09:16:01 +08:00
2020-08-28 09:06:48 +08:00
this will likely see breaking changes.
2020-08-26 15:38:59 +08:00
2020-08-29 12:11:43 +08:00
#### prerequisites
2020-08-28 09:06:48 +08:00
- A C++17 compiler and CMake
2020-12-24 16:21:38 +08:00
- Only an SDL2 `platform backend` [is done](https://github.com/NoelFB/blah/blob/master/private/blah/internal/platform_backend_sdl2.cpp). CMake will need to find SDL2 via `SDL2_INCLUDE_DIRS` and `SDL2_LIBRARIES`
- Only an OpenGL `graphics backend` [is done](https://github.com/NoelFB/blah/blob/master/private/blah/internal/graphics_backend_gl.cpp), so it requires OpenGL.
2020-08-29 12:11:43 +08:00
2020-08-28 11:19:46 +08:00
#### notes
2020-10-25 08:35:21 +08:00
- There's a custom "Vector" and "StackVector" classes that are not full replacements for std::vector.
2020-08-28 09:19:48 +08:00
- There's no Shader abstraction, so the [Sprite Batcher](https://github.com/NoelFB/blah/blob/master/public/blah/drawing/batch.h) has hard-coded GLSL. This will need to change.
2020-08-28 09:16:01 +08:00
- The rendering layer may be replaced with [FNA3D](https://github.com/FNA-XNA/FNA3D), [BGFX](https://github.com/bkaradzic/bgfx), [Sokol](https://github.com/floooh/sokol), or something else.
2020-08-28 09:11:51 +08:00
- There's no Audio layer implementation yet.
2020-08-28 11:26:41 +08:00
- No threaded rendering so the OpenGL implementation will explode if you try that
2020-08-28 11:19:46 +08:00
#### a sample application
```cpp
#include <blah.h>
using namespace Blah;
Batch batch;
void render()
{
Graphics::clear(Graphics::backbuffer, 0x00000000);
2020-08-28 11:23:26 +08:00
Vec2 center = Vec2(App::draw_width(), App::draw_height()) / 2;
float rotation = Time::elapsed * Calc::TAU;
Mat3x2 transform = Mat3x2::create_transform(center, Vec2::zero, Vec2::one, rotation);
batch.push_matrix(transform);
2020-08-28 11:19:46 +08:00
batch.rect(Rect(-32, -32, 64, 64), 0xff0000);
batch.pop_matrix();
batch.render(Graphics::backbuffer);
batch.clear();
}
int main()
{
Config config;
config.name = "blah app";
config.width = 1280;
config.height = 720;
config.on_render = render;
App::run(&config);
return 0;
}
```