Commit graph

55 commits

Author SHA1 Message Date
8c2d878ead Entity stuff 2024-08-28 15:54:40 +01:00
Charlie Malmqvist
a296f2c660 Sprite sheet animation and window woopsie fix 2024-08-23 18:13:02 +02:00
Charlie Malmqvist
1b200bd162 gfx_read_image_data() 2024-08-23 15:57:35 +02:00
Charlie Malmqvist
b7921693c4 Os monitors query 2024-08-21 20:17:05 +02:00
Charlie Malmqvist
9664530935 Text wrapping, string & utf8 helpers, linmath constants 2024-08-19 16:19:46 +02:00
Charlie Malmqvist
b231b58247 Gamepad input 2024-08-19 13:29:36 +02:00
Charlie Malmqvist
a2b65c0eaf os_get_elapsed_seconds() & some unecessary refactoring 2024-08-18 12:51:33 +02:00
Charlie Malmqvist
71708cfc77 More unused memory locking 2024-07-28 17:17:58 +02:00
Charlie Malmqvist
f9788b2e74 Some memory rework, concurrency improvements, cleanups 2024-07-28 15:08:36 +02:00
Charlie Malmqvist
e60be463d1 Did nothing 2024-07-27 21:07:52 +02:00
Charlie Malmqvist
234e3ed440 Mouse pointers & text rendering bug 2024-07-26 21:33:47 +02:00
Charlie Malmqvist
c7daaac338 Growing array + tests + growing_array_example.c 2024-07-23 21:18:27 +02:00
Charlie Malmqvist
4aa832a822 Refactor more to be able to build as dll and link a single global oogabooga instance, and made an example for a hot loaded game 2024-07-23 17:33:11 +02:00
Charlie Malmqvist
9338ec248b Improve shader example for outlined rect + outlined circle 2024-07-22 21:12:08 +02:00
Charlie Malmqvist
e61a294960 Conditionally compile oogabooga global state instance with OOGABOOGA_LINK_EXTERNAL_INSTANCE 2024-07-22 19:19:57 +02:00
Charlie Malmqvist
9f5d20d3de Cleanup 2024-07-22 16:49:10 +02:00
Charlie Malmqvist
88053ab14a v0.01.001 - Spacial audio, custom shading, scissor boxing 2024-07-20 16:10:55 +02:00
Charlie Malmqvist
2aba15b429 Custom shaders 2024-07-19 16:45:58 +02:00
Charlie Malmqvist
9def6cb22b Readme updates, d3d11 impl #Cleanup's 2024-07-17 13:34:52 +02:00
Charlie Malmqvist
507fa87de1 test 2024-07-16 14:11:00 +02:00
Charlie
c6bf5bc8bb Spacial audio, draw_line, vector procs 2024-07-16 10:00:04 +02:00
Charlie
c39902d6b1 v0.01.000 - AUDIO! 2024-07-15 21:40:27 +02:00
Charlie
2b335aee35 Sold my soul to play monlight sonata
Audio sources & decoding are pretty much done and working well.

Playback is not really implemented yet, I'm just hacking in a way to output an audio source.

- Seriously microsoft wtf
2024-07-12 21:11:47 +02:00
Charlie
e1aafd8220 0.00.005 2024-07-11 20:38:26 +02:00
Charlie
2a843fe7aa - Fixed crashing when D3D11 DEBUG flag fails in ID3D11CreateDevice, and instead log a descriptive error then continue as usual
- Stuff
2024-07-11 20:35:35 +02:00
Charlie
c92b6fd4b7 - Z Layers
- Sorting
- Contiguous quad buffer
2024-07-10 17:10:38 +02:00
Charlie
b37652e1ce v0.00.004 - Custom logging, more concurrency & bugfixing
Concurrency:
	- Refactored spinlock out of OS api (deprecated old procs)
	- Concurrency utilites:
		void spinlock_init(Spinlock *l);
		void spinlock_acquire_or_wait(Spinlock* l);
		bool spinlock_acquire_or_wait_timeout(Spinlock* l, f64 timeout_seconds);
		void spinlock_release(Spinlock* l);
		void mutex_init(Mutex *m);
		void mutex_destroy(Mutex *m);
		void mutex_acquire_or_wait(Mutex *m);
		void mutex_release(Mutex *m);
		void binary_semaphore_init(Binary_Semaphore *sem, bool initial_state);
		void binary_semaphore_destroy(Binary_Semaphore *sem);
		void binary_semaphore_wait(Binary_Semaphore *sem);
		void binary_semaphore_signal(Binary_Semaphore *sem);
		Macro MEMORY_BARRIER
	- Concurrency tests

Docs:
	- custom_logger.c example to show how one can make a custom logger and have logs displayed in-game

Utility:
	- draw_text_and_measure() which is just an overload of draw_text but it also does a measure and returns it

Misc:
	- Added u64 thread_id to global context. This is set in main() for main thread and in thread startup when you dispatch a Thread
	- Fixed a bug where plain rects would be drawn with the incorrect color
	- Fixed a bug where quads from earlier frames would be drawn
2024-07-09 18:38:06 +02:00
Charlie
a805557a76 Fixed memory bug & window placement
- Improved assert messages to be more clear about what might be happening if they fail
- Added more checks in debug to detect heap corruption and what not
- Fixed a bug where the program would crash because a heap block was perfectly full
- Fixed Y placement of window when changing the window rect
- Fixed window sizing when setting scaled_width or scaled_height
- Updated readme
2024-07-08 17:57:23 +02:00
Charlie
aee3f78bd5 Add minimal libraries for decoding audio 2024-07-08 15:33:01 +02:00
Charlie
21482f2df2 Dev mode 2024-07-07 20:46:57 +02:00
Charlie
3d781e0bd1 v0.00.002 - Text rendering, image manipulation, hash tables 2024-07-07 20:44:40 +02:00
Charlie
18f4fc8123 - Text rendering
- Font loading
	- Measuring for formatting & justification
	- Utf8 Glyph walking
	- Commented example in oogabooga/examples/text_rendering.c
- Small 2D renderer refactor
	- Pass 8-bit integers "type" and "sampler_index" to shader
	- Sample texture differently depending on "type" (text or regular quad)
	- Sample with nearest/linear min/mag depending on sampler_index
	- Set min/mag filtering in Draw_Quad
	- Images are now created and deleted directly with gfx calls rather than deferring it for gfx_update.
	- We can now set image sub data with gfx_set_image_data()
	- Images are no longer hard coded to 4 channels
- Utf8 utility:
	- utf8_to_utf32(): convert utf8 bytes to a single u32 codepoint
	- next_utf8(): Convert first utf8 character in a string to a u32 codepoint and advance the passed string to the next unicode
- Renamed m4_multiply -> m4_mul for consistency
- Refactored os window to be DPI aware (scaled_width vs pixel_width)
- in minimal example, renamed hammer_xform -> rect_xform
2024-07-07 20:27:34 +02:00
Charlie
ebaa52c326 Naive hash table & tests 2024-07-06 15:50:16 +02:00
Charlie
05919248eb - Replace lodepng with stb_image (& add stb_truetype for fonts)
- Fix d3d11 Input assembler not being created correctly bug
- Fix framerate being locked by swap chain present
- Move enable_vsync to window
- sqrt & rsqrt simd
- Add release build & run in vscode tasks & launch
- Cleanup
2024-07-04 20:56:27 +02:00
Charlie
5db73b90e9 Fixy smixy 2024-07-04 12:18:16 +02:00
Charlie
439f00caf4 Merge 2024-07-04 12:13:40 +02:00
randy
6134c6e982 build project swap example (volatile with tutorial) 2024-07-04 10:20:35 +07:00
Charlie
546f8af3d4 - Fixed bug in ALLOCATOR_REALLOC corrupting memory/returning invalid address
- Added asserts to make sure we detect similar bugs faster
- Made simd shippable & configurable
- Some documentation in oogabooga.c on configuration
- Very optimized release build script
- Cleaned some stuff up
2024-07-03 17:55:25 +02:00
Charlie
b07c2f3160 Simplify simd 2024-07-03 11:21:48 +02:00
Charlie
aceadf4aca Fix simd & Vector oopsies + lots of tests 2024-07-03 00:41:52 +02:00
Charlie
1f2809d23e Ooga'd some boogas 2024-07-02 19:12:31 +02:00
Charlie
b15c7c6e41 - Fixed D3D11 eating 40000000 cycles for no reason (Thank you Bill Gates)
- Refactor drawing to keep blocks persistent in memory
- Make string usage easier & more consisten (macros for string vs const char*)
- rdtsc intrinsic (get cycle count)
- Profiling macros (generates a google trace json)
- Write D3D11 debug messages to stdout
- String_Builder & thorough tests for it
2024-07-02 15:27:33 +02:00
randy
69d8f66e22 basic player move init, lesson #1 2024-07-02 14:36:47 +07:00
randy
9866eae1b8 project swapping setup 2024-07-02 12:48:28 +07:00
randy
b2758db850 entry -> test_game 2024-07-02 11:32:21 +07:00
Charlie
b9503d8d19 - D3D11, Image drawing & Matrix4 xform drawing
- I didn't get rotation going quite right with the xform, but it's 2am goodnight
	- Smashed my head and had bad thoughts about microsoft many times

- stuff
- lotsa example code in entry.c
2024-07-01 02:14:08 +02:00
Charlie
6879130bb0 - File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
	- os_file_close(File f)
	- os_file_delete(string path)
	- os_file_write_string(File f, string s)
	- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
	- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
	- os_write_entire_file_handle(File f, string data)
	- os_write_entire_file(string path, string data)
	- os_read_entire_file_handle(File f, string *result)
	- os_read_entire_file(string path, string *result)
	- fprint(File, string/char*, ...)
	- Buncha tests

- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
Charlie
8a0fc81576 - User input
- Input state polling & consuming
		- is_key_down, is_key_just_pressed, is_key_just_release
		- consume_key_down, consume_key_just_pressed, consume_key_just_released
	- Input events
		- Key event
		- Scroll event
		- Text event
- unicode.c
	- utf16_to_utf32
2024-06-29 17:54:30 +02:00
Charlie
c61f216d37 - Simple rectangle drawing
- We just add to a frame of quads which the renderer deals with in gfx_update
	- draw_quad, draw_rect, draw_rect_rotated
	- Currently just implemented with legacy opengl, so we can't do custom shading
- Added third party code from lodepng so we can load pngs without any other dependencies (no C includes)
- ALLOCATOR_REALLOCATE
- Basic Vector2, Vector3, Vector4 stuff, and some math utilities
- Added <math.h> dependency for now.
- Graphics renderer frontend layer
- Naive get_random() implementation
2024-06-29 13:27:37 +02:00
Charlie
8489421dbf Got a window going 2024-06-29 01:18:22 +02:00