Skip to content

Commit

Permalink
Added image export, step closer to font loading
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-montanez committed Mar 31, 2020
1 parent ef73633 commit 89a9f1f
Show file tree
Hide file tree
Showing 13 changed files with 693 additions and 162 deletions.
4 changes: 2 additions & 2 deletions MAPPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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 ||

Expand Down
1 change: 0 additions & 1 deletion examples/core/2d-camera.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@

if ($camera->getZoom() > 3.0) {
$camera->setZoom(3.0);
Mouse::
} else if ($camera->getZoom() < 0.1) {
$camera->setZoom(0.1);
}
Expand Down
39 changes: 33 additions & 6 deletions examples/stub/CharInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

}
/**
* 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
{
}

}
23 changes: 23 additions & 0 deletions examples/stub/Font.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php


namespace raylib;


class Font
{
const
/**
* @var int FONT_DEFAULT Default font generation, anti-aliased
*/
FONT_DEFAULT = 0,
/**
* @var int FONT_BITMAP Bitmap font generation, no anti-aliasing
*/
FONT_BITMAP = 1,
/**
* @var int FONT_SDF SDF font generation, requires external shader
*/
FONT_SDF = 2;

}
Loading

0 comments on commit 89a9f1f

Please sign in to comment.