|
|
2 місяців тому | |
|---|---|---|
| .github | 2 місяців тому | |
| .sublime | 2 місяців тому | |
| api_doc_builder | 2 місяців тому | |
| examples | 2 місяців тому | |
| handle_map | 6 місяців тому | |
| .gitignore | 2 місяців тому | |
| LICENSE | 7 місяців тому | |
| README.md | 2 місяців тому | |
| TODO.md | 2 місяців тому | |
| karl2d.doc.odin | 2 місяців тому | |
| karl2d.odin | 2 місяців тому | |
| render_backend_chooser.odin | 2 місяців тому | |
| render_backend_d3d11.odin | 2 місяців тому | |
| render_backend_d3d11_default_shader.hlsl | 4 місяців тому | |
| render_backend_gl.odin | 2 місяців тому | |
| render_backend_gl_default_fragment_shader.glsl | 2 місяців тому | |
| render_backend_gl_default_vertex_shader.glsl | 2 місяців тому | |
| render_backend_gl_windows.odin | 4 місяців тому | |
| render_backend_interface.odin | 2 місяців тому | |
| render_backend_nil.odin | 2 місяців тому | |
| render_backend_webgl.odin | 2 місяців тому | |
| roboto.ttf | 5 місяців тому | |
| window_interface.odin | 2 місяців тому | |
| window_interface_chooser.odin | 2 місяців тому | |
| window_js.odin | 2 місяців тому | |
| window_win32.odin | 2 місяців тому |
The first beta is almost here! Come back in a day or two...
Karl2D is a library for creating 2D games using the Odin programming language. The focus is on being fun and beginner-friendly, without the beginner-friendliness causing issues when you need to ship the game.
See karl2d.doc.odin for an API overview.
Here's a minimal "Hello world" program:
package hello_world
import k2 "karl2d"
import "core:log"
main :: proc() {
context.logger = log.create_console_logger()
k2.init(1920, 1080, "Hellope!")
for !k2.shutdown_wanted() {
k2.new_frame()
k2.process_events()
k2.clear(k2.LIGHT_BLUE)
k2.draw_text("Hellope!", {10, 10}, 100, k2.BLACK)
k2.present()
free_all(context.temp_allocator)
}
k2.shutdown()
}
See the examples folder for a wide variety of example programs.
Discuss and get help in the #karl2d channel on my Discord server.
Karl2D is currently in its FIRST BETA period. This first beta has these features:
This first beta does NOT have the following features, but they are planned in the order stated:
Here are some things I want to get feedback on:
Is the k2.new_frame() concept OK? I was thinking of merging new_frame() and process_events(),
but something tells me that some people may want to move their event processing around. Initially
I was toying with the idea to have the user use core:time and figure out dt etc themselves,
but that was not good for first-user experience.
How do people think that DPI scaling should work? I've had bad experiences with high DPI mode
Raylib. So I've gone for an idea where you always get everything in native coords and then you
scale yourself using the number returned by k2.get_window_scale()
Because of how web builds need init and step to be split up, I also split the examples up this
way, so we can use them both on desktop and on web. This sometimes made them a bit more chatty.
For example, I had to move some variables to the global scope. Should I approach this differently?
Is it annoying that the documentation file karl2d.doc.odin has a real .odin file extension? I like that it gets syntax highlight for everyone etc. But it can also be a bit disruptive it "go to symbol" etc. Perhaps I should chance it to .odin_doc or something.
Join my Discord server and let me know in the #karl2d channel what you think! Here's the invite: https://discord.gg/4FsHgtBmFK
The API was originally based on Raylib API, because I like that API. But I have changed things I don't like about Raylib and made the API more Odin-friendly. The implementation is meant to have as few dependencies as possible (mostly core libs and some libraries from vendor). The web builds do not need emscripten, it uses Odin's js_wasm32 target.
Since I have shipped an actual game using Odin + Raylib, I am in a good position to know what worked well and what worked less well. I have tried to put that experience into this library.
Logo by chris_php