بدون توضیح

Karl Zylinski 18b671f7d6 Update README.md 2 ماه پیش
.github 6be8507d02 Make ci check instead of build 2 ماه پیش
.sublime bbe67632be A few color changes 2 ماه پیش
api_doc_builder 2355e776cd Docs 2 ماه پیش
examples 18391a91e3 Font_Handle -> Font 2 ماه پیش
handle_map c994c4c77b Some kind of texture handle concept 6 ماه پیش
.gitignore eaf7a6338d JS mouse events and bunnymark that works in browser 2 ماه پیش
LICENSE 361c3c9672 Snake example 7 ماه پیش
README.md 18b671f7d6 Update README.md 2 ماه پیش
TODO.md e929de5497 todo 2 ماه پیش
karl2d.doc.odin 502771f91d doc fix 2 ماه پیش
karl2d.odin b204807c4f Docs 2 ماه پیش
render_backend_chooser.odin 0bac2e5a50 Better render backend naming 2 ماه پیش
render_backend_d3d11.odin 0bac2e5a50 Better render backend naming 2 ماه پیش
render_backend_d3d11_default_shader.hlsl 3d076f7bf5 Rename default hlsl shader 4 ماه پیش
render_backend_gl.odin 0bac2e5a50 Better render backend naming 2 ماه پیش
render_backend_gl_default_fragment_shader.glsl 4ec00f3e66 Use 300 es shader for default gl/webgl shader (works with both APIs) 2 ماه پیش
render_backend_gl_default_vertex_shader.glsl 4ec00f3e66 Use 300 es shader for default gl/webgl shader (works with both APIs) 2 ماه پیش
render_backend_gl_windows.odin 13490b536d Enable vsync on gl-windows 4 ماه پیش
render_backend_interface.odin 100d2362e2 Render texture support in GL 2 ماه پیش
render_backend_nil.odin 29c7af8a60 Render texture support for webGL 2 ماه پیش
render_backend_webgl.odin 787c8b342b Use CheckFramebufferStatus in webgl (added it to bindings) 2 ماه پیش
roboto.ttf 3cc43427a0 Some basic font rendering 5 ماه پیش
window_interface.odin 6c2c299d69 Some initial work on JS windowing interface and WebGL backend -- not even half done! 2 ماه پیش
window_interface_chooser.odin 6c2c299d69 Some initial work on JS windowing interface and WebGL backend -- not even half done! 2 ماه پیش
window_js.odin 8e60a70482 JS wheel event 2 ماه پیش
window_win32.odin 1c4ab18c9b more clear screen_width/height name 2 ماه پیش

README.md

karl2d_logo

Karl2D is a library for creating 2D games using the Odin programming language. The focus is on being beginner-friendly, without the beginner-friendliness causing issues when you need to ship the game.

Discuss and get help in the #karl2d channel on my Discord server: https://discord.gg/4FsHgtBmFK

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.

FIRST BETA

Karl2D is currently in its FIRST BETA period. This first beta has these features:

  • Rendering of shapes, textures and text
  • Support for shaders and cameras
  • Windows support (D3D11 and OpenGL)
  • Web support (WebGL)
  • Input: Mouse, keyboard, gamepad

This first beta does NOT have the following features, but they are planned in the order stated:

  • Linux
  • Sound
  • System for cross-compiling shaders between different backends (HLSL, GLSL etc)
  • Mac (metal)

Feedback wanted

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?

Join my Discord server and let me know in the #karl2d channel what you think! Here's the invite: https://discord.gg/4FsHgtBmFK

Is this a Raylib clone?

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.

Have fun!

Logo by chris_php