Skip to content

Commit

Permalink
gs2
Browse files Browse the repository at this point in the history
  • Loading branch information
DEntis-T committed Jun 21, 2024
1 parent 3ef6b24 commit 51df2f8
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 28 deletions.
31 changes: 29 additions & 2 deletions doc/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ graphics.cls
graphics.show
```

### Form: `showpixel` - COMING SOON!
### Form: `showpixel`
- "Activate" a specific pixel on the graphics grid.

```cpp
Expand All @@ -387,5 +387,32 @@ graphics.showpixel(row, column)

Example:
```cpp
graphics.showpixel(2,3)
graphics.showpixel(9,50)
```

Output:
```
[Info] PawnScript: Graphics Mode Version: [Gs2]
[Info] [Rows: 20 Columns: 100]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info]
[Info] Powered by: Pawn Release: 3.10.11
```
4 changes: 2 additions & 2 deletions src/components/graphics.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public dpp_processgraphics(funcgroup[][],args[][],args_const[][])
//cls
if(!strcmp(funcgroup[1], "cls"))
{
CallLocalFunction("dpp_graphics__cls", "");
CallLocalFunction("dpp_graphics__cls", "i", 1);
dpp_internal<return>(1);
}
//showpicel
Expand All @@ -54,7 +54,7 @@ public dpp_processgraphics(funcgroup[][],args[][],args_const[][])
return 1;
}

printf("showpixel\t\targs[0] : '%i'\targs[1] : '%i'", strval(args[0]),strval(args[1]));
//printf("showpixel\t\targs[0] : '%i'\targs[1] : '%i'", strval(args[0]),strval(args[1]));

CallLocalFunction("dpp_graphics__showpixel", "ii", strval(args[0]),strval(args[1]));
dpp_internal<return>(1);
Expand Down
2 changes: 1 addition & 1 deletion src/core/ver.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ the Initial Developer. All Rights Reserved.
//dpp_genver__()
#define DPP_VERSION_RELEASE "u"
//dpp_genver__()*2
#define DPP_VERSION_GS 1
#define DPP_VERSION_GS 2

new dpp_vers_string__[100];

Expand Down
42 changes: 19 additions & 23 deletions src/ps_graphics.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,35 @@ the Initial Developer. All Rights Reserved.
*/

#define dpp_graphics_major 0
#define dpp_graphics_minor 0
#define dpp_graphics_patch 1
#define dpp_emptychar '\32'
#define dpp_fullchar '¤'

#define GRAPHICS_ROWS 5
#define GRAPHICS_COLUMNS 5
#define GRAPHICS_ROWS 20
#define GRAPHICS_COLUMNS 100

new dpp_graphics_grid__[GRAPHICS_ROWS][GRAPHICS_COLUMNS];
new dpp_gtemp__[10];

// Setup

dpp_graphics__init(); // Initialize the screen.
dpp_graphics__show(); // Show the screen.
dpp_graphics__showpixel(row, column); // Show pixel.
dpp_graphics__cls(); // Clean the screen.
dpp_graphics__cls(mode); // Clean the screen.

// Functions
public dpp_graphics__init() //Internal
{
for(new i; i < GRAPHICS_ROWS; i++)
{
format(dpp_graphics_grid__[i], GRAPHICS_COLUMNS, "\n");
}
for(new i; i < GRAPHICS_ROWS; i++)
{
for(new j; j < GRAPHICS_COLUMNS; j++)
{
dpp_graphics_grid__[i][j] = '-';
}
}
dpp_gprint("Graphics grid has been initialized.");
CallLocalFunction("dpp_graphics__cls", "i", 0);
return 1;
}

public dpp_graphics__show()
{
for(new i; i < GRAPHICS_COLUMNS; i++)
{
print("\t");
}
printf("\tPawnScript: Graphics Mode\t\t\tVersion: [Gs%i]",
DPP_VERSION_GS);
printf("\t[Rows: %i\t\tColumns: %i]",GRAPHICS_ROWS,GRAPHICS_COLUMNS);
Expand Down Expand Up @@ -88,20 +81,23 @@ public dpp_graphics__showpixel(row, column)
dpp_gerror("System encountered an error.");
return 1;
}
printf("__showpixel\t\targs[0] : '%i'\targs[1] : '%i'", row,column);
dpp_graphics_grid__[row-1][column-1] = '+';
//printf("__showpixel\t\targs[0] : '%i'\targs[1] : '%i'", row,column);
dpp_graphics_grid__[row-1][column-1] = dpp_fullchar;
return 1;
}

public dpp_graphics__cls()
public dpp_graphics__cls(mode)
{
for(new i; i < GRAPHICS_ROWS; i++)
{
format(dpp_graphics_grid__[i], GRAPHICS_COLUMNS, "");
for(new j; j < GRAPHICS_COLUMNS; j++)
{
dpp_graphics_grid__[i][j] = '-';
format(dpp_gtemp__,sizeof dpp_gtemp__,"%c",dpp_emptychar);
strcat(dpp_graphics_grid__[i], dpp_gtemp__);
}
}
dpp_gprint("Graphics grid is clean.");
if(mode == 0) dpp_gprint("Graphics grid has been initialized.");
if(mode == 1) dpp_gprint("Graphics grid is clean.");
return 1;
}

0 comments on commit 51df2f8

Please sign in to comment.