GithubHelp home page GithubHelp logo

foreignsasquatch / raylib-hx Goto Github PK

View Code? Open in Web Editor NEW
51.0 51.0 11.0 6.17 MB

Haxe bindings for raylib, a simple and easy-to-use library to learn videogame programming

Home Page: https://raylib.com

License: zlib License

Haxe 100.00%
bindings cross-platform gamedev haxe raylib

raylib-hx's Introduction

raylib-hx's People

Contributors

caresle avatar ctrlaltmilk avatar foreignsasquatch avatar http-80 avatar jobf avatar l0go avatar micomuko avatar robertnorenberg avatar stilic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

raylib-hx's Issues

struct Texture is using "->" for acess instead of "."

here canvas.texture.width or canvas.texture.height gives me a compiler error cuz its trying to acesss width and height with "->" operator

	public function new(initialState:State) {
		canvas = Rl.loadRenderTexture(320, 180);
		var w = canvas.texture.width;
		var h = canvas.texture.height;
		sourceRect = Rectangle.create(-360, -180, 360, -180);
		destRect = Rectangle.create(-360, -180, 1280 + (360 * 2), 720 + (160 * 2));
		switchState(initialState);
	}
void Game_obj::__construct( ::fucciboiGDX::State initialState){
            	HX_STACKFRAME(&_hx_pos_69efd8c9269cf369_22_new)
HXLINE(  23)		this->canvas = LoadRenderTexture(320,180);
HXLINE(  24)		int w = this->canvas->texture->width;
HXLINE(  25)		int h = this->canvas->texture->height;
HXLINE(  26)		this->sourceRect = Rectangle{ (float)-360, (float)-180, (float)360, (float)-180 };
HXLINE(  27)		this->destRect = Rectangle{ (float)-360, (float)-180, (float)2000, (float)1040 };
HXLINE(  28)		this->switchState(initialState);
            	}

heres the code I was trying to copy from the raylib examples

Rectangle sourceRec = { 0.0f, 0.0f, (float)target.texture.width, -(float)target.texture.height };
    Rectangle destRec = { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };

i tried patching the bindings but both RenderTexture and Texture types already have the @:structAccess modified so idk what could be wrong

wasm sample

Hi! can you please update wasm build config and wasm sample? I tried to use current wasm config from Web.xml with config from this commit

17e69ce#diff-5469ce10da37fb1a0de753a53e529b132ebe1f9e097a0ed958f164b4e2c66a4c

but I just got strange errors

Link: BasicWindow.html
error: bin does not exist
em++: error: '/opt/homebrew/Cellar/emscripten/3.1.31/libexec/tools/file_packager BasicWindow.data --from-emcc --preload bin' failed (returned 1)
Error: Build failed

"Class<Raylib> has no field DrawText"

I've installed the library and all the dependencies but unfortunately the example in your ReadMe doesn't work out of the box.

I get the following error:
src/Main.hx:14: characters 24-32 : Class<Raylib> has no field DrawText

If I remove line 14 it compiles and runs perfectly, no issues. But it doesn't like the call to DrawText().

I assume this function has been implemented otherwise you wouldn't put it in your ReadMe as an example, so maybe something's broken in the library?

Vector2.create() generates broken code.

trying to do this

image

generates this in the C++ file

image

Which triggers the following error when trying to compile
error C4576: a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax

Some functions are missing

There are some functions that can be seen in the raylib cheatsheet but that aren't currently on the library. For example, setWindowIcons, setWindowMaxSize or ToggleBorderlessWindowed. Why is this?

Extra targets, platforms and libraries

It would be really nice to add extra targets to the library like hl, js, python, c# etc; Progress on any of these will be documented here. Any help would be appreciated

Update to 4.2

Hello! Can you update to the latest stable version ? And how can we help you to keep this project always updated?

Enum naming convention

So I've noticed that there are two conventions as for the enums:

  • repeating the prefix: e.g. MOUSE_CURSOR_DEFAULT -> Raylib.MouseCursor.MOUSE_CURSOR_DEFAULT
  • not repeating the prefix: e.g.MOUSE_BUTTON_LEFT -> Raylib.MouseButton.LEFT

The shorter seam nicer but either is better than both imo.

Not sure if worth the hustle though - let me know; I can prepare a pr for that.

'w' is not a member of Rectangle

Hello, when i'm trying to create a Rectangle and then draw on screen, I get this error when i compile.

Here is the code i'm using.

import Raylib.Rectangle;
import Raylib.Colors;
import Raylib.*;

class Main
{
    static function main()
    {
        var screenWidth = 800;
        var screenHeight = 450;
        InitWindow(screenWidth, screenHeight, "Draw a rectangle");
        SetTargetFPS(60);

        var rect = Rectangle.create(100, 100, 36, 36);
        while(!WindowShouldClose())
        {
            
            BeginDrawing();
                DrawRectangle(Std.int(rect.x), Std.int(rect.y), Std.int(rect.w), Std.int(rect.h), Colors.RED);
            EndDrawing();
        }

        CloseWindow();
    }
}

Invalid signature of DrawTextureRec

Hi! ๐Ÿ‘‹ It's my first day with haxe and raylib. I tried to draw an image and I had a problem with using DrawTextureRec. According to the cheatsheet the function should accept a vector and a rectangle, but the bindings say that it should be two rectangles.

Compare this

void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint);  // Draw a Texture2D with extended parameters

to this

@:native("DrawTextureRec") static function DrawTextureRec(texture:Texture2D, source:Rectangle, dest:Rectangle, tint:Color):Void;

So it seems like there's a bug in the version available for haxe? ๐Ÿค”

Cheers!

Erratic casting in `Rl.Image` variable declaration

Haxe Code:

class Main {
	static function main() {
		var logo:Rl.Image = Rl.loadImage("Assets/logo.png")
		Rl.imageFormat(logo, Rl.PixelFormat.UNCOMPRESSED_R8G8B8A8);
		Rl.initWindow(800, 450, "Spatial");
		Rl.setWindowIcon(logo);
		...

C++ Output:

	void Main_obj::main(){
	            	HX_STACKFRAME(&_hx_pos_e47a9afac0942eb9_4_main)
	HXLINE(   5)		const char* this1 = HX_("assets/logo.png",72,b4,d1,0d).utf8_str();
	HXDLIN(   5)		cpp::Struct< Image > logo = LoadImage(this1);
	HXLINE(   6)		ImageFormat(&(logo),PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
	HXLINE(   7)		const char* this2 = HX_("Spatial",a4,f0,48,6a).utf8_str();
	HXDLIN(   7)		InitWindow(800,450,this2);
	HXLINE(   8)		SetWindowIcon(logo);

Build Output;

Error: Main.cpp
./src/Main.cpp(34): error C2664: 'void ImageFormat(Image *,int)': cannot convert argument 1 from 'cpp::Struct<Image,cpp::DefaultStructHandler> *' to 'Image *'
./src/Main.cpp(34): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:/Users/ACER/Code/Haxe/lib/raylib-hx/source/lib/src/raylib.h(1231): note: see declaration of 'ImageFormat'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.