get rid of modified raylib.h, do modifications in code
This commit is contained in:
parent
1051cd09e8
commit
c818fae902
6 changed files with 38 additions and 1517 deletions
2
raylib-c
2
raylib-c
|
@ -1 +1 @@
|
||||||
Subproject commit 33ed452439a6b28a39f190714e18ee5dcb2e7673
|
Subproject commit a1db0220a1582a568ce05257d1e5b602132602a1
|
|
@ -22,12 +22,44 @@ import os
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
ffibuilder = FFI()
|
ffibuilder = FFI()
|
||||||
|
|
||||||
|
def mangle(file):
|
||||||
|
result = ""
|
||||||
|
skip = False
|
||||||
|
for line in open(file):
|
||||||
|
line = line.strip().replace("va_list", "void *")+"\n"
|
||||||
|
if skip:
|
||||||
|
if line.startswith("#endif"):
|
||||||
|
skip = False
|
||||||
|
continue
|
||||||
|
if line.startswith("#if defined(__cplusplus)"):
|
||||||
|
skip = True
|
||||||
|
continue
|
||||||
|
if line.startswith("#endif // RAYGUI_H"):
|
||||||
|
break
|
||||||
|
if line.__contains__("GetTouchEvent"):
|
||||||
|
continue
|
||||||
|
if line.startswith("#"):
|
||||||
|
continue
|
||||||
|
if line.startswith("RLAPI"):
|
||||||
|
line = line.replace('RLAPI ', '')
|
||||||
|
if line.startswith("RAYGUIDEF"):
|
||||||
|
line = line.replace('RAYGUIDEF ', '')
|
||||||
|
if line.startswith("PHYSACDEF"):
|
||||||
|
line = line.replace('PHYSACDEF ', '')
|
||||||
|
result += line
|
||||||
|
print(line)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def build_linux():
|
def build_linux():
|
||||||
print("BUILDING FOR LINUX")
|
print("BUILDING FOR LINUX")
|
||||||
ffibuilder.cdef(open("raylib/raylib_modified.h").read().replace('RLAPI ', ''))
|
ffibuilder.cdef(mangle("raylib/raylib.h"))
|
||||||
|
#ffibuilder.cdef(mangle("raylib/raygui.h"))
|
||||||
ffibuilder.cdef(open("raylib/raygui_modified.h").read().replace('RAYGUIDEF ', ''))
|
ffibuilder.cdef(open("raylib/raygui_modified.h").read().replace('RAYGUIDEF ', ''))
|
||||||
|
#ffibuilder.cdef(mangle("raylib/physac.h"))
|
||||||
ffibuilder.cdef(open("raylib/physac_modified.h").read().replace('PHYSACDEF ', ''))
|
ffibuilder.cdef(open("raylib/physac_modified.h").read().replace('PHYSACDEF ', ''))
|
||||||
ffibuilder.set_source("raylib._raylib_cffi",
|
ffibuilder.set_source("raylib._raylib_cffi",
|
||||||
"""
|
"""
|
||||||
|
@ -47,7 +79,7 @@ def build_linux():
|
||||||
|
|
||||||
def build_windows():
|
def build_windows():
|
||||||
print("BUILDING FOR WINDOWS")
|
print("BUILDING FOR WINDOWS")
|
||||||
ffibuilder.cdef(open("raylib/raylib_modified.h").read().replace('RLAPI ', '').replace('bool','int'))
|
ffibuilder.cdef(mangle("raylib/raylib.h"))
|
||||||
ffibuilder.cdef(open("raylib/raygui_modified.h").read().replace('RAYGUIDEF ', '').replace('bool','int'))
|
ffibuilder.cdef(open("raylib/raygui_modified.h").read().replace('RAYGUIDEF ', '').replace('bool','int'))
|
||||||
ffibuilder.cdef(open("raylib/physac_modified.h").read().replace('PHYSACDEF ', '').replace('bool','int'))
|
ffibuilder.cdef(open("raylib/physac_modified.h").read().replace('PHYSACDEF ', '').replace('bool','int'))
|
||||||
ffibuilder.set_source("raylib._raylib_cffi",
|
ffibuilder.set_source("raylib._raylib_cffi",
|
||||||
|
@ -82,7 +114,7 @@ def build_mac():
|
||||||
|
|
||||||
def build_rpi_nox():
|
def build_rpi_nox():
|
||||||
print("BUILDING FOR RASPBERRY PI")
|
print("BUILDING FOR RASPBERRY PI")
|
||||||
ffibuilder.cdef(open("raylib/raylib_modified.h").read().replace('RLAPI ', ''))
|
ffibuilder.cdef(mangle("raylib/raylib.h"))
|
||||||
ffibuilder.set_source("raylib._raylib_cffi",
|
ffibuilder.set_source("raylib._raylib_cffi",
|
||||||
"""
|
"""
|
||||||
#include "../../raylib/raylib.h"
|
#include "../../raylib/raylib.h"
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,180 +0,0 @@
|
||||||
--- not_raylib 2021-06-12 21:09:32.140180958 +0100
|
|
||||||
+++ raylib_modified.h 2021-06-12 21:22:50.683235186 +0100
|
|
||||||
@@ -76,106 +76,7 @@
|
|
||||||
*
|
|
||||||
**********************************************************************************************/
|
|
||||||
|
|
||||||
-#ifndef RAYLIB_H
|
|
||||||
-#define RAYLIB_H
|
|
||||||
|
|
||||||
-#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
|
|
||||||
-
|
|
||||||
-#if defined(_WIN32)
|
|
||||||
- // Microsoft attibutes to tell compiler that symbols are imported/exported from a .dll
|
|
||||||
- #if defined(BUILD_LIBTYPE_SHARED)
|
|
||||||
- #define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
|
|
||||||
- #elif defined(USE_LIBTYPE_SHARED)
|
|
||||||
- #define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
|
|
||||||
- #else
|
|
||||||
- #define RLAPI // We are building or using raylib as a static library
|
|
||||||
- #endif
|
|
||||||
-#else
|
|
||||||
- #define RLAPI // We are building or using raylib as a static library (or Linux shared library)
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
-//----------------------------------------------------------------------------------
|
|
||||||
-// Some basic Defines
|
|
||||||
-//----------------------------------------------------------------------------------
|
|
||||||
-#ifndef PI
|
|
||||||
- #define PI 3.14159265358979323846f
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
-#define DEG2RAD (PI/180.0f)
|
|
||||||
-#define RAD2DEG (180.0f/PI)
|
|
||||||
-
|
|
||||||
-// Allow custom memory allocators
|
|
||||||
-#ifndef RL_MALLOC
|
|
||||||
- #define RL_MALLOC(sz) malloc(sz)
|
|
||||||
-#endif
|
|
||||||
-#ifndef RL_CALLOC
|
|
||||||
- #define RL_CALLOC(n,sz) calloc(n,sz)
|
|
||||||
-#endif
|
|
||||||
-#ifndef RL_REALLOC
|
|
||||||
- #define RL_REALLOC(ptr,sz) realloc(ptr,sz)
|
|
||||||
-#endif
|
|
||||||
-#ifndef RL_FREE
|
|
||||||
- #define RL_FREE(ptr) free(ptr)
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
-// NOTE: MSVC C++ compiler does not support compound literals (C99 feature)
|
|
||||||
-// Plain structures in C++ (without constructors) can be initialized from { } initializers.
|
|
||||||
-#if defined(__cplusplus)
|
|
||||||
- #define CLITERAL(type) type
|
|
||||||
-#else
|
|
||||||
- #define CLITERAL(type) (type)
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
-// Some Basic Colors
|
|
||||||
-// NOTE: Custom raylib color palette for amazing visuals on WHITE background
|
|
||||||
-#define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray
|
|
||||||
-#define GRAY CLITERAL(Color){ 130, 130, 130, 255 } // Gray
|
|
||||||
-#define DARKGRAY CLITERAL(Color){ 80, 80, 80, 255 } // Dark Gray
|
|
||||||
-#define YELLOW CLITERAL(Color){ 253, 249, 0, 255 } // Yellow
|
|
||||||
-#define GOLD CLITERAL(Color){ 255, 203, 0, 255 } // Gold
|
|
||||||
-#define ORANGE CLITERAL(Color){ 255, 161, 0, 255 } // Orange
|
|
||||||
-#define PINK CLITERAL(Color){ 255, 109, 194, 255 } // Pink
|
|
||||||
-#define RED CLITERAL(Color){ 230, 41, 55, 255 } // Red
|
|
||||||
-#define MAROON CLITERAL(Color){ 190, 33, 55, 255 } // Maroon
|
|
||||||
-#define GREEN CLITERAL(Color){ 0, 228, 48, 255 } // Green
|
|
||||||
-#define LIME CLITERAL(Color){ 0, 158, 47, 255 } // Lime
|
|
||||||
-#define DARKGREEN CLITERAL(Color){ 0, 117, 44, 255 } // Dark Green
|
|
||||||
-#define SKYBLUE CLITERAL(Color){ 102, 191, 255, 255 } // Sky Blue
|
|
||||||
-#define BLUE CLITERAL(Color){ 0, 121, 241, 255 } // Blue
|
|
||||||
-#define DARKBLUE CLITERAL(Color){ 0, 82, 172, 255 } // Dark Blue
|
|
||||||
-#define PURPLE CLITERAL(Color){ 200, 122, 255, 255 } // Purple
|
|
||||||
-#define VIOLET CLITERAL(Color){ 135, 60, 190, 255 } // Violet
|
|
||||||
-#define DARKPURPLE CLITERAL(Color){ 112, 31, 126, 255 } // Dark Purple
|
|
||||||
-#define BEIGE CLITERAL(Color){ 211, 176, 131, 255 } // Beige
|
|
||||||
-#define BROWN CLITERAL(Color){ 127, 106, 79, 255 } // Brown
|
|
||||||
-#define DARKBROWN CLITERAL(Color){ 76, 63, 47, 255 } // Dark Brown
|
|
||||||
-
|
|
||||||
-#define WHITE CLITERAL(Color){ 255, 255, 255, 255 } // White
|
|
||||||
-#define BLACK CLITERAL(Color){ 0, 0, 0, 255 } // Black
|
|
||||||
-#define BLANK CLITERAL(Color){ 0, 0, 0, 0 } // Blank (Transparent)
|
|
||||||
-#define MAGENTA CLITERAL(Color){ 255, 0, 255, 255 } // Magenta
|
|
||||||
-#define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
|
||||||
-
|
|
||||||
-// Temporal hacks to avoid breaking old codebases using
|
|
||||||
-// deprecated raylib implementation or definitions
|
|
||||||
-#define FormatText TextFormat
|
|
||||||
-#define LoadText LoadFileText
|
|
||||||
-#define GetExtension GetFileExtension
|
|
||||||
-#define GetImageData LoadImageColors
|
|
||||||
-#define FILTER_POINT TEXTURE_FILTER_POINT
|
|
||||||
-#define FILTER_BILINEAR TEXTURE_FILTER_BILINEAR
|
|
||||||
-#define MAP_DIFFUSE MATERIAL_MAP_DIFFUSE
|
|
||||||
-#define PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 PIXELFORMAT_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
|
||||||
-
|
|
||||||
-//----------------------------------------------------------------------------------
|
|
||||||
-// Structures Definition
|
|
||||||
-//----------------------------------------------------------------------------------
|
|
||||||
-// Boolean type
|
|
||||||
-#if defined(__STDC__) && __STDC_VERSION__ >= 199901L
|
|
||||||
- #include <stdbool.h>
|
|
||||||
-#elif !defined(__cplusplus) && !defined(bool)
|
|
||||||
- typedef enum { false, true } bool;
|
|
||||||
-#endif
|
|
||||||
|
|
||||||
// Vector2 type
|
|
||||||
typedef struct Vector2 {
|
|
||||||
@@ -290,7 +191,6 @@
|
|
||||||
CharInfo *chars; // Characters info data
|
|
||||||
} Font;
|
|
||||||
|
|
||||||
-#define SpriteFont Font // SpriteFont type fallback, defaults to Font
|
|
||||||
|
|
||||||
// Camera type, defines a camera position/orientation in 3d space
|
|
||||||
typedef struct Camera3D {
|
|
||||||
@@ -723,8 +623,8 @@
|
|
||||||
MATERIAL_MAP_PREFILTER // NOTE: Uses GL_TEXTURE_CUBE_MAP
|
|
||||||
} MaterialMapIndex;
|
|
||||||
|
|
||||||
-#define MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO
|
|
||||||
-#define MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS
|
|
||||||
+#define MATERIAL_MAP_DIFFUSE 0
|
|
||||||
+#define MATERIAL_MAP_SPECULAR 1
|
|
||||||
|
|
||||||
// Shader location index
|
|
||||||
typedef enum {
|
|
||||||
@@ -756,8 +656,8 @@
|
|
||||||
SHADER_LOC_MAP_BRDF
|
|
||||||
} ShaderLocationIndex;
|
|
||||||
|
|
||||||
-#define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO
|
|
||||||
-#define SHADER_LOC_MAP_SPECULAR SHADER_LOC_MAP_METALNESS
|
|
||||||
+#define SHADER_LOC_MAP_DIFFUSE 15
|
|
||||||
+#define SHADER_LOC_MAP_SPECULAR 16
|
|
||||||
|
|
||||||
// Shader uniform data type
|
|
||||||
typedef enum {
|
|
||||||
@@ -885,16 +785,7 @@
|
|
||||||
|
|
||||||
// Callbacks to hook some internal functions
|
|
||||||
// WARNING: This callbacks are intended for advance users
|
|
||||||
-typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages
|
|
||||||
-typedef unsigned char* (*LoadFileDataCallback)(const char* fileName, unsigned int* bytesRead); // FileIO: Load binary data
|
|
||||||
-typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, unsigned int bytesToWrite); // FileIO: Save binary data
|
|
||||||
-typedef char *(*LoadFileTextCallback)(const char* fileName); // FileIO: Load text data
|
|
||||||
-typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileIO: Save text data
|
|
||||||
-
|
|
||||||
|
|
||||||
-#if defined(__cplusplus)
|
|
||||||
-extern "C" { // Prevents name mangling of functions
|
|
||||||
-#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
// Global Variables Definition
|
|
||||||
@@ -1015,13 +906,7 @@
|
|
||||||
RLAPI void *MemRealloc(void *ptr, int size); // Internal memory reallocator
|
|
||||||
RLAPI void MemFree(void *ptr); // Internal memory free
|
|
||||||
|
|
||||||
-// Set custom callbacks
|
|
||||||
-// WARNING: Callbacks setup is intended for advance users
|
|
||||||
-RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
|
|
||||||
-RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
|
|
||||||
-RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
|
|
||||||
-RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
|
|
||||||
-RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
|
|
||||||
+
|
|
||||||
|
|
||||||
// Files management functions
|
|
||||||
RLAPI unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read)
|
|
||||||
@@ -1512,8 +1397,3 @@
|
|
||||||
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
|
|
||||||
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
|
|
||||||
|
|
||||||
-#if defined(__cplusplus)
|
|
||||||
-}
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
-#endif // RAYLIB_H
|
|
2
setup.py
2
setup.py
|
@ -36,7 +36,7 @@ setup(
|
||||||
],
|
],
|
||||||
packages=["raylib", "pyray"],
|
packages=["raylib", "pyray"],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=["cffi>=1.14.5","inflection"],
|
install_requires=["cffi>=1.14.6","inflection"],
|
||||||
distclass=BinaryDistribution,
|
distclass=BinaryDistribution,
|
||||||
cffi_modules=["raylib/build.py:ffibuilder"]
|
cffi_modules=["raylib/build.py:ffibuilder"]
|
||||||
)
|
)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "4.0a1"
|
__version__ = "4.0a2"
|
Reference in a new issue