diff options
author | Joursoir <chat@joursoir.net> | 2020-12-07 11:47:44 +0000 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2020-12-07 11:47:44 +0000 |
commit | 9457a74c256bdf090667a5b19238cb5dfd7e031e (patch) | |
tree | ceb6fbcff7ec554572c01f43ee3f448682a3b445 | |
parent | e99a03a838ddcf9eecadc10a7f71837afac3b99c (diff) | |
download | want-chat-9457a74c256bdf090667a5b19238cb5dfd7e031e.tar.gz want-chat-9457a74c256bdf090667a5b19238cb5dfd7e031e.tar.bz2 want-chat-9457a74c256bdf090667a5b19238cb5dfd7e031e.zip |
add gui without functionality
-rw-r--r-- | src/client/clui/Makefile (renamed from src/client_clui/Makefile) | 0 | ||||
-rw-r--r-- | src/client/clui/client.cpp (renamed from src/client_clui/client.cpp) | 0 | ||||
-rw-r--r-- | src/client/clui/clui.cpp (renamed from src/client_clui/clui.cpp) | 0 | ||||
-rw-r--r-- | src/client/clui/clui.hpp (renamed from src/client_clui/clui.hpp) | 0 | ||||
-rw-r--r-- | src/client/clui/user.cpp (renamed from src/client_clui/user.cpp) | 0 | ||||
-rw-r--r-- | src/client/clui/user.hpp (renamed from src/client_clui/user.hpp) | 0 | ||||
-rw-r--r-- | src/client/gui/Makefile | 18 | ||||
-rwxr-xr-x | src/client/gui/client | bin | 0 -> 46288 bytes | |||
-rw-r--r-- | src/client/gui/client.cpp | 109 |
9 files changed, 127 insertions, 0 deletions
diff --git a/src/client_clui/Makefile b/src/client/clui/Makefile index 071462b..071462b 100644 --- a/src/client_clui/Makefile +++ b/src/client/clui/Makefile diff --git a/src/client_clui/client.cpp b/src/client/clui/client.cpp index 83f8ef0..83f8ef0 100644 --- a/src/client_clui/client.cpp +++ b/src/client/clui/client.cpp diff --git a/src/client_clui/clui.cpp b/src/client/clui/clui.cpp index 78fd226..78fd226 100644 --- a/src/client_clui/clui.cpp +++ b/src/client/clui/clui.cpp diff --git a/src/client_clui/clui.hpp b/src/client/clui/clui.hpp index 0373f95..0373f95 100644 --- a/src/client_clui/clui.hpp +++ b/src/client/clui/clui.hpp diff --git a/src/client_clui/user.cpp b/src/client/clui/user.cpp index d075751..d075751 100644 --- a/src/client_clui/user.cpp +++ b/src/client/clui/user.cpp diff --git a/src/client_clui/user.hpp b/src/client/clui/user.hpp index a203320..a203320 100644 --- a/src/client_clui/user.hpp +++ b/src/client/clui/user.hpp diff --git a/src/client/gui/Makefile b/src/client/gui/Makefile new file mode 100644 index 0000000..2bc0969 --- /dev/null +++ b/src/client/gui/Makefile @@ -0,0 +1,18 @@ +CPP = g++ +CPPFLAGS = -Wall -g -lfltk +SOURCES = client.cpp +OBJECTS = $(SOURCES:.cpp=.o) +EXECUTABLE = client + +.PHONY: all clean + +all: $(EXECUTABLE) + +clean: + rm -rf $(OBJECTS) $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(CPP) $(CPPFLAGS) -o $(EXECUTABLE) $(OBJECTS) + +$(OBJECTS): + $(CPP) -c $(CPPFLAGS) $(SOURCES)
\ No newline at end of file diff --git a/src/client/gui/client b/src/client/gui/client Binary files differnew file mode 100755 index 0000000..778511e --- /dev/null +++ b/src/client/gui/client diff --git a/src/client/gui/client.cpp b/src/client/gui/client.cpp new file mode 100644 index 0000000..42407aa --- /dev/null +++ b/src/client/gui/client.cpp @@ -0,0 +1,109 @@ +#include <FL/Fl.H> +#include <FL/Fl_Window.H> +#include <FL/Fl_Box.H> +#include <FL/Fl_Multiline_Output.H> +#include <FL/Fl_Multiline_Input.H> + +const int spacing = 20; +const int border = 2; + +const int chat_w = 695; +const int chat_h = 440; +const int player_w = 225; +const int player_h = chat_h; +const int input_w = chat_w + border + spacing + border + player_w; +const int input_h = 55; + +const int win_w = spacing + border + (input_w) + border + spacing; +const int win_h = spacing + border + chat_h + border + + spacing + border + input_h + border + spacing; + +int main(int argc, char **argv) +{ + Fl_Window *win = new Fl_Window(win_w, win_h, "WantChat"); + win->color(FL_BLACK); + + // + + Fl_Box *outline_chat = new Fl_Box( + spacing, spacing, chat_w+border*2, chat_h+border*2); + outline_chat->box(FL_FLAT_BOX); + outline_chat->color(FL_WHITE); + + + Fl_Multiline_Output *box_chat = new Fl_Multiline_Output( + spacing+border, spacing+border, chat_w, chat_h); + box_chat->box(FL_FLAT_BOX); + box_chat->color(FL_BLACK); + + box_chat->textfont(FL_COURIER); + box_chat->textsize(20); + box_chat->textcolor(FL_WHITE); + + // only for test, please not going to beat me :) + char buffer[2048] = ""; + for(int i = 0; i < 18; i++) + { + sprintf(buffer, "%sNickname: some text some text some text some text some te\n", buffer); + } + box_chat->value(buffer); + + // + + int start_players_x = spacing + border + chat_w + border + spacing; + Fl_Box *outline_players = new Fl_Box( + start_players_x, spacing, player_w+border*2, player_h+border*2); + outline_players->box(FL_FLAT_BOX); + outline_players->color(FL_WHITE); + + + Fl_Multiline_Output *box_players = new Fl_Multiline_Output( + start_players_x + border, spacing+border, player_w, player_h); + box_players->box(FL_FLAT_BOX); + box_players->color(FL_BLACK); + + box_players->textfont(FL_COURIER); + box_players->textsize(20); + box_players->textcolor(FL_WHITE); + + // only for test, please not going to beat me :) (x2) + char buffer1[1024] = ""; + for(int i = 0; i < 18; i++) + { + sprintf(buffer1, "%sHackerspronickname\n", buffer1); + } + box_players->value(buffer1); + + // + + int start_input_y = spacing + border + chat_h + border + spacing; + Fl_Box *outline_input = new Fl_Box( + spacing, start_input_y, input_w+border*2, input_h+border*2); + outline_input->box(FL_FLAT_BOX); + outline_input->color(FL_WHITE); + + + Fl_Multiline_Input *box_input = new Fl_Multiline_Input(spacing+border, + start_input_y+border, input_w, input_h); + + box_input->box(FL_FLAT_BOX); + box_input->color(FL_BLACK); + + box_input->cursor_color(FL_WHITE); + box_input->textfont(FL_COURIER); + box_input->textsize(20); + box_input->textcolor(FL_WHITE); + + // + + win->end(); + win->show(); + return Fl::run(); +} + +// 59 - 1 - 20 + +/* I need this widgets: +- Button +- Inputbox +- Box */
\ No newline at end of file |