From a76b00c511db1d3529bba51475a24ca93d12913e Mon Sep 17 00:00:00 2001 From: Joursoir Date: Tue, 5 Jan 2021 18:07:25 +0300 Subject: client gui: add support windows --- src/client/gui/Makefile | 13 ++++++++++--- src/client/gui/OO_FLTK.cpp | 3 +-- src/client/gui/OO_FLTK.hpp | 6 +++--- src/client/gui/WantChat.exe | Bin 0 -> 1134821 bytes 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 src/client/gui/WantChat.exe (limited to 'src/client/gui') diff --git a/src/client/gui/Makefile b/src/client/gui/Makefile index a72e64d..d317bfc 100644 --- a/src/client/gui/Makefile +++ b/src/client/gui/Makefile @@ -1,8 +1,15 @@ CPP = g++ -CPPFLAGS = -Wall -g -lfltk +CPPFLAGS = -Wall -g +LDFLAGS = +ifeq ($(OS),Windows_NT) + CPPFLAGS += -static-libgcc -static-libstdc++ $(shell fltk-config --cxxflags) + LDFLAGS += $(shell fltk-config --ldflags) -lws2_32 +else + CPPFLAGS += -lfltk +endif SOURCES = main.cpp OO_FLTK.cpp ../ClientBase.cpp Client.cpp OBJECTS = main.o OO_FLTK.o ClientBase.o Client.o -EXECUTABLE = client +EXECUTABLE = WantChat .PHONY: all clean @@ -12,7 +19,7 @@ clean: rm -rf $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(CPP) $(CPPFLAGS) -o $(EXECUTABLE) $(OBJECTS) + $(CPP) $(CPPFLAGS) $(OBJECTS) $(LDFLAGS) -o $(EXECUTABLE) $(OBJECTS): $(CPP) -c $(CPPFLAGS) $(SOURCES) \ No newline at end of file diff --git a/src/client/gui/OO_FLTK.cpp b/src/client/gui/OO_FLTK.cpp index 6492481..89e88e3 100644 --- a/src/client/gui/OO_FLTK.cpp +++ b/src/client/gui/OO_FLTK.cpp @@ -28,7 +28,7 @@ ChatInput::ChatInput(int x, int y, int w, int h, maximum_size(max_usermsg_len); } -void ChatInput::SendMessage(void *user) +void ChatInput::SendMsg(void *user) { if(strlen(value()) < 1) return; @@ -36,7 +36,6 @@ void ChatInput::SendMessage(void *user) Client *cl = (Client *)user; if(cl != 0) { // send message to server const char *message = value(); - printf("U sent: %s\n", message); cl->SendMessage(message); } diff --git a/src/client/gui/OO_FLTK.hpp b/src/client/gui/OO_FLTK.hpp index a2f7183..334f46a 100644 --- a/src/client/gui/OO_FLTK.hpp +++ b/src/client/gui/OO_FLTK.hpp @@ -21,11 +21,11 @@ class ChatInput : public Fl_Input { public: ChatInput(int x, int y, int w, int h, const char *lb = 0, Client *user = 0); - virtual ~ChatInput() {} - virtual void SendMessage(void *user); + ~ChatInput() {} + void SendMsg(void *user); private: static void CallbackFunction(Fl_Widget *w, void *user) - { static_cast(w)->SendMessage(user); } + { static_cast(w)->SendMsg(user); } }; class ChatBaseOutput : public Fl_Output { diff --git a/src/client/gui/WantChat.exe b/src/client/gui/WantChat.exe new file mode 100644 index 0000000..ca27ced Binary files /dev/null and b/src/client/gui/WantChat.exe differ -- cgit v1.2.3-18-g5258