-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dce641d
commit b3b2994
Showing
25 changed files
with
57,907 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build | ||
.DS_Store | ||
.vscode | ||
.idea | ||
imgui.ini | ||
*.o |
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 |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# | ||
# Cross Platform Makefile | ||
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X | ||
# | ||
# You will need GLFW (http://www.glfw.org): | ||
# Linux: | ||
# apt-get install libglfw-dev | ||
# Mac OS X: | ||
# brew install glfw | ||
# MSYS2: | ||
# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw | ||
# | ||
|
||
# CXX = g++ | ||
#CXX = clang++ | ||
|
||
EXE_BASE = customchar-ui | ||
IMGUI_DIR = ./libs/imgui | ||
SOURCES = main.cpp | ||
SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp | ||
SOURCES += $(IMGUI_DIR)/backends/imgui_impl_glfw.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp | ||
SOURCES += chat_message.cpp chat_history.cpp | ||
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) | ||
UNAME_S := $(shell uname -s) | ||
LINUX_GL_LIBS = -lGL | ||
|
||
CXXFLAGS = -std=c++2a -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends -I./libs/imgui/include -pthread | ||
CXXFLAGS += -g -Wall -Wformat | ||
LIBS = | ||
|
||
##--------------------------------------------------------------------- | ||
## OPENGL ES | ||
##--------------------------------------------------------------------- | ||
|
||
## This assumes a GL ES library available in the system, e.g. libGLESv2.so | ||
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_ES2 | ||
# LINUX_GL_LIBS = -lGLESv2 | ||
|
||
##--------------------------------------------------------------------- | ||
## BUILD FLAGS PER PLATFORM | ||
##--------------------------------------------------------------------- | ||
|
||
ifeq ($(UNAME_S), Linux) #LINUX | ||
CXX = g++-11 | ||
ECHO_MESSAGE = "Linux" | ||
LIBS += $(LINUX_GL_LIBS) `pkg-config --static --libs glfw3` | ||
|
||
CXXFLAGS += `pkg-config --cflags glfw3` | ||
CFLAGS = $(CXXFLAGS) | ||
|
||
EXE = $(EXE_BASE) | ||
endif | ||
|
||
ifeq ($(UNAME_S), Darwin) #APPLE | ||
ECHO_MESSAGE = "Mac OS X" | ||
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo | ||
LIBS += -L/usr/local/lib -L/opt/local/lib -L/opt/homebrew/lib | ||
#LIBS += -lglfw3 | ||
LIBS += -lglfw | ||
|
||
CXXFLAGS += -I/usr/local/include -I/opt/local/include -I/opt/homebrew/include | ||
CFLAGS = $(CXXFLAGS) | ||
|
||
EXE = $(EXE_BASE).app | ||
endif | ||
|
||
ifeq ($(OS), Windows_NT) | ||
ECHO_MESSAGE = "MinGW" | ||
LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 | ||
|
||
CXXFLAGS += `pkg-config --cflags glfw3` | ||
CFLAGS = $(CXXFLAGS) | ||
|
||
EXE = $(EXE_BASE).exe | ||
endif | ||
|
||
##--------------------------------------------------------------------- | ||
## BUILD RULES | ||
##--------------------------------------------------------------------- | ||
|
||
%.o:%.cpp | ||
$(CXX) $(CXXFLAGS) -c -o $@ $< | ||
|
||
%.o:src/%.cpp | ||
$(CXX) $(CXXFLAGS) -c -o $@ $< | ||
|
||
%.o:$(IMGUI_DIR)/%.cpp | ||
$(CXX) $(CXXFLAGS) -c -o $@ $< | ||
|
||
%.o:$(IMGUI_DIR)/backends/%.cpp | ||
$(CXX) $(CXXFLAGS) -c -o $@ $< | ||
|
||
all: $(EXE) | ||
# Probably a better way to do this, but this works for now | ||
rm -rf build | ||
mkdir -p build | ||
find . -name "*.o" -exec mv {} ./build \; | ||
mv $(EXE) ./build | ||
# Success message | ||
@echo Build complete for $(ECHO_MESSAGE) | ||
|
||
$(EXE): $(OBJS) | ||
$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) | ||
|
||
clean: | ||
rm -f $(EXE) $(OBJS) | ||
rm -rf build |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# CustomChar UI | ||
|
||
C++ UI for CustomChar using Dear ImGui. | ||
|
||
- [ ] Basic chat window. | ||
- [ ] Format messages. | ||
- [ ] Animation when talking. | ||
- [ ] Tranparent window. | ||
- [ ] Custom font. | ||
- [ ] Dynamic window size. |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "chat_history.h" | ||
|
||
ChatHistory::ChatHistory() { old_size = 0; } | ||
|
||
ChatHistory::~ChatHistory() {} | ||
|
||
void ChatHistory::add_message(std::string message, std::string sender) { | ||
ChatMessage new_message; | ||
new_message.set_time(); | ||
new_message.set_message(message, sender); | ||
hist_vec.push_back(new_message); | ||
} | ||
|
||
std::vector<ChatMessage> ChatHistory::get_char_history() { return hist_vec; } | ||
|
||
bool ChatHistory::has_new_message() { | ||
if (old_size != hist_vec.size()) { | ||
old_size = hist_vec.size(); | ||
return true; | ||
} | ||
|
||
return false; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#include "chat_message.h" | ||
|
||
class ChatHistory { | ||
public: | ||
ChatHistory(); | ||
~ChatHistory(); | ||
|
||
void add_message(std::string, std::string); | ||
std::vector<ChatMessage> get_char_history(); | ||
bool has_new_message(); | ||
|
||
private: | ||
std::vector<ChatMessage> hist_vec; | ||
std::vector<ChatMessage>::size_type old_size; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "chat_message.h" | ||
|
||
#include <ctime> | ||
|
||
ChatMessage::ChatMessage() { | ||
message = ""; | ||
sender = "Unknown"; | ||
} | ||
|
||
ChatMessage::ChatMessage(std::string in_message, std::string in_sender) { | ||
set_message(in_message, in_sender); | ||
} | ||
|
||
ChatMessage::~ChatMessage() {} | ||
|
||
void ChatMessage::set_message(std::string input) { message = input; } | ||
|
||
void ChatMessage::set_message(std::string in_message, std::string in_sender) { | ||
message = in_message; | ||
sender = in_sender; | ||
} | ||
|
||
void ChatMessage::set_sender(std::string input) { sender = input; } | ||
|
||
void ChatMessage::set_time() { | ||
time_t time_now = time(NULL); | ||
char* ct = ctime(&time_now); | ||
timestamp = ct; | ||
} | ||
|
||
std::string ChatMessage::get_message() { return message; } | ||
|
||
std::string ChatMessage::get_sender() { return sender; } | ||
|
||
std::string ChatMessage::get_time() { return timestamp; } |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <ctime> | ||
#include <string> | ||
|
||
class ChatMessage { | ||
public: | ||
ChatMessage(); | ||
ChatMessage(std::string, std::string); | ||
~ChatMessage(); | ||
|
||
void set_message(std::string); | ||
void set_message(std::string, std::string); | ||
void set_sender(std::string); | ||
void set_time(); | ||
|
||
std::string get_message(); | ||
std::string get_sender(); | ||
std::string get_time(); | ||
|
||
private: | ||
std::string message; | ||
std::string sender; | ||
std::string timestamp; | ||
}; |
Oops, something went wrong.