Added new Whirling module, just blank for now

This commit is contained in:
Bob Polis 2021-09-05 23:21:41 +02:00
parent ab024a7ec0
commit 92bc54e3a6
3 changed files with 118 additions and 0 deletions

62
modules/Whirling/Makefile Normal file
View File

@ -0,0 +1,62 @@
LIBNAME := $(shell basename $$(pwd))
MAJOR := 1
MINOR := 0.0
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LINKERNAME := $(LIBNAME).dylib
SONAME := $(LIBNAME).$(MAJOR).dylib
REALNAME := $(LINKERNAME)
else
LINKERNAME := $(LIBNAME).so
SONAME := $(LINKERNAME).$(MAJOR)
REALNAME := $(SONAME).$(MINOR)
endif
PREFIX ?= ../..
LIBDIR ?= $(PREFIX)/plugins
SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS))
DEPS := $(subst .cpp,.d,$(SRCS))
HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp))
CXX ?= g++
CXXFLAGS := $(CXXFLAGS) -Wshadow -Wall -Wpedantic -Wextra -g -fno-strict-aliasing -std=c++17 -fPIC
ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0
else
CXXFLAGS += -D NDEBUG -O3
endif
LDLIBS := -lcairo -lscscreensaver
RM := /bin/rm -f
INSTALL := /usr/bin/install -c
.PHONY: all clean install
all: $(REALNAME)
$(REALNAME): $(OBJS) $(DEPS)
ifeq ($(UNAME_S),Darwin)
$(CXX) -dynamiclib -o $(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(OBJS)
else
$(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS)
endif
%.o: %.cpp %.d Makefile
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
clean:
$(RM) $(OBJS) $(DEPS) $(REALNAME)
install: $(REALNAME)
$(INSTALL) -d $(LIBDIR)
$(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver

View File

@ -0,0 +1,38 @@
//
// Whirling.cpp
// Whirling
//
// Created by Bob Polis at 2021-09-05
// Copyright (c) 2021 SwiftCoder. All rights reserved.
//
#include "Whirling.hpp"
#include <libscscreensaver.hpp>
class Whirling : public ScreensaverPlugin {
public:
Whirling() = default;
~Whirling() = default;
int fps() const override;
void update() override;
void render() override;
};
ScreensaverPlugin* create_instance() {
return new Whirling;
}
int Whirling::fps() const {
return 30;
}
void Whirling::update() {
// adjust state for next render
}
void Whirling::render() {
// render one frame based on current state
}

View File

@ -0,0 +1,18 @@
//
// Whirling.hpp
// Whirling
//
// Created by Bob Polis at 2021-09-05
// Copyright (c) 2021 SwiftCoder. All rights reserved.
//
#ifndef _Whirling_H_
#define _Whirling_H_
class ScreensaverPlugin;
extern "C" {
ScreensaverPlugin* create_instance();
}
#endif // _Whirling_H_