-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/ManojTGN/cgrafix
- Loading branch information
Showing
2 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,41 @@ | ||
|
||
|
||
# createGrafixFont | ||
```c | ||
createGrafixFont(grafixFont *font, char* directory ,int fontSize) | ||
``` | ||
Get the window's Frame Per Seconds `(FPS)` | ||
`window` - window object | `grafixWindow` <br> | ||
`directory` - the path to the font file | `char*` <br> | ||
`fontSize` - setting the fontSize for the GrafixFont | `int` <br> | ||
returns nothing | `void` | ||
## Example | ||
```c | ||
grafixFont FONT; | ||
createGrafixFont(&FONT,"jbr.ttf",16); | ||
``` | ||
<br> | ||
|
||
# drawGrafixText | ||
```c | ||
drawGrafixText(grafixWindow window, grafixFont font, int x, int y, char* text, grafixColor color) | ||
``` | ||
`window` - window object | `grafixWindow` <br> | ||
`font` - set the font | `grafixFont` <br> | ||
`x` - x position of the text | `int` <br> | ||
`y` - y position of the text | `int` <br> | ||
`text` - text should be rendered on the frame | `char*` <br> | ||
`color` - text color | `grafixColor` <br> | ||
returns nothing | `void` | ||
## Example | ||
```c | ||
grafixFont FONT; | ||
createGrafixFont(&FONT,"jbr.ttf",16); | ||
drawGrafixText(window,FONT,10,10,"Hello cGrafix",WHITE); | ||
``` | ||
<br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,59 @@ | ||
|
||
|
||
# createGrafixImage | ||
```c | ||
createGrafixImage(grafixImage *image, const char* filePath, int fileType) | ||
``` | ||
Note: Only supports `.BMP` file formats | ||
reads the image file and set the data to the image object. | ||
`window` - window object | `grafixWindow` <br> | ||
`filePath` - the file path to the image | `grafixWindow` <br> | ||
`fileType` - the extension or type of the file. Currently it has 3 types | `int` <br> | ||
- `FT_BMP` | ||
- `FT_PNG` | ||
- `FT_JPG` | ||
returns `1` if the image creation is successfull else `0` | `int` | ||
## Example | ||
```c | ||
grafixImage image; | ||
createGrafixImage(&image,"cgrafix.bmp",FT_BMP); | ||
``` | ||
<br> | ||
|
||
# drawGrafixImage | ||
```c | ||
drawGrafixImage(grafixWindow window, grafixImage image, int x, int y) | ||
``` | ||
render the image to the frame of the specified window | ||
`window` - window object | `grafixWindow` <br> | ||
`image` - image object | `grafixImage` <br> | ||
`x` - starting position of the image's x axis | `int` <br> | ||
`y` - starting position of the image's y axis | `int` <br> | ||
returns nothing | `void` | ||
## Example | ||
```c | ||
drawGrafixImage(window,image,100,100); | ||
``` | ||
<br> | ||
|
||
# rotateGrafixImage `development` | ||
```c | ||
rotateGrafixImage(grafixImage *image, float angle) | ||
``` | ||
Rotate the image in clockwise direction with the specified angle. | ||
`image` - image object | `grafixImage` <br> | ||
`angle` - image rotation angle 0.0-360.0 | `float` <br> | ||
returns nothing | `void` | ||
## Example | ||
```c | ||
waitGrafixWindow(window, 1000); | ||
``` | ||
<br> |