mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 11:12:29 +00:00
feat(gx): add incomplete 'CGxDeviceGLSDL' (#2)
* chore(build): add vendored SDL 3.0.0 library * chore(build): add vendored glew-cmake-2.2.0 library * feat(console): in the presence of -opengl launch flag, change GxApi to OpenGl * feat(gx): add uncompleted CGxDeviceGLSDL targeting Windows and Linux * chore(build): change SDL3 linkage from shared (bad) to to static (good)
This commit is contained in:
parent
934e0fb600
commit
706c8903a1
2043 changed files with 663533 additions and 5 deletions
37
vendor/sdl-3.0.0/cmake/xxd.py
vendored
Normal file
37
vendor/sdl-3.0.0/cmake/xxd.py
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(allow_abbrev=False, description="Convert file into includable C header")
|
||||
parser.add_argument("--in", "-i", type=pathlib.Path, metavar="INPUT", dest="input", required=True, help="Input file")
|
||||
parser.add_argument("--out", "-o", type=pathlib.Path, metavar="OUTPUT", dest="output", required=True, help="Output header")
|
||||
parser.add_argument("--columns", type=int, default=12, help="Column count")
|
||||
args = parser.parse_args()
|
||||
|
||||
t = pathlib.Path()
|
||||
varname, _ = re.subn("[^a-zA-Z0-9]", "_", str(args.input.name))
|
||||
|
||||
binary_data = args.input.open("rb").read()
|
||||
|
||||
with args.output.open("w", newline="\n") as fout:
|
||||
fout.write("unsigned char {}[] = {{\n".format(varname))
|
||||
bytes_written = 0
|
||||
while bytes_written < len(binary_data):
|
||||
col = bytes_written % args.columns
|
||||
if col == 0:
|
||||
fout.write(" ")
|
||||
column_data = binary_data[bytes_written:bytes_written+args.columns]
|
||||
fout.write(", ".join("0x{:02x}".format(d) for d in column_data))
|
||||
bytes_written += len(column_data)
|
||||
if bytes_written < len(binary_data):
|
||||
fout.write(",\n")
|
||||
else:
|
||||
fout.write("\n")
|
||||
fout.write("}};\nunsigned int {}_len = {:d};\n".format(varname, len(binary_data)))
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue