ready to make a library
This commit is contained in:
73
makelib.mak
Normal file
73
makelib.mak
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
#Compiler, Archiver and Linker
|
||||||
|
CC := g++
|
||||||
|
AR := ar
|
||||||
|
ARFLAGS := rcs
|
||||||
|
|
||||||
|
#The Target Static Library
|
||||||
|
#Conventionally, static libraries start with 'lib' and end in '.a'
|
||||||
|
TARGET := libdesktoplib.a
|
||||||
|
|
||||||
|
#The Directories, Source, Includes, Objects, Binary and Resources
|
||||||
|
SRCDIR := src
|
||||||
|
BUILDDIR := bin
|
||||||
|
TARGETDIR := out
|
||||||
|
SRCEXT := cpp
|
||||||
|
DEPEXT := d
|
||||||
|
OBJEXT := o
|
||||||
|
|
||||||
|
#Flags, Libraries and Includes
|
||||||
|
ROOT := ./
|
||||||
|
CFLAGS := -std=c++20 -O2 \
|
||||||
|
-Wall -Werror -Wextra \
|
||||||
|
-Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align \
|
||||||
|
-Wunused -Woverloaded-virtual -Wconversion \
|
||||||
|
-Wsign-conversion -Wnull-dereference -Wdouble-promotion \
|
||||||
|
-Wformat=2 -Wimplicit-fallthrough -Wsuggest-override \
|
||||||
|
-Wextra-semi -Wduplicated-cond -Wduplicated-branches \
|
||||||
|
-Wlogical-op -Wuseless-cast
|
||||||
|
INC := -I./src/
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
#DO NOT EDIT BELOW THIS LINE
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
|
||||||
|
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
|
||||||
|
|
||||||
|
#Default Make
|
||||||
|
all: directories $(TARGET)
|
||||||
|
|
||||||
|
#Remake
|
||||||
|
remake: cleaner all
|
||||||
|
|
||||||
|
#Make the Directories
|
||||||
|
directories:
|
||||||
|
@mkdir -p $(TARGETDIR)
|
||||||
|
@mkdir -p $(BUILDDIR)
|
||||||
|
|
||||||
|
#Clean only Objects
|
||||||
|
clean:
|
||||||
|
@$(RM) -rf $(BUILDDIR)
|
||||||
|
|
||||||
|
#Full Clean, Objects and Binaries
|
||||||
|
cleaner: clean
|
||||||
|
@$(RM) -rf $(TARGETDIR)
|
||||||
|
|
||||||
|
#Pull in dependency info for *existing* .o files
|
||||||
|
-include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))
|
||||||
|
|
||||||
|
#Create Static Library (Archive)
|
||||||
|
$(TARGET): $(OBJECTS)
|
||||||
|
$(AR) $(ARFLAGS) $(TARGETDIR)/$(TARGET) $^
|
||||||
|
|
||||||
|
#Compile
|
||||||
|
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
|
||||||
|
@$(CC) $(CFLAGS) -MM $(SRCDIR)/$*.$(SRCEXT) > $(BUILDDIR)/$*.$(DEPEXT)
|
||||||
|
@cp -f $(BUILDDIR)/$*.$(DEPEXT) $(BUILDDIR)/$*.$(DEPEXT).tmp
|
||||||
|
@sed -e 's|.*:|$(BUILDDIR)/$*.$(OBJEXT):|' < $(BUILDDIR)/$*.$(DEPEXT).tmp > $(BUILDDIR)/$*.$(DEPEXT)
|
||||||
|
@sed -e 's/.*://' -e 's/\\$$//' < $(BUILDDIR)/$*.$(DEPEXT).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(BUILDDIR)/$*.$(DEPEXT)
|
||||||
|
@rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
|
||||||
|
|
||||||
|
#Non-File Targets
|
||||||
|
.PHONY: all remake clean cleaner
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#ifdef DESKTOPLIB_TEST
|
||||||
|
|
||||||
#include <desktoplib/terminal/Terminal.hpp>
|
#include <desktoplib/terminal/Terminal.hpp>
|
||||||
#include <desktoplib/terminal/ui/Box.hpp>
|
#include <desktoplib/terminal/ui/Box.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -109,3 +111,5 @@ int main() {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "InnerScroll.hpp"
|
#include "InnerScroll.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace ckitty::terminal {
|
namespace ckitty::terminal {
|
||||||
|
|
||||||
InnerScroll::InnerScroll(pos p, int w, int h, Content& c)
|
InnerScroll::InnerScroll(pos p, int w, int h, Content& c)
|
||||||
@@ -27,7 +29,7 @@ namespace ckitty::terminal {
|
|||||||
if (end - start < viewH) {
|
if (end - start < viewH) {
|
||||||
for (int y = (end - start); y < viewH; ++y) {
|
for (int y = (end - start); y < viewH; ++y) {
|
||||||
t << pos{ position.x, position.y + y }
|
t << pos{ position.x, position.y + y }
|
||||||
<< std::string(contentWidth, ' ');
|
<< std::string(std::size_t(contentWidth), ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,8 +46,8 @@ namespace ckitty::terminal {
|
|||||||
int thumbH = std::max(1, (viewH * viewH) / totalH);
|
int thumbH = std::max(1, (viewH * viewH) / totalH);
|
||||||
|
|
||||||
// Calculate thumb position
|
// Calculate thumb position
|
||||||
float scrollPercent = (float)scrollY / (totalH - viewH);
|
float scrollPercent = float(scrollY) / (totalH - viewH);
|
||||||
int thumbPos = (int)(scrollPercent * (viewH - thumbH));
|
int thumbPos = int(scrollPercent * (viewH - thumbH));
|
||||||
|
|
||||||
t << thumbColor;
|
t << thumbColor;
|
||||||
for (int y = 0; y < thumbH; ++y) {
|
for (int y = 0; y < thumbH; ++y) {
|
||||||
|
|||||||
Reference in New Issue
Block a user