Commit graph

151 commits

Author SHA1 Message Date
Charlie
8d081c1afe Merge branch 'dev' 2024-07-07 20:45:45 +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
83c0371dcb Rework Gfx_Image stuff 2024-07-07 09:09:01 +02:00
Charlie
ebaa52c326 Naive hash table & tests 2024-07-06 15:50:16 +02:00
randy
4e900b0121
Update README.md 2024-07-05 11:45:07 +07:00
randy
7e09bef412
Update README.md 2024-07-05 10:05:53 +07:00
randy
d69532146d readme 2024-07-05 08:20:31 +07:00
randy
711f9c9010 educational license 2024-07-05 06:54:09 +07: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
4c5f882999 Fixy smixy 2024-07-04 12:19:51 +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
randy
1d33a0e4e6 included workspace for easier setup 2024-07-04 09:37:04 +07:00
randy
1fba52ad7a commit .vscode for easier setup 2024-07-04 09:35:03 +07:00
randy
0fad72aa09 build_clang -> build 2024-07-04 09:21:39 +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
randy
238be066ba entity megastruct init 2024-07-03 17:56:19 +07:00
Charlie
b07c2f3160 Simplify simd 2024-07-03 11:21:48 +02:00
randy
82ada8e9e0 lesson2, projection & view settings 2024-07-03 12:40:21 +07:00
Charlie
aceadf4aca Fix simd & Vector oopsies + lots of tests 2024-07-03 00:41:52 +02:00
Charlie
e52e1a403e I got very sidetracked.
- cpu.c to query cpu capabilities and intrinsics
- In init, find best available simd instruction sets and assign simd function ptrs accordingly.
- Replace basic vector arithmetic procs with simd implementations
2024-07-03 00:01:11 +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
6519955513 v2_normalize 2024-07-02 14:38:17 +07: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
f66e89087e color.c utils 2024-07-02 12:48:05 +07:00
randy
b2758db850 entry -> test_game 2024-07-02 11:32:21 +07:00
randy
d916c86995 removed CL builds 2024-07-02 10:56:00 +07:00
Charlie
ea37ceb3bd Explicit allocators 2024-07-01 13:10:06 +02:00
randy
bf32265517 hex_to_rgba helper 2024-07-01 17:22:22 +07:00
randy
be6c99dfc5 made clear_col a vector4 2024-07-01 17:22:10 +07:00
randy
dc8c992d4c changed to 16:9 2024-07-01 16:59:25 +07:00
randy
5e571d6753 art init 2024-07-01 16:58:56 +07:00
randy
b8982fad60 build if 2024-07-01 16:58:56 +07:00
Charlie
3e4ddda186 Rotations fixy smixy 2024-07-01 11:50:02 +02: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
Charlie
09553f1e3b Same for sprint and tprint 2024-06-28 21:57:37 +02:00
Charlie
b8ae348ed9 Make print a macro so we don't need to do const_string on fmt strings 2024-06-28 21:39:55 +02:00
Charlie
41795425d0 Build with clang (& fix stuff so it compiles with clang 2024-06-28 19:10:29 +02:00
Charlie
db73d0bd2e - Basic fixed-length string with replacement for C standard printing & fmt stuff
- Jai-like print procedures
	- %s formats 'string' and to format a char* you do %cs
	- It detects if %cs pointer is outside of program memory or stack and asserts
	- AND same for if a char* is passed to %s
	- Print directly writes to stdout without any allocations
	- Basic utlity procedures
	- Buncha string tests
- Beef up assert to display file & line as well
- Don't define memcpy procedures if compiler has intrinsics for them
- Init memory arena for allocations in initialization time before heap is ready (stack memory)
- os_compare_and_swap
- Spinlock "primitive" (wrapper around a bool using compare_and_swap)
- Switched to using spinlock instead of os mutex in heap for synchronization.
- is_pointer_valid() which checks if address is in program_memory or thread stack
2024-06-28 18:50:30 +02:00
Charlie
49ca7f3406 Oogaboogafy main() 2024-06-28 12:16:48 +02:00
Charlie
68d1efb759 - Start work on string library
- Dyamically load minimum crt symbols in os backend so we don't need to #include c headers
- Some more os calls:
	- write to stdout (with our string type)
	- macros for variadic argument lists
	- Dynamic library loading
2024-06-28 12:07:02 +02:00
Charlie
98feda0cbb - build.c which includes everything to be built and configures build with #defines
- Some compile options that make sense for build.bat, and a build_release.bat
- oogabooga:
	- Big buffer program_memory that always has same base address (goodbye serialisation problems)
		- Big buffer grows as needed, crash when out of memory
	- Very sexy platform abstraction & basic os call procedures
	- Heap allocator around the program memory.
    - Jaiyfication (context, context.allocator, push_allocator, temp allocator)
	- Some tests to make sure we ooga the right boogas
2024-06-28 03:28:23 +02:00