Added color picker.

This commit is contained in:
Ryan "Lofenyy" Medeiros 2023-07-02 00:46:50 -06:00
parent 0b36ef8961
commit 5dc807b309
2 changed files with 50 additions and 38 deletions

View File

@ -45,8 +45,6 @@ char tile_W[8] = {'~', '.', ' ', ' ', ' ', '.', '~', '^'};
// Our mouse events
MEVENT event;
#include "engineMaps.h"
int help()
{
char buffer[1] = "";
@ -64,11 +62,45 @@ int help()
int colorPick()
{
return 0;
char buffer1[8] = "";
char buffer2[8] = "";
uint_fast8_t a;
uint_fast8_t b;
echo();
clear();
mvprintw(0, 0, "Background:");
mvprintw(1, 0, "Black) 0");
mvprintw(2, 0, "Red) 1");
mvprintw(3, 0, "Green) 2");
mvprintw(4, 0, "Yellow) 3");
mvprintw(5, 0, "Blue) 4");
mvprintw(6, 0, "Magenta) 5");
mvprintw(7, 0, "Cyan) 6");
mvprintw(8, 0, "White) 7\n");
getnstr(buffer1, 8);
mvprintw(10, 0, "Foreground:");
mvprintw(11, 0, "Black) 0");
mvprintw(12, 0, "Red) 1");
mvprintw(13, 0, "Green) 2");
mvprintw(14, 0, "Yellow) 3");
mvprintw(15, 0, "Blue) 4");
mvprintw(16, 0, "Magenta) 5");
mvprintw(17, 0, "Cyan) 6");
mvprintw(18, 0, "White) 7\n");
getnstr(buffer2, 8);
a = atoi(buffer1);
b = atoi(buffer2);
return 10 * (a) + (b + 1);
}
#include "engineMaps.h"
int main()
{
// Start our game engine and start a blank map
@ -225,7 +257,7 @@ int main()
mvprintw(0, 0, "Map: %i X: %li Y: %li", aMap, x, y);
mvprintw(1, 0, "Tooltip: %c Color: %i Walkable: %s", (char)tip, tipColor,
tipWalk ? "True" : "False");
mvprintw(2,0,"Press 'h' for help.");
mvprintw(2, 0, "Press 'h' for help.");
// Display our cursor based on what tool we're using.
switch (tool)

View File

@ -40,7 +40,6 @@ int addBase()
// Add a new info tile
int addInfo()
{
char buffer1[8] = "";
char buffer2[1] = "";
// Allocate space for the new tile.
@ -59,16 +58,13 @@ int addInfo()
mvprintw(3, 0, "What character would you like to print? ");
getnstr(buffer2, 1);
mvprintw(4, 0, "What colour code would you like to use? ");
getnstr(buffer1, 8);
mvprintw(5, 0, "What would you like the sign to say? ");
mvprintw(4, 0, "What would you like the sign to say? ");
getnstr(map[aMap].Info[map[aMap].nInfo - 1].dialog, 255);
// Otherwise, set our values
map[aMap].Info[map[aMap].nInfo - 1].x = x + (xmax / 2);
map[aMap].Info[map[aMap].nInfo - 1].y = y + (ymax / 2);
map[aMap].Info[map[aMap].nInfo - 1].c = atoi(buffer1);
map[aMap].Info[map[aMap].nInfo - 1].c = colorPick();
map[aMap].Info[map[aMap].nInfo - 1].t = buffer2[0];
map[aMap].Info[map[aMap].nInfo - 1].active = 1;
@ -80,7 +76,6 @@ int addInfo()
int addItem()
{
char buffer1[1];
char buffer2[8];
char buffer3[8];
// Allocate space for the new tile.
@ -99,10 +94,7 @@ int addItem()
mvprintw(3, 0, "What character would you like to print? ");
getnstr(buffer1, 1);
mvprintw(4, 0, "What colour code would you like to use? ");
getnstr(buffer2, 8);
mvprintw(5, 0, "What item is this? (ID#) ");
mvprintw(4, 0, "What item is this? (ID#) ");
getnstr(buffer3, 8);
map[aMap].Item[map[aMap].nItem - 1].ID = atoi(buffer3);
@ -110,7 +102,7 @@ int addItem()
map[aMap].Item[map[aMap].nItem - 1].x = x + (xmax / 2);
map[aMap].Item[map[aMap].nItem - 1].y = y + (ymax / 2);
map[aMap].Item[map[aMap].nItem - 1].t = buffer1[0];
map[aMap].Item[map[aMap].nItem - 1].c = atoi(buffer2);
map[aMap].Item[map[aMap].nItem - 1].c = colorPick();
map[aMap].Item[map[aMap].nItem - 1].active = 1;
// End gracefully
@ -121,7 +113,6 @@ int addItem()
int addDoor()
{
char buffer1[1];
char buffer2[8];
char buffer3[8];
char buffer4[8];
char buffer5[8];
@ -142,22 +133,20 @@ int addDoor()
echo();
mvprintw(3, 0, "What character would you like to print? ");
getnstr(buffer1, 1);
mvprintw(4, 0, "What colour code would you like to use? ");
getnstr(buffer2, 8);
mvprintw(5, 0, "Which map will this door go to? ");
mvprintw(4, 0, "Which map will this door go to? ");
getnstr(buffer3, 8);
mvprintw(6, 0, "What X value? ");
mvprintw(5, 0, "What X value? ");
getnstr(buffer4, 8);
mvprintw(7, 0, "What Y value? ");
mvprintw(6, 0, "What Y value? ");
getnstr(buffer5, 8);
mvprintw(8, 0, "Is this door locked? ");
mvprintw(7, 0, "Is this door locked? ");
getnstr(buffer6, 8);
// Otherwise, set our values
map[aMap].Door[map[aMap].nDoor - 1].x = x + (xmax / 2);
map[aMap].Door[map[aMap].nDoor - 1].y = y + (ymax / 2);
map[aMap].Door[map[aMap].nDoor - 1].t = buffer1[0];
map[aMap].Door[map[aMap].nDoor - 1].c = atoi(buffer2);
map[aMap].Door[map[aMap].nDoor - 1].c = colorPick();
map[aMap].Door[map[aMap].nDoor - 1].lock = atoi(buffer6);
map[aMap].Door[map[aMap].nDoor - 1].ID = atoi(buffer3);
map[aMap].Door[map[aMap].nDoor - 1].nx = atoi(buffer4);
@ -187,7 +176,6 @@ int addChar()
char bufferC[8];
char bufferD[8];
char bufferE[8];
// Allocate space for the new tile.
map[aMap].nChar++;
@ -205,9 +193,6 @@ int addChar()
mvprintw(3, 0, "What character would you like to print? ");
getnstr(bufferD, 8);
mvprintw(4, 0, "What colour code would you like to use? ");
getnstr(bufferE, 8);
mvprintw(5, 0, "Is this guy passive or aggressive? (1 = aggressive, 0 = passive) ");
getnstr(buffer1, 1);
mvprintw(6, 0, "Does he wander or stay still? (1 = wanders, 0 = still) ");
@ -245,7 +230,7 @@ int addChar()
map[aMap].Char[map[aMap].nChar - 1].x = x + (xmax / 2);
map[aMap].Char[map[aMap].nChar - 1].y = y + (ymax / 2);
map[aMap].Char[map[aMap].nChar - 1].t = bufferD[0];
map[aMap].Char[map[aMap].nChar - 1].c = atoi(bufferE);
map[aMap].Char[map[aMap].nChar - 1].c = colorPick();
map[aMap].Char[map[aMap].nChar - 1].type = atoi(buffer1);
map[aMap].Char[map[aMap].nChar - 1].move = atoi(buffer2);
@ -318,25 +303,20 @@ int delTile()
int turnTip()
{
char buffer2[1] = "";
char buffer3[8] = "";
char buffer4[1] = "";
uint_fast8_t colr = 0;
uint_fast8_t walk = 0;
echo();
// Ask our necessary details.
mvprintw(3, 0, "What character would you like to print? ");
mvprintw(4, 0, "What character would you like to print? ");
getnstr(buffer2, 1);
mvprintw(4, 0, "What colour code would you like to use? ");
getnstr(buffer3, 8);
colr = atoi(buffer3);
mvprintw(5, 0, "Are these tiles walkable? (1 = yes, 0 = no) ");
getnstr(buffer4, 1);
walk = atoi(buffer4);
// Set our variables to our aquired values
tipColor = colr;
tipColor = colorPick();
tipWalk = walk;
tip = buffer2[0];