Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "raygui"]
path = raygui
url = https://github.com/raysan5/raygui.git
[submodule "raylib-cpp"]
path = raylib-cpp
url = https://github.com/RobLoach/raylib-cpp.git
2 changes: 1 addition & 1 deletion build-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mv src/com/raylib/RaylibConfig.class gen/com/raylib
cp *.h gen/com/raylib
cd gen
echo "STEP 2 - compile Raylib.java"
java -jar ../javacpp.jar -nodelete com/raylib/Raylib.java -Dplatform.compiler.foo='-DPHYSAC_IMPLEMENTATION -DRAYGUI_IMPLEMENTATION -std=c++11'
java -jar ../javacpp.jar -nodelete com/raylib/Raylib.java -Dplatform.compiler.foo='-DPHYSAC_IMPLEMENTATION -DRAYGUI_IMPLEMENTATION -fpermissive -std=c++11'
# /Oi /O2 /MD /LD /link /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /NODEFAULTLIB:MSVCRTD'
if [ $? -ne '0' ]; then
echo "Fix this before trying again"
Expand Down
1 change: 1 addition & 0 deletions raylib-cpp
Submodule raylib-cpp added at 6d9d02
2 changes: 1 addition & 1 deletion src/com/raylib/Colors.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public final class Colors {
public static final Raylib.Color RAYWHITE = c(245, 245, 245, 255);

private static Raylib.Color c(int r, int g, int b, int a) {
return new Raylib.Color().r((byte) r).g((byte) g).b((byte) b).a((byte) a);
return new Raylib.Color(new Raylib.ColorStruct().r((byte) r).g((byte) g).b((byte) b).a((byte) a));
}
}
131 changes: 0 additions & 131 deletions src/com/raylib/Helpers.java

This file was deleted.

113 changes: 104 additions & 9 deletions src/com/raylib/RaylibConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,68 @@
@Properties(
value = {
@Platform(
include = {"raylib.h", "rlgl.h", "raymath.h", "physac.h", "raygui.h"},
compiler = {"!default","foo"}
includepath = {"../raylib-cpp/include/"},
//cinclude = {"raylib.h",
// "rlgl.h", "raymath.h", "physac.h", "raygui.h"
// },
include = {

"Functions.hpp",
"raylib.h", "rlgl.h", "raymath.h", "physac.h", "raygui.h",
"raylib-cpp.hpp",
"raylib-cpp-utils.hpp",

"AudioDevice.hpp",
"AudioStream.hpp",
"AutomationEventList.hpp",
"BoundingBox.hpp",
"Camera2D.hpp",
"Camera3D.hpp",
"Color.hpp",
"FileData.hpp",
"FileText.hpp",
"Font.hpp",

"Gamepad.hpp",
"Image.hpp",
"Keyboard.hpp",
//"Material.hpp",
"Matrix.hpp",
"Mesh.hpp",
"MeshUnmanaged.hpp",
"Model.hpp",
//"ModelAnimation.hpp",
"Mouse.hpp",
"Music.hpp",
"Ray.hpp",
"RayCollision.hpp",
//"RaylibException.hpp" ,
"Rectangle.hpp",
"RenderTexture.hpp",
"Shader.hpp",
"ShaderUnmanaged.hpp",
"Sound.hpp",
"Text.hpp",
"Texture.hpp",
"TextureUnmanaged.hpp",
"Touch.hpp",
"Vector2.hpp",
"Vector3.hpp",
"Vector4.hpp",
"VrStereoConfig.hpp",
"Wave.hpp",
"Window.hpp"
},
compiler = {"!default", "foo"}
),
@Platform(
value = {"windows-x86_64"},
link = {"winmm", "OpenGL32","user32","shell32","gdi32","raylib"}
link = {"winmm", "OpenGL32", "user32", "shell32", "gdi32", "raylib"}
),
@Platform(
value = {"windows-x86"},
link = {"winmm", "OpenGL32","user32","shell32","gdi32","raylib"}
),
link = {"winmm", "OpenGL32", "user32", "shell32", "gdi32", "raylib"}
),
@Platform(
value = {"macosx-x86_64"},
link = {"raylib"}
Expand All @@ -45,7 +96,6 @@
)},



target = "com.raylib.Raylib"

)
Expand All @@ -56,10 +106,12 @@ public void map(InfoMap infoMap) {
infoMap.put(new Info("!defined(__cplusplus) && !defined(bool)").define(false))
.put(new Info("!defined(__cplusplus) && !defined(bool) && !defined(RL_BOOL_TYPE)").define(false))
.put(new Info("RLAPI").cppText("#define RLAPI"))

.put((new Info("raylib.h")
.linePatterns("// NOTE: Custom raylib color palette for amazing visuals on WHITE background",
"// Structures Definition").skip()))
.put(new Info("MOUSE_LEFT_BUTTON","MOUSE_RIGHT_BUTTON","MOUSE_MIDDLE_BUTTON","FormatText",
"// Structures Definition").skip()
))
.put(new Info("MOUSE_LEFT_BUTTON", "MOUSE_RIGHT_BUTTON", "MOUSE_MIDDLE_BUTTON", "FormatText",
"SubText", "ShowWindow", "LoadText", "SpriteFont", "GetExtension", "GetMouseRay").cppTypes().annotations())
.put(new Info("defined(RLGL_STANDALONE)").define(false))
//.put(new Info("defined(GRAPHICS_API_OPENGL_ES2)").define(false))
Expand All @@ -72,7 +124,50 @@ public void map(InfoMap infoMap) {
.put(new Info("defined(RAYGUI_STANDALONE)").define(false))
.put(new Info("defined(RAYGUI_IMPLEMENTATION)").define(false))
.put(new Info("RAYGUIAPI").cppText("#define RAYGUIAPI"))
// .put(new Info("GLAD_REALLOC", "GLAD_FREE").cppTypes().annotations())
.put(new Info("RLCPPAPI").cppText("#define RLCPPAPI"))

.put(new Info("AudioDevice").pointerTypes("AudioDeviceStruct"))
.put(new Info("AudioStream").pointerTypes("AudioStreamStruct"))
.put(new Info("AutomationEventList").pointerTypes("AutomationEventListStruct"))
.put(new Info("BoundingBox").pointerTypes("BoundingBoxStruct"))
.put(new Info("Camera2D").pointerTypes("Camera2DStruct"))
.put(new Info("Camera3D" ).pointerTypes("Camera3DStruct"))
.put(new Info("Color") .pointerTypes("ColorStruct"))
.put(new Info("FileData" ).pointerTypes("FileDataStruct"))
.put(new Info("FileText" ).pointerTypes("FileTextStruct"))
.put(new Info("Font" ).pointerTypes("FontStruct"))
.put(new Info("Gamepad" ).pointerTypes("GamepadStruct"))
.put(new Info("Image" ).pointerTypes("ImageStruct"))
.put(new Info("Keyboard" ).pointerTypes("KeyboardStruct"))
.put(new Info("Material" ).pointerTypes("MaterialStruct"))
.put(new Info("Matrix" ).pointerTypes("MatrixStruct"))
.put(new Info("Mesh" ).pointerTypes("MeshStruct"))
.put(new Info("Model" ).pointerTypes("ModelStruct"))
.put(new Info("ModelAnimation" ).pointerTypes("ModelAnimationStruct"))
.put(new Info("Mouse" ).pointerTypes("MouseStruct"))
.put(new Info("Music" ).pointerTypes("MusicStruct"))
.put(new Info("Ray" ).pointerTypes("RayStruct"))
.put(new Info("RayCollision" ).pointerTypes("RayCollisionStruct"))
.put(new Info("Rectangle" ).pointerTypes("RectangleStruct"))
.put(new Info("RenderTexture" ).pointerTypes("RenderTextureStruct"))
.put(new Info("Shader" ).pointerTypes("ShaderStruct"))
.put(new Info("Sound" ).pointerTypes("SoundStruct"))
.put(new Info("Text" ).pointerTypes("TextStruct"))
.put(new Info("Texture" ).pointerTypes("TextureStruct"))
.put(new Info("Touch" ).pointerTypes("TouchStruct"))
.put(new Info("Vector2" ).pointerTypes("Vector2Struct"))
.put(new Info("Vector3" ).pointerTypes("Vector3Struct"))
.put(new Info("Vector4" ).pointerTypes("Vector4Struct"))
.put(new Info("VrStereoConfig" ).pointerTypes("VrStereoConfigStruct"))
.put(new Info("Wave" ).pointerTypes("WaveStruct"))
.put(new Info("Window" ).pointerTypes("WindowStruct"))
//.put(new Info("raylib::Camera3D").base("Pointer"))
.put(new Info("raylib::LoadDroppedFiles").skip())
.put(new Info("raylib::LoadDirectoryFiles").skip())
.put(new Info("raylib::TextSplit").skip())
.put(new Info("raylib::Vector4::ToAxisAngle").skip())
.put(new Info("raylib::Vector4::Color").skip())
// .put(new Info("GLAD_REALLOC", "GLAD_FREE").cppTypes().annotations())

;

Expand Down
14 changes: 7 additions & 7 deletions src/com/raylib/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static com.raylib.Raylib.*;
import static com.raylib.Colors.*;
import static com.raylib.Helpers.*;


public class Test {
public static void main(String args[]) {
Expand All @@ -17,20 +17,20 @@ public static void main(String args[]) {
// .fovy(45)
// .projection(0);

Camera3D camera = newCamera(newVector3(18,16,18),
Camera3D camera = new Camera3D(new Vector3(18,16,18),
new Vector3(),
new Vector3().x(0).y(1).z(0),
45, 0);

Image image = LoadImage("examples/models/resources/heightmap.png");
Texture texture = LoadTextureFromImage(image);
Mesh mesh = GenMeshHeightmap(image, new Vector3().x(16).y(8).z(16));
Model model = LoadModelFromMesh(mesh);
Image image = new Image("heightmap.png");
TextureUnmanaged texture = new TextureUnmanaged(image);
Mesh mesh = new Mesh(GenMeshHeightmap(image, new Vector3().x(16).y(8).z(16)));
Model model = new Model(mesh);
model.materials().maps().position(0).texture(texture);
UnloadImage(image);

while(!WindowShouldClose()){
UpdateCamera(camera, CAMERA_ORBITAL);
camera.Update(CAMERA_ORBITAL);
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
Expand Down