diff --git a/MAPPING.md b/MAPPING.md index 097bed3..8e79b18 100644 --- a/MAPPING.md +++ b/MAPPING.md @@ -261,7 +261,7 @@ This is a one to one mapping of each raylib function. | C API | PHP API | Comment | |-------|---------|---------| | RLAPI Image LoadImage(const char *fileName); | new raylib\Image(string $filename) || -| RLAPI Image LoadImageEx(Color *pixels, int width, int height); | TODO || +| RLAPI Image LoadImageEx(Color *pixels, int width, int height); | raylib\Image::fromColors(raylib\Color[] $pixels, int $width, int $height) || | RLAPI Image LoadImagePro(void *data, int width, int height, int format); | TODO || | RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); | TODO || | RLAPI void ExportImage(const char *fileName, Image image); | TODO || @@ -353,7 +353,7 @@ This is a one to one mapping of each raylib function. | RLAPI Font LoadFont(const char *fileName); | TODO || | RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount); | TODO || | RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); | TODO || -| RLAPI CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type); | TODO || +| RLAPI CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type); | \raylib\CharInfo::fromFontData(string $fileName, int fontSize, int[] $fontChars, int type) || | RLAPI Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod); | TODO || | RLAPI void UnloadFont(Font font); | TODO || diff --git a/examples/core/2d-camera.php b/examples/core/2d-camera.php index 567cf95..0fc2c80 100644 --- a/examples/core/2d-camera.php +++ b/examples/core/2d-camera.php @@ -99,7 +99,6 @@ if ($camera->getZoom() > 3.0) { $camera->setZoom(3.0); - Mouse:: } else if ($camera->getZoom() < 0.1) { $camera->setZoom(0.1); } diff --git a/examples/stub/CharInfo.php b/examples/stub/CharInfo.php index 67c6ae1..6c9bbc5 100644 --- a/examples/stub/CharInfo.php +++ b/examples/stub/CharInfo.php @@ -6,13 +6,40 @@ * Class CharInfo * @package raylib * - * @property-read int $value Character value (Unicode) - * @property-read array $rec Character rectangle in sprite font - Rectangle array ['x' => 0, 'y' => 0, 'width' => 0, 'height' => 0] - * @property-read int $offsetX Character offset X when drawing - * @property-read int $offsetY Character offset Y when drawing - * @property-read int $advanceX Character advance position X + * @property-read int $value Character value (Unicode) + * @property-read \raylib\Image $image Character rectangle in sprite font - Rectangle array ['x' => 0, 'y' => 0, + * 'width' => 0, 'height' => 0] + * @property-read int $offsetX Character offset X when drawing + * @property-read int $offsetY Character offset Y when drawing + * @property-read int $advanceX Character advance position X */ class CharInfo { + /** + * CharInfo constructor. + * + * @param int $value + * @param int $offsetX + * @param int $offsetY + * @param int $advanceX + * @param \raylib\Image $image + */ + public function __construct(int $value, int $offsetX, int $offsetY, int $advanceX, \raylib\Image $image) + { + } -} \ No newline at end of file + /** + * Load font data for further use + * + * @param string $fileName + * @param int $fontSize + * @param int[] $fontChars + * @param int $type Which font type to load, \raylib\Font::FONT_DEFAULT, \raylib\Font::FONT_BITMAP or \raylib\Font::FONT_SDF + * + * @return \raylib\CharInfo + */ + public static function fromFontData(string $fileName, int $fontSize, array $fontChars, int $type) : \raylib\CharInfo + { + } + +} diff --git a/examples/stub/Font.php b/examples/stub/Font.php new file mode 100644 index 0000000..9c0ec2d --- /dev/null +++ b/examples/stub/Font.php @@ -0,0 +1,23 @@ + 0, 'y' => 0, 'width' => 0, 'height' => 0] */ - public function crop(array $crop) : void {} + public function crop(array $crop): void + { + } /** * Resize and image (bilinear filtering) @@ -109,7 +168,9 @@ public function crop(array $crop) : void {} * * @return void */ - public function resize(int $newWidth, int $newHeight) : void {} + public function resize(int $newWidth, int $newHeight): void + { + } /** * Resize and image (Nearest-Neighbor scaling algorithm) @@ -119,14 +180,18 @@ public function resize(int $newWidth, int $newHeight) : void {} * * @return void */ - public function resizeNN(int $newWidth,int $newHeight) : void {} + public function resizeNN(int $newWidth, int $newHeight): void + { + } /** * Generate all mipmap levels for a provided image * * @return void */ - public function mipmaps() : void {} + public function mipmaps(): void + { + } /** * Dither image data to 16bpp or lower (Floyd-Steinberg dithering) @@ -138,30 +203,36 @@ public function mipmaps() : void {} * * @return void */ - public function dither(int $rBpp, int $gBpp, int $bBpp, int $aBpp) : void {} + public function dither(int $rBpp, int $gBpp, int $bBpp, int $aBpp): void + { + } /** * Create an image from text (default font) * * @param string $text - * @param int $fontSize - * @param array $color + * @param int $fontSize + * @param array $color * * @return Image */ - public static function text(string $text, int $fontSize, array $color) : Image {} + public static function text(string $text, int $fontSize, array $color): Image + { + } /** * @param SpriteFont $font - * @param string $text - * @param float $fontSize - * @param int $spacing - * @param array $tint The tint color [red,blue,green,alpha] i.e [0,0,0,255] + * @param string $text + * @param float $fontSize + * @param int $spacing + * @param array $tint The tint color [red,blue,green,alpha] i.e [0,0,0,255] * * @return Image */ - public static function textEx(SpriteFont $font, string $text, float $fontSize, int $spacing, array $tint) : Image {} + public static function textEx(SpriteFont $font, string $text, float $fontSize, int $spacing, array $tint): Image + { + } /** * Draw a source image within a destination image @@ -170,7 +241,9 @@ public static function textEx(SpriteFont $font, string $text, float $fontSize, i * @param array $srcRec Source - Rectangle array ['x' => 0, 'y' => 0, 'width' => 0, 'height' => 0] * @param array $dstRec Destination - Rectangle array ['x' => 0, 'y' => 0, 'width' => 0, 'height' => 0] */ - public function draw(Image $dst, array $srcRec, array $dstRec) : void {} + public function draw(Image $dst, array $srcRec, array $dstRec): void + { + } /** * Draw rectangle within an image @@ -181,33 +254,39 @@ public function draw(Image $dst, array $srcRec, array $dstRec) : void {} * * @return void */ - public function drawRectangle(array $position, array $rec, array $color) : void {} + public function drawRectangle(array $position, array $rec, array $color): void + { + } /** * Draw text (default font) within an image (destination) * - * @param array $position The position to place the text - Vector2 array ['x' => 0, 'y' => 0] - * @param string $text The text to draw on the image - * @param int $fontSize The font size of the text - * @param array $color The color [red,blue,green,alpha] i.e [0,0,0,255] + * @param array $position The position to place the text - Vector2 array ['x' => 0, 'y' => 0] + * @param string $text The text to draw on the image + * @param int $fontSize The font size of the text + * @param array $color The color [red,blue,green,alpha] i.e [0,0,0,255] * * @return void */ - public function drawText(array $position, string $text, int $fontSize, array $color) : void {} + public function drawText(array $position, string $text, int $fontSize, array $color): void + { + } /** * Draw text (custom sprite font) within an image (destination) * - * @param array $position The position to place the text - Vector2 array ['x' => 0, 'y' => 0] + * @param array $position The position to place the text - Vector2 array ['x' => 0, 'y' => 0] * @param SpriteFont $font - * @param string $text - * @param float $fontSize - * @param int $spacing - * @param array $color The color [red,blue,green,alpha] i.e [0,0,0,255] + * @param string $text + * @param float $fontSize + * @param int $spacing + * @param array $color The color [red,blue,green,alpha] i.e [0,0,0,255] * * @return void */ - public function drawTextEx(array $position, SpriteFont $font, string $text, float $fontSize, int $spacing, array $color) : void {} + public function drawTextEx(array $position, SpriteFont $font, string $text, float $fontSize, int $spacing, array $color): void + { + } /** @@ -215,14 +294,18 @@ public function drawTextEx(array $position, SpriteFont $font, string $text, floa * * @return void */ - public function flipVertical() : void {} + public function flipVertical(): void + { + } /** * Flip image horizontally * * @return void */ - public function flipHorizontal() : void {} + public function flipHorizontal(): void + { + } /** * Modify image color: tint @@ -231,21 +314,27 @@ public function flipHorizontal() : void {} * * @return void */ - public function colorTint(array $color) : void {} + public function colorTint(array $color): void + { + } /** * Modify image color: invert * * @return void */ - public function colorInvert() : void {} + public function colorInvert(): void + { + } /** * Modify image color: grayscale * * @return void */ - public function colorGrayscale() : void {} + public function colorGrayscale(): void + { + } /** * Modify image color: contrast (-100 to 100) @@ -254,7 +343,9 @@ public function colorGrayscale() : void {} * * @return void */ - public function colorContrast(float $contrast) : void {} + public function colorContrast(float $contrast): void + { + } /** * Modify image color: brightness (-255 to 255) @@ -263,91 +354,107 @@ public function colorContrast(float $contrast) : void {} * * @return void */ - public function colorBrightness(int $brightness) : void {} + public function colorBrightness(int $brightness): void + { + } /** * Generate image: plain color * - * @param int $width - * @param int $height + * @param int $width + * @param int $height * @param array $color The color [red,blue,green,alpha] i.e [0,0,0,255] * * @return Image */ - public static function genImageColor(int $width, int $height, array $color) : Image {} + public static function genImageColor(int $width, int $height, array $color): Image + { + } /** * Generate image: vertical gradient * - * @param int $width - * @param int $height + * @param int $width + * @param int $height * @param array $top The top gradient color [red,blue,green,alpha] i.e [0,0,0,255] * @param array $bottom The bottom gradient color [red,blue,green,alpha] i.e [0,0,0,255] * * @return Image */ - public static function genImageGradientV(int $width, int $height, array $top, array $bottom) : Image {} + public static function genImageGradientV(int $width, int $height, array $top, array $bottom): Image + { + } /** - * @param int $width - * @param int $height + * @param int $width + * @param int $height * @param array $left The left gradient color [red,blue,green,alpha] i.e [0,0,0,255] * @param array $right The right gradient color [red,blue,green,alpha] i.e [0,0,0,255] * * @return Image */ - public static function genImageGradientH(int $width, int $height, array $left, array $right) : Image {} + public static function genImageGradientH(int $width, int $height, array $left, array $right): Image + { + } /** * Generate image: radial gradient * - * @param int $width - * @param int $height + * @param int $width + * @param int $height * @param float $density * @param array $inner The inner gradient color [red,blue,green,alpha] i.e [0,0,0,255] * @param array $outer The outer gradient color [red,blue,green,alpha] i.e [0,0,0,255] * * @return Image */ - public static function genImageGradientRadial(int $width, int $height, float $density, array $inner, array $outer) : Image {} + public static function genImageGradientRadial(int $width, int $height, float $density, array $inner, array $outer): Image + { + } /** * Generate a checkered image * - * @param int $width - * @param int $height - * @param int $checksX How many checkers along the x-axis - * @param int $checksY How many checkers along the y-axis - * @param array $col1 The primary checker color [red,blue,green,alpha] i.e [0,0,0,255] - * @param array $col2 The secondary checker color [red,blue,green,alpha] i.e [0,0,0,255] + * @param int $width + * @param int $height + * @param int $checksX How many checkers along the x-axis + * @param int $checksY How many checkers along the y-axis + * @param array $col1 The primary checker color [red,blue,green,alpha] i.e [0,0,0,255] + * @param array $col2 The secondary checker color [red,blue,green,alpha] i.e [0,0,0,255] * * @return Image */ - public static function genImageChecked(int $width, int $height, int $checksX, int $checksY, array $col1, array $col2) : Image {} + public static function genImageChecked(int $width, int $height, int $checksX, int $checksY, array $col1, array $col2): Image + { + } /** * Generate image: white noise * - * @param int $width - * @param int $height + * @param int $width + * @param int $height * @param float $factor * * @return Image */ - public static function genImageWhiteNoise(int $width, int $height, float $factor) : Image {} + public static function genImageWhiteNoise(int $width, int $height, float $factor): Image + { + } /** * Generate image: perlin noise * - * @param int $width - * @param int $height - * @param int $offsetX - * @param int $offsetY + * @param int $width + * @param int $height + * @param int $offsetX + * @param int $offsetY * @param float $scale * * @return Image */ - public static function genImagePerlinNoise(int $width, int $height, int $offsetX, int $offsetY, float $scale) : Image {} + public static function genImagePerlinNoise(int $width, int $height, int $offsetX, int $offsetY, float $scale): Image + { + } /** * @param int $width @@ -356,6 +463,8 @@ public static function genImagePerlinNoise(int $width, int $height, int $offsetX * * @return Image */ - public static function genImageCellular(int $width, int $height, int $tileSize) : Image {} + public static function genImageCellular(int $width, int $height, int $tileSize): Image + { + } -} \ No newline at end of file +} diff --git a/examples/tests/bmfont.fnt b/examples/tests/bmfont.fnt new file mode 100644 index 0000000..372c2c8 --- /dev/null +++ b/examples/tests/bmfont.fnt @@ -0,0 +1,99 @@ +info face="Arial Black" size=-32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2 outline=0 +common lineHeight=45 base=35 scaleW=512 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 +page id=0 file="bmfont.png" +chars count=95 +char id=32 x=423 y=141 width=3 height=45 xoffset=-1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=33 x=323 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=34 x=123 y=141 width=16 height=45 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=15 +char id=35 x=221 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=36 x=244 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=37 x=70 y=0 width=30 height=45 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=15 +char id=38 x=390 y=0 width=25 height=45 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=15 +char id=39 x=378 y=141 width=8 height=45 xoffset=1 yoffset=0 xadvance=9 page=0 chnl=15 +char id=40 x=222 y=141 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=41 x=499 y=94 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=42 x=497 y=47 width=13 height=45 xoffset=2 yoffset=0 xadvance=18 page=0 chnl=15 +char id=43 x=394 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=44 x=367 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=45 x=261 y=141 width=11 height=45 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 +char id=46 x=356 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=47 x=248 y=141 width=11 height=45 xoffset=-1 yoffset=0 xadvance=9 page=0 chnl=15 +char id=48 x=382 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=49 x=496 y=0 width=14 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15 +char id=50 x=134 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=51 x=359 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=52 x=313 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=53 x=336 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=54 x=178 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=55 x=478 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=56 x=290 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=57 x=90 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=58 x=345 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=59 x=334 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=60 x=0 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=61 x=21 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=62 x=310 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=63 x=352 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=20 page=0 chnl=15 +char id=64 x=279 y=0 width=26 height=45 xoffset=-1 yoffset=0 xadvance=24 page=0 chnl=15 +char id=65 x=193 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15 +char id=66 x=150 y=47 width=22 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15 +char id=67 x=444 y=0 width=24 height=45 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=15 +char id=68 x=174 y=47 width=22 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15 +char id=69 x=156 y=94 width=20 height=45 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=15 +char id=70 x=63 y=141 width=18 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15 +char id=71 x=417 y=0 width=25 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15 +char id=72 x=125 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15 +char id=73 x=388 y=141 width=8 height=45 xoffset=2 yoffset=0 xadvance=12 page=0 chnl=15 +char id=74 x=200 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=75 x=251 y=0 width=26 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15 +char id=76 x=373 y=94 width=19 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15 +char id=77 x=134 y=0 width=28 height=45 xoffset=1 yoffset=0 xadvance=30 page=0 chnl=15 +char id=78 x=100 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15 +char id=79 x=363 y=0 width=25 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15 +char id=80 x=112 y=94 width=20 height=45 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=15 +char id=81 x=335 y=0 width=26 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15 +char id=82 x=470 y=0 width=24 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15 +char id=83 x=75 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15 +char id=84 x=50 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15 +char id=85 x=25 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15 +char id=86 x=307 y=0 width=26 height=45 xoffset=0 yoffset=0 xadvance=25 page=0 chnl=15 +char id=87 x=0 y=0 width=34 height=45 xoffset=-1 yoffset=0 xadvance=32 page=0 chnl=15 +char id=88 x=222 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15 +char id=89 x=164 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15 +char id=90 x=0 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15 +char id=91 x=274 y=141 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=92 x=300 y=141 width=10 height=45 xoffset=-1 yoffset=0 xadvance=9 page=0 chnl=15 +char id=93 x=287 y=141 width=11 height=45 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 +char id=94 x=457 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=95 x=103 y=141 width=18 height=45 xoffset=-1 yoffset=0 xadvance=16 page=0 chnl=15 +char id=96 x=312 y=141 width=9 height=45 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 +char id=97 x=474 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=98 x=68 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=99 x=267 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=100 x=46 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=101 x=198 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=102 x=141 y=141 width=15 height=45 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=103 x=222 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=104 x=415 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=105 x=398 y=141 width=7 height=45 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=15 +char id=106 x=235 y=141 width=11 height=45 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=15 +char id=107 x=405 y=47 width=21 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=108 x=407 y=141 width=7 height=45 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=15 +char id=109 x=102 y=0 width=30 height=45 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=15 +char id=110 x=331 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=111 x=428 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=112 x=266 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=113 x=288 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=114 x=158 y=141 width=15 height=45 xoffset=1 yoffset=0 xadvance=14 page=0 chnl=15 +char id=115 x=244 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=116 x=175 y=141 width=14 height=45 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=15 +char id=117 x=436 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=118 x=451 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=119 x=36 y=0 width=32 height=45 xoffset=-1 yoffset=0 xadvance=30 page=0 chnl=15 +char id=120 x=0 y=94 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=121 x=23 y=94 width=21 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=122 x=83 y=141 width=18 height=45 xoffset=0 yoffset=0 xadvance=18 page=0 chnl=15 +char id=123 x=191 y=141 width=14 height=45 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=124 x=416 y=141 width=5 height=45 xoffset=2 yoffset=0 xadvance=9 page=0 chnl=15 +char id=125 x=207 y=141 width=13 height=45 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 +char id=126 x=42 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 diff --git a/examples/tests/charinfo.php b/examples/tests/charinfo.php new file mode 100644 index 0000000..d041250 --- /dev/null +++ b/examples/tests/charinfo.php @@ -0,0 +1,13 @@ + $charinfo) { + $charinfo->image->export(__DIR__ . '/' . chr($fontChars[$n]) . '-out.png'); +} diff --git a/examples/tests/pixantiqua.ttf b/examples/tests/pixantiqua.ttf new file mode 100644 index 0000000..e012875 Binary files /dev/null and b/examples/tests/pixantiqua.ttf differ diff --git a/raylib-charinfo.c b/raylib-charinfo.c index 505e6c2..d668ece 100644 --- a/raylib-charinfo.c +++ b/raylib-charinfo.c @@ -61,22 +61,44 @@ zend_object_handlers php_raylib_charinfo_object_handlers; static HashTable php_raylib_charinfo_prop_handlers; -typedef double (*raylib_charinfo_read_float_t)(php_raylib_charinfo_object *obj); +typedef zend_long (*raylib_charinfo_read_long_t)(php_raylib_charinfo_object *obj); -typedef int (*raylib_charinfo_write_float_t)(php_raylib_charinfo_object *obj, zval *value); +typedef int (*raylib_charinfo_write_long_t)(php_raylib_charinfo_object *obj, zval *value); + +typedef zval* (*raylib_charinfo_read_image_object_t)(php_raylib_charinfo_object *obj); + +typedef int (*raylib_charinfo_write_image_object_t)(php_raylib_charinfo_object *obj, zval *value); typedef struct _raylib_charinfo_prop_handler { - raylib_charinfo_read_float_t read_float_func; - raylib_charinfo_write_float_t write_float_func; + raylib_charinfo_read_long_t read_long_func; + raylib_charinfo_write_long_t write_long_func; + raylib_charinfo_read_image_object_t read_image_func; + raylib_charinfo_write_image_object_t write_image_func; } raylib_charinfo_prop_handler; /* }}} */ -static void php_raylib_charinfo_register_prop_handler(HashTable *prop_handler, char *name, raylib_charinfo_read_float_t read_float_func, raylib_charinfo_write_float_t write_float_func) /* {{{ */ +static void php_raylib_charinfo_register_prop_handler(HashTable *prop_handler, char *name, raylib_charinfo_read_long_t read_long_func, raylib_charinfo_write_long_t write_long_func) /* {{{ */ +{ + raylib_charinfo_prop_handler hnd; + + hnd.read_long_func = read_long_func; + hnd.write_long_func = write_long_func; + hnd.read_image_func = NULL; + hnd.write_image_func = NULL; + zend_hash_str_add_mem(prop_handler, name, strlen(name), &hnd, sizeof(raylib_charinfo_prop_handler)); + + /* Register for reflection */ + zend_declare_property_null(php_raylib_charinfo_ce, name, strlen(name), ZEND_ACC_PUBLIC); +} + +static void php_raylib_charinfo_register_prop_handler_image(HashTable *prop_handler, char *name, raylib_charinfo_read_image_object_t read_image_func, raylib_charinfo_write_image_object_t write_image_func) /* {{{ */ { raylib_charinfo_prop_handler hnd; - hnd.read_float_func = read_float_func; - hnd.write_float_func = write_float_func; + hnd.read_long_func = NULL; + hnd.write_long_func = NULL; + hnd.read_image_func = read_image_func; + hnd.write_image_func = write_image_func; zend_hash_str_add_mem(prop_handler, name, strlen(name), &hnd, sizeof(raylib_charinfo_prop_handler)); /* Register for reflection */ @@ -86,16 +108,21 @@ static void php_raylib_charinfo_register_prop_handler(HashTable *prop_handler, c static zval *php_raylib_charinfo_property_reader(php_raylib_charinfo_object *obj, raylib_charinfo_prop_handler *hnd, zval *rv) /* {{{ */ { - double ret = 0; + if (obj != NULL && hnd->read_long_func) { + zend_long ret = 0; + ret = hnd->read_long_func(obj); + ZVAL_LONG(rv, (zend_long) ret); + } + if (obj != NULL && hnd->read_image_func) { + zval *ret; + ret = hnd->read_image_func(obj); - if (obj != NULL && hnd->read_float_func) { -// php_error_docref(NULL, E_WARNING, "Internal raylib charinfo found"); - ret = hnd->read_float_func(obj); + php_raylib_image_object *result = Z_IMAGE_OBJ_P(ret); + ZVAL_OBJ(rv, &result->std); } else { // php_error_docref(NULL, E_WARNING, "Internal raylib vectro2 error returned"); } - ZVAL_DOUBLE(rv, (double) ret); return rv; } @@ -198,8 +225,8 @@ zval *php_raylib_charinfo_write_property(zval *object, zval *member, zval *value hnd = zend_hash_find_ptr(&php_raylib_charinfo_prop_handlers, Z_STR_P(member)); - if (hnd && hnd->write_float_func) { - hnd->write_float_func(obj, value); + if (hnd && hnd->write_long_func) { + hnd->write_long_func(obj, value); } else { value = zend_std_write_property(object, member, value, cache_slot); } @@ -335,48 +362,110 @@ static zend_object *php_raylib_charinfo_clone(zval *zobject) // PHP property handling -static double php_raylib_charinfo_x(php_raylib_charinfo_object *obj) /* {{{ */ +static zend_long php_raylib_charinfo_value(php_raylib_charinfo_object *obj) /* {{{ */ { - return (double) 0; //obj->charinfo.value; + return (zend_long) obj->charinfo.value; } /* }}} */ -static double php_raylib_charinfo_y(php_raylib_charinfo_object *obj) /* {{{ */ +static zend_long php_raylib_charinfo_offset_x(php_raylib_charinfo_object *obj) /* {{{ */ +{ + return (zend_long) obj->charinfo.offsetX; +} + +static zend_long php_raylib_charinfo_offset_y(php_raylib_charinfo_object *obj) /* {{{ */ +{ + return (zend_long) obj->charinfo.offsetY; +} + +static zend_long php_raylib_charinfo_advance_x(php_raylib_charinfo_object *obj) /* {{{ */ { - return (double) 0; // obj->charinfo.offsetX; + return (zend_long) obj->charinfo.advanceX; +} + +static zval * php_raylib_charinfo_image(php_raylib_charinfo_object *obj) /* {{{ */ +{ + zval *image = malloc(sizeof(zval)); + object_init_ex(image, php_raylib_image_ce); + + php_raylib_image_object *result = Z_IMAGE_OBJ_P(image); + result->image = obj->charinfo.image; + + return image; } /* }}} */ -static int php_raylib_charinfo_write_x(php_raylib_charinfo_object *charinfo_object, zval *newval) /* {{{ */ +static int php_raylib_charinfo_write_value(php_raylib_charinfo_object *charinfo_object, zval *newval) /* {{{ */ { int ret = SUCCESS; if (Z_TYPE_P(newval) == IS_NULL) { - //charinfo_object->charinfo.x = 0; + charinfo_object->charinfo.value = 0; return ret; } - //charinfo_object->charinfo.x = (float) zval_get_double(newval); + charinfo_object->charinfo.value = (int) zval_get_long(newval); return ret; } /* }}} */ -static int php_raylib_charinfo_write_y(php_raylib_charinfo_object *charinfo_object, zval *newval) /* {{{ */ +static int php_raylib_charinfo_write_offset_x(php_raylib_charinfo_object *charinfo_object, zval *newval) /* {{{ */ { int ret = SUCCESS; if (Z_TYPE_P(newval) == IS_NULL) { - //charinfo_object->charinfo.y = 0; + charinfo_object->charinfo.offsetX = 0; return ret; } -// php_error_docref(NULL, E_WARNING, "'%f': no value set", zval_get_double(newval)); + charinfo_object->charinfo.offsetX = (int) zval_get_long(newval); + return ret; +} - //charinfo_object->charinfo.y = (float) zval_get_double(newval); +static int php_raylib_charinfo_write_offset_y(php_raylib_charinfo_object *charinfo_object, zval *newval) /* {{{ */ +{ + int ret = SUCCESS; + + if (Z_TYPE_P(newval) == IS_NULL) { + charinfo_object->charinfo.offsetY = 0; + return ret; + } + + charinfo_object->charinfo.offsetY = (int) zval_get_long(newval); + + return ret; +} + +static int php_raylib_charinfo_write_advance_x(php_raylib_charinfo_object *charinfo_object, zval *newval) /* {{{ */ +{ + int ret = SUCCESS; + + if (Z_TYPE_P(newval) == IS_NULL) { + charinfo_object->charinfo.advanceX = 0; + return ret; + } + + charinfo_object->charinfo.advanceX = (int) zval_get_long(newval); + + return ret; +} + +static int php_raylib_charinfo_write_image(php_raylib_charinfo_object *charinfo_object, zval *newval) /* {{{ */ +{ + int ret = SUCCESS; + + if (Z_TYPE_P(newval) == IS_NULL) { + // Cannot set this to null... + return ret; + } + + php_raylib_image_object *phpImage = Z_IMAGE_OBJ_P(newval); + + charinfo_object->charinfo.image = phpImage->image; return ret; } @@ -397,7 +486,7 @@ PHP_METHOD(CharInfo, __construct) Z_PARAM_ZVAL(image) ZEND_PARSE_PARAMETERS_END(); - php_raylib_image_object *phpImage = Z_IMAGE_OBJ_P(ZEND_THIS); + php_raylib_image_object *phpImage = Z_IMAGE_OBJ_P(image); php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); @@ -411,50 +500,179 @@ PHP_METHOD(CharInfo, __construct) } -//PHP_METHOD(CharInfo, getX) -//{ -// php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); -// RETURN_DOUBLE(intern->charinfo.x); -//} -// -//PHP_METHOD(CharInfo, setX) -//{ -// zval *val; -// -// ZEND_PARSE_PARAMETERS_START(1, 1) -// Z_PARAM_ZVAL(val) -// ZEND_PARSE_PARAMETERS_END(); -// -// php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); -// -// intern->charinfo.x = zend_double_2float(val); -//} -// -//PHP_METHOD(CharInfo, getY) -//{ -// php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); -// RETURN_DOUBLE(intern->charinfo.y); -//} -// -//PHP_METHOD(CharInfo, setY) -//{ -// zval *val; -// -// ZEND_PARSE_PARAMETERS_START(1, 1) -// Z_PARAM_ZVAL(val) -// ZEND_PARSE_PARAMETERS_END(); -// -// php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); -// -// intern->charinfo.y = zend_double_2float(val); -//} + +PHP_METHOD(CharInfo, fromFontData) +{ + + zend_string *fileName; + zval *fontChars; + HashTable *fontCharsArr; + zend_long fontSize, type; + zval *zv; + + ZEND_PARSE_PARAMETERS_START(4, 4) + Z_PARAM_STR(fileName) + Z_PARAM_LONG(fontSize) + Z_PARAM_ARRAY(fontChars) + Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_END(); + + fontCharsArr = Z_ARRVAL_P(fontChars); + int numFontChars = zend_hash_num_elements(fontCharsArr); + int *fontCharsP = (int *)safe_emalloc(numFontChars, sizeof(int), 0); + + int n = 0; + ZEND_HASH_FOREACH_VAL(fontCharsArr, zv) { + switch (Z_TYPE_P(zv)) { + case IS_LONG: + if (n < numFontChars) { + zend_long val = zval_get_long(zv); + fontCharsP[n] = (int) val; + n++; + } + break; + default: + php_error_docref(NULL, E_WARNING, "Invalid type for element %i", n); + RETURN_FALSE; + } + } ZEND_HASH_FOREACH_END(); + + zval *charinfo = malloc(sizeof(zval)); + object_init_ex(charinfo, php_raylib_charinfo_ce); + + php_raylib_charinfo_object *result = Z_CHARINFO_OBJ_P(charinfo); + + CharInfo *charInfos = LoadFontData( + fileName->val, + (int) fontSize, + fontCharsP, + numFontChars, + (int) type + ); + + array_init_size(return_value, numFontChars); + + for (int i = 0; i < numFontChars; i++) { + zval *charInfo = malloc(sizeof(zval)); + object_init_ex(charInfo, php_raylib_charinfo_ce); + + php_raylib_charinfo_object *result = Z_CHARINFO_OBJ_P(charInfo); + result->charinfo = charInfos[i]; + add_index_zval(return_value, i, charInfo); + } +} + +PHP_METHOD(CharInfo, getValue) +{ + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + RETURN_LONG(intern->charinfo.value); +} + +PHP_METHOD(CharInfo, setValue) +{ + zend_long value; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(value) + ZEND_PARSE_PARAMETERS_END(); + + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + + intern->charinfo.value = (int) value; +} + +PHP_METHOD(CharInfo, getOffsetX) +{ + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + RETURN_LONG(intern->charinfo.offsetX); +} + +PHP_METHOD(CharInfo, setOffsetX) +{ + zend_long offsetX; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(offsetX) + ZEND_PARSE_PARAMETERS_END(); + + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + + intern->charinfo.offsetX = (int) offsetX; +} + +PHP_METHOD(CharInfo, getOffsetY) +{ + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + RETURN_LONG(intern->charinfo.offsetY); +} + +PHP_METHOD(CharInfo, setOffsetY) +{ + zend_long offsetY; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(offsetY) + ZEND_PARSE_PARAMETERS_END(); + + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + + intern->charinfo.offsetY = (int) offsetY; +} + +PHP_METHOD(CharInfo, getAdvanceX) +{ + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + RETURN_LONG(intern->charinfo.advanceX); +} + +PHP_METHOD(CharInfo, setAdvanceX) +{ + zend_long advanceX; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(advanceX) + ZEND_PARSE_PARAMETERS_END(); + + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + + intern->charinfo.advanceX = (int) advanceX; +} + +PHP_METHOD(CharInfo, getImage) +{ + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + RETURN_OBJ(&intern->std); +} + +PHP_METHOD(CharInfo, setImage) +{ + zval *image; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(image) + ZEND_PARSE_PARAMETERS_END(); + + php_raylib_image_object *phpImage = Z_IMAGE_OBJ_P(image); + + php_raylib_charinfo_object *intern = Z_CHARINFO_OBJ_P(ZEND_THIS); + + intern->charinfo.image = phpImage->image; +} + const zend_function_entry php_raylib_charinfo_methods[] = { PHP_ME(CharInfo, __construct, NULL, ZEND_ACC_PUBLIC) -// PHP_ME(CharInfo, getX, NULL, ZEND_ACC_PUBLIC) -// PHP_ME(CharInfo, setX, NULL, ZEND_ACC_PUBLIC) -// PHP_ME(CharInfo, getY, NULL, ZEND_ACC_PUBLIC) -// PHP_ME(CharInfo, setY, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, fromFontData, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(CharInfo, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, setValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, getOffsetX, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, setOffsetX, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, getOffsetY, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, setOffsetY, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, getAdvanceX, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, setAdvanceX, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, getImage, NULL, ZEND_ACC_PUBLIC) + PHP_ME(CharInfo, setImage, NULL, ZEND_ACC_PUBLIC) PHP_FE_END }; @@ -477,9 +695,9 @@ void php_raylib_charinfo_startup(INIT_FUNC_ARGS) php_raylib_charinfo_object_handlers.get_property_ptr_ptr = php_raylib_charinfo_get_property_ptr_ptr; php_raylib_charinfo_object_handlers.get_gc = php_raylib_charinfo_get_gc; php_raylib_charinfo_object_handlers.get_properties = php_raylib_charinfo_get_properties; - php_raylib_charinfo_object_handlers.read_property = php_raylib_charinfo_read_property; + php_raylib_charinfo_object_handlers.read_property = php_raylib_charinfo_read_property; php_raylib_charinfo_object_handlers.write_property = php_raylib_charinfo_write_property; - php_raylib_charinfo_object_handlers.has_property = php_raylib_charinfo_has_property; + php_raylib_charinfo_object_handlers.has_property = php_raylib_charinfo_has_property; // Init INIT_NS_CLASS_ENTRY(ce, "raylib", "CharInfo", php_raylib_charinfo_methods); @@ -488,6 +706,9 @@ void php_raylib_charinfo_startup(INIT_FUNC_ARGS) // Props zend_hash_init(&php_raylib_charinfo_prop_handlers, 0, NULL, php_raylib_charinfo_free_prop_handler, 1); - php_raylib_charinfo_register_prop_handler(&php_raylib_charinfo_prop_handlers, "x", php_raylib_charinfo_x, php_raylib_charinfo_write_x); - php_raylib_charinfo_register_prop_handler(&php_raylib_charinfo_prop_handlers, "y", php_raylib_charinfo_y, php_raylib_charinfo_write_y); + php_raylib_charinfo_register_prop_handler(&php_raylib_charinfo_prop_handlers, "value", php_raylib_charinfo_value, php_raylib_charinfo_write_value); + php_raylib_charinfo_register_prop_handler(&php_raylib_charinfo_prop_handlers, "offsetX", php_raylib_charinfo_offset_x, php_raylib_charinfo_write_offset_x); + php_raylib_charinfo_register_prop_handler(&php_raylib_charinfo_prop_handlers, "offsetY", php_raylib_charinfo_offset_y, php_raylib_charinfo_write_offset_y); + php_raylib_charinfo_register_prop_handler(&php_raylib_charinfo_prop_handlers, "advanceX", php_raylib_charinfo_advance_x, php_raylib_charinfo_write_advance_x); + php_raylib_charinfo_register_prop_handler_image(&php_raylib_charinfo_prop_handlers, "image", php_raylib_charinfo_image, php_raylib_charinfo_write_image); } \ No newline at end of file diff --git a/raylib-font.c b/raylib-font.c index 9c1fef7..187f5ec 100644 --- a/raylib-font.c +++ b/raylib-font.c @@ -381,6 +381,11 @@ static int php_raylib_font_write_y(php_raylib_font_object *font_object, zval *ne } /* }}} */ +/* {{{ REGISTER_RAYLIB_CHARINFO_CLASS_CONST_LONG */ +#define REGISTER_RAYLIB_FONT_CLASS_CONST_LONG(const_name, value) \ + zend_declare_class_constant_long(php_raylib_font_ce, const_name, sizeof(const_name)-1, (zend_long)value); +/* }}} */ + // PHP object handling PHP_METHOD(Font, __construct) @@ -484,4 +489,10 @@ void php_raylib_font_startup(INIT_FUNC_ARGS) zend_hash_init(&php_raylib_font_prop_handlers, 0, NULL, php_raylib_font_free_prop_handler, 1); // php_raylib_font_register_prop_handler(&php_raylib_font_prop_handlers, "x", php_raylib_font_x, php_raylib_font_write_x); // php_raylib_font_register_prop_handler(&php_raylib_font_prop_handlers, "y", php_raylib_font_y, php_raylib_font_write_y); + + + // Types + REGISTER_RAYLIB_FONT_CLASS_CONST_LONG("FONT_DEFAULT", FONT_DEFAULT); + REGISTER_RAYLIB_FONT_CLASS_CONST_LONG("FONT_BITMAP", FONT_BITMAP); + REGISTER_RAYLIB_FONT_CLASS_CONST_LONG("FONT_SDF", FONT_SDF); } \ No newline at end of file diff --git a/raylib-image.c b/raylib-image.c index aa28e9a..a1f8098 100644 --- a/raylib-image.c +++ b/raylib-image.c @@ -451,12 +451,42 @@ PHP_METHOD(Image, toPot) ImageToPOT(&intern->image, php_array_to_color(colorArr)); } +// RLAPI void ExportImage(const char *fileName, Image image); +PHP_METHOD(Image, export) +{ + zend_string *fileName; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(fileName) + ZEND_PARSE_PARAMETERS_END(); + + php_raylib_image_object *intern = Z_IMAGE_OBJ_P(ZEND_THIS); + + ExportImage(intern->image, fileName->val); +} + +// RLAPI void ExportImageAsCode(Image image, const char *fileName); +PHP_METHOD(Image, exportAsCode) +{ + zend_string *fileName; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(fileName) + ZEND_PARSE_PARAMETERS_END(); + + php_raylib_image_object *intern = Z_IMAGE_OBJ_P(ZEND_THIS); + + ExportImageAsCode(intern->image, fileName->val); +} + const zend_function_entry php_raylib_image_methods[] = { PHP_ME(Image, __construct, NULL, ZEND_ACC_PUBLIC) PHP_ME(Image, fromColors, NULL, ZEND_ACC_PUBLIC) PHP_ME(Image, toTexture, NULL, ZEND_ACC_PUBLIC) PHP_ME(Image, copy, NULL, ZEND_ACC_PUBLIC) PHP_ME(Image, toPot, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Image, export, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Image, exportAsCode, NULL, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/raylib-npatchinfo.c b/raylib-npatchinfo.c index 5002087..8f74acd 100644 --- a/raylib-npatchinfo.c +++ b/raylib-npatchinfo.c @@ -409,7 +409,6 @@ static int php_raylib_npatchinfo_write_source_rec(php_raylib_npatchinfo_object * if (Z_TYPE_P(newval) == IS_NULL) { // Cannot set this to null... -// npatchinfo_object->npatchinfo.sourceRec = NULL; return ret; } @@ -648,7 +647,7 @@ PHP_METHOD(NPatchInfo, setSourceRec) const zend_function_entry php_raylib_npatchinfo_methods[] = { PHP_ME(NPatchInfo, __construct, NULL, ZEND_ACC_PUBLIC) PHP_ME(NPatchInfo, getLeft, NULL, ZEND_ACC_PUBLIC) - PHP_ME(NPatchInfo, setRight, NULL, ZEND_ACC_PUBLIC) + PHP_ME(NPatchInfo, setLeft, NULL, ZEND_ACC_PUBLIC) PHP_ME(NPatchInfo, getTop, NULL, ZEND_ACC_PUBLIC) PHP_ME(NPatchInfo, setTop, NULL, ZEND_ACC_PUBLIC) PHP_ME(NPatchInfo, getRight, NULL, ZEND_ACC_PUBLIC) diff --git a/raylib-window.c b/raylib-window.c index 9c93001..f128b7b 100644 --- a/raylib-window.c +++ b/raylib-window.c @@ -131,8 +131,8 @@ PHP_METHOD(Window, isHidden) //RLAPI bool IsWindowFullscreen(void); PHP_METHOD(Window, isFullscreen) { - RETURN_BOOL(false); -// RETURN_BOOL(IsWindowFullscreen()); +// RETURN_BOOL(false); + RETURN_BOOL(IsWindowFullscreen()); } PHP_METHOD(Window, unhideWindow)