Skip to content

Commit

Permalink
wip4
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeodrippe committed Jul 22, 2024
1 parent 95ad456 commit 6dab895
Show file tree
Hide file tree
Showing 4 changed files with 459 additions and 412 deletions.
42 changes: 36 additions & 6 deletions bin/jextract-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,42 @@ set -ex

unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) VYBE_EXTENSION=so; __VYBE_DEFAULT_GCC_ARGS="gcc -undefined"; VYBE_GCC_FLECS_OPTS="-std=gnu99 -fPIC"; VYBE_GCC_END=""; VYBE_GCC_RAYLIB=""; VYBE_LIB_PREFIX="lib";;
Darwin*) VYBE_EXTENSION=dylib; __VYBE_DEFAULT_GCC_ARGS="gcc -undefined dynamic_lookup"; VYBE_GCC_FLECS_OPTS="-std=gnu99"; VYBE_GCC_END=""; VYBE_GCC_RAYLIB=""; VYBE_LIB_PREFIX="lib";;
CYGWIN*) VYBE_EXTENSION=dll; __VYBE_DEFAULT_GCC_ARGS="gcc -undefined"; VYBE_GCC_FLECS_OPTS="-std=gnu99"; VYBE_GCC_END="-lws2_32"; VYBE_GCC_RAYLIB="-static-libgcc -lopengl32 -lgdi32 -lwinmm"; VYBE_LIB_PREFIX="";;
MINGW*) VYBE_EXTENSION=dll; __VYBE_DEFAULT_GCC_ARGS="gcc -undefined"; VYBE_GCC_FLECS_OPTS="-std=gnu99"; VYBE_GCC_END="-lws2_32"; VYBE_GCC_RAYLIB="-static-libgcc -lopengl32 -lgdi32 -lwinmm"; VYBE_LIB_PREFIX="";;
MSYS_NT*) VYBE_EXTENSION=dll; __VYBE_DEFAULT_GCC_ARGS="gcc -undefined"; VYBE_GCC_FLECS_OPTS="-std=gnu99"; VYBE_GCC_END="-lws2_32"; VYBE_GCC_RAYLIB="-static-libgcc -lopengl32 -lgdi32 -lwinmm"; VYBE_LIB_PREFIX="";;
*) VYBE_EXTENSION="UNKNOWN:${unameOut}"
Linux*)
VYBE_EXTENSION=so;
__VYBE_DEFAULT_GCC_ARGS="gcc -undefined";
VYBE_GCC_FLECS_OPTS="-std=gnu99 -fPIC"; VYBE_GCC_END="";
VYBE_GCC_RAYLIB="";
VYBE_LIB_PREFIX="lib";;
Darwin*)
VYBE_EXTENSION=dylib;
__VYBE_DEFAULT_GCC_ARGS="gcc -undefined dynamic_lookup";
VYBE_GCC_FLECS_OPTS="-std=gnu99";
VYBE_GCC_END="";
VYBE_GCC_RAYLIB="";
VYBE_LIB_PREFIX="lib";;
CYGWIN*)
VYBE_EXTENSION=dll;
__VYBE_DEFAULT_GCC_ARGS="gcc -undefined";
VYBE_GCC_FLECS_OPTS="-std=gnu99";
VYBE_GCC_END="-lws2_32";
VYBE_GCC_RAYLIB="-lopengl32 -lgdi32 -lwinmm";
VYBE_LIB_PREFIX="";;
MINGW*)
VYBE_EXTENSION=dll;
__VYBE_DEFAULT_GCC_ARGS="gcc -undefined";
VYBE_GCC_FLECS_OPTS="-std=gnu99";
VYBE_GCC_END="-lws2_32";
VYBE_GCC_RAYLIB="-lopengl32 -lgdi32 -lwinmm";
VYBE_LIB_PREFIX="";;
MSYS_NT*)
VYBE_EXTENSION=dll;
__VYBE_DEFAULT_GCC_ARGS="gcc -undefined";
VYBE_GCC_FLECS_OPTS="-std=gnu99";
VYBE_GCC_END="-lws2_32";
VYBE_GCC_RAYLIB="-lopengl32 -lgdi32 -lwinmm";
VYBE_LIB_PREFIX="";;
*)
VYBE_EXTENSION="UNKNOWN:${unameOut}"
esac

__VYBE_JEXTRACT_DEFAULT=~/Downloads/jextract-osx/bin/jextract
Expand Down
73 changes: 45 additions & 28 deletions bin/vybe_raylib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,51 @@
#include "../raylib/src/rlgl.h"
#include "../raylib/src/raymath.h"

// FOR WINDOWS
#if defined(_WIN32)

#define GLAD_MALLOC RL_MALLOC
#define GLAD_FREE RL_FREE

#define GLAD_GL_IMPLEMENTATION
#include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers

#include "raylib.h"
#include "rlgl.h"
#include "raymath.h"

#else
// OSX and LINUX
void *malloc(unsigned long size);
unsigned long strlen(const char *str);
char* strcpy(char* destination, const char* source);

void glGetProgramiv( int program,
int pname,
int *params);
void glGetActiveUniform( int program,
int index,
int bufSize,
int *length,
int *size,
int *type,
char *name);

void glGetActiveAttrib( int program,
int index,
int bufSize,
int *length,
int *size,
int *type,
char *name);
int glGetUniformLocation( int program,
const char *name);
int glGetAttribLocation( int program,
const char *name);

#endif


#define VY_GL_ACTIVE_UNIFORMS GL_ACTIVE_UNIFORMS
#define VY_GL_ACTIVE_ATTRIBUTES GL_ACTIVE_ATTRIBUTES

Expand Down Expand Up @@ -61,34 +106,6 @@ VyShaderParameters VyGlGetActiveParameters(int id);
int VyGlGetActiveUniformsCount(int id);
int VyGlGetActiveAttributesCount(int id);

void *malloc(unsigned long size);
unsigned long strlen(const char *str);
char* strcpy(char* destination, const char* source);

void glGetProgramiv( int program,
int pname,
int *params);
void glGetActiveUniform( int program,
int index,
int bufSize,
int *length,
int *size,
int *type,
char *name);

void glGetActiveAttrib( int program,
int index,
int bufSize,
int *length,
int *size,
int *type,
char *name);
int glGetUniformLocation( int program,
const char *name);
int glGetAttribLocation( int program,
const char *name);


VyShaderParameters VyGlGetActiveParameters(int id)
{
int namelen = -1;
Expand Down
4 changes: 2 additions & 2 deletions src-java/org/vybe/flecs/flecs_1.java
Original file line number Diff line number Diff line change
Expand Up @@ -42839,13 +42839,13 @@ public static long __DARWIN_C_LEVEL() {
}
/**
* {@snippet lang=c :
* #define __ASSERT_FILE_NAME "jextract$5349203350397059923.h"
* #define __ASSERT_FILE_NAME "jextract$10271739112655021310.h"
* }
*/
public static MemorySegment __ASSERT_FILE_NAME() {
class Holder {
static final MemorySegment __ASSERT_FILE_NAME
= flecs.LIBRARY_ARENA.allocateFrom("jextract$5349203350397059923.h");
= flecs.LIBRARY_ARENA.allocateFrom("jextract$10271739112655021310.h");
}
return Holder.__ASSERT_FILE_NAME;
}
Expand Down
Loading

0 comments on commit 6dab895

Please sign in to comment.