Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0052'
Browse files Browse the repository at this point in the history
  • Loading branch information
rm-code committed Jan 18, 2015
2 parents ceb17f0 + 247914c commit 5e8dd3a
Show file tree
Hide file tree
Showing 18 changed files with 1,457 additions and 166 deletions.
6 changes: 5 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# LoveGit
# LoGiVi

LoGiVi the "lovely Git-Viewer" is a git-repository visualisation tool inspired by [Gource](https://code.google.com/p/gource/). It was written from scratch using [Lua](http://www.lua.org/) and the [LÖVE](https://love2d.org/) framework.

Check the [wiki](https://bitbucket.org/rmcode/logivi/wiki/Home) for instructions and further information.
30 changes: 24 additions & 6 deletions conf.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
--==================================================================================================
-- Copyright (C) 2014 - 2015 by Robert Machmer =
-- =
-- Permission is hereby granted, free of charge, to any person obtaining a copy =
-- of this software and associated documentation files (the "Software"), to deal =
-- in the Software without restriction, including without limitation the rights =
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell =
-- copies of the Software, and to permit persons to whom the Software is =
-- furnished to do so, subject to the following conditions: =
-- =
-- The above copyright notice and this permission notice shall be included in =
-- all copies or substantial portions of the Software. =
-- =
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR =
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, =
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE =
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER =
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, =
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN =
-- THE SOFTWARE. =
--==================================================================================================

local GAME_TITLE = "LoGiVi";

local LOVE_VERSION = "0.9.1";
local LOVE_VERSION = "0.9.2";

local GAME_VERSION = "0000";
local GAME_VERSION = "0052";

-- ------------------------------------------------
-- Local variables
Expand Down Expand Up @@ -73,7 +95,3 @@ function getVersion()
return GAME_VERSION;
end
end

--==================================================================================================
-- Created 01.10.14 - 11:29 =
--==================================================================================================
113 changes: 113 additions & 0 deletions lib/Camera.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
--===============================================================================--
-- --
-- Copyright (c) 2014 Robert Machmer --
-- --
-- This software is provided 'as-is', without any express or implied --
-- warranty. In no event will the authors be held liable for any damages --
-- arising from the use of this software. --
-- --
-- Permission is granted to anyone to use this software for any purpose, --
-- including commercial applications, and to alter it and redistribute it --
-- freely, subject to the following restrictions: --
-- --
-- 1. The origin of this software must not be misrepresented; you must not --
-- claim that you wrote the original software. If you use this software --
-- in a product, an acknowledgment in the product documentation would be --
-- appreciated but is not required. --
-- 2. Altered source versions must be plainly marked as such, and must not be --
-- misrepresented as being the original software. --
-- 3. This notice may not be removed or altered from any source distribution. --
-- --
--===============================================================================--

local Camera = {};

function Camera.new()
local self = {};

-- ------------------------------------------------
-- Private Variables
-- ------------------------------------------------

local x, y = 0, 0;
local sx, sy = 1, 1;
local graphMinX, graphMaxX, graphMinY, graphMaxY;

-- ------------------------------------------------
-- Private Methods
-- ------------------------------------------------

local function debugDraw()
love.graphics.setColor(180, 180, 180, 50);
love.graphics.rectangle('fill', graphMinX, graphMinY, graphMaxX - graphMinX, graphMaxY - graphMinY);
love.graphics.setColor(255, 0, 0, 100);
love.graphics.circle('fill', graphMinX + (graphMaxX - graphMinX) * 0.5, graphMinY + (graphMaxY - graphMinY) * 0.5, 2);
love.graphics.setColor(255,255,255, 255);
end

-- ------------------------------------------------
-- Public Methods
-- ------------------------------------------------

function self:update(dt)
self:track(graphMinX + (graphMaxX - graphMinX) * 0.5, graphMinY + (graphMaxY - graphMinY) * 0.5, 3, dt);
end

function self:set()
love.graphics.push();
love.graphics.scale(sx, sy);
love.graphics.translate(-x, -y);
love.graphics.translate(love.graphics.getWidth() / (2 * sx), love.graphics.getHeight() / (2 * sy));
end

function self:unset()
love.graphics.pop();
end

function self:track(tarX, tarY, speed, dt)
x = x - (x - math.floor(tarX)) * dt * speed;
y = y - (y - math.floor(tarY)) * dt * speed;
end

function self:checkEdges(tree)
local rootX = tree:getX();
local rootY = tree:getY();
graphMinX, graphMaxX, graphMinY, graphMaxY = rootX, rootX, rootY, rootY;

local function traverseNodes(node, depth)
if node:getType() == 'folder' then

-- Find the edges.
local x, y = node:getPosition();
if x < graphMinX then
graphMinX = x;
elseif x > graphMaxX then
graphMaxX = x;
end

if y < graphMinY then
graphMinY = y;
elseif y > graphMaxY then
graphMaxY = y;
end

for key, child in pairs(node:getChildren()) do
traverseNodes(child, depth + 1);
end
end
end
traverseNodes(tree, 0);
end

return self;
end

-- ------------------------------------------------
-- Return Module
-- ------------------------------------------------

return Camera;

--==================================================================================================
-- Created 08.09.14 - 13:34 =
--==================================================================================================
24 changes: 21 additions & 3 deletions lib/Screen.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
--==================================================================================================
-- Copyright (C) 2014 by Robert Machmer =
--==================================================================================================
--===============================================================================--
-- --
-- Copyright (c) 2014 Robert Machmer --
-- --
-- This software is provided 'as-is', without any express or implied --
-- warranty. In no event will the authors be held liable for any damages --
-- arising from the use of this software. --
-- --
-- Permission is granted to anyone to use this software for any purpose, --
-- including commercial applications, and to alter it and redistribute it --
-- freely, subject to the following restrictions: --
-- --
-- 1. The origin of this software must not be misrepresented; you must not --
-- claim that you wrote the original software. If you use this software --
-- in a product, an acknowledgment in the product documentation would be --
-- appreciated but is not required. --
-- 2. Altered source versions must be plainly marked as such, and must not be --
-- misrepresented as being the original software. --
-- 3. This notice may not be removed or altered from any source distribution. --
-- --
--===============================================================================--

local Screen = {};

Expand Down
84 changes: 66 additions & 18 deletions lib/ScreenManager.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
--==================================================================================================
-- Copyright (C) 2014 by Robert Machmer =
--==================================================================================================
--===============================================================================--
-- --
-- Copyright (c) 2014 Robert Machmer --
-- --
-- This software is provided 'as-is', without any express or implied --
-- warranty. In no event will the authors be held liable for any damages --
-- arising from the use of this software. --
-- --
-- Permission is granted to anyone to use this software for any purpose, --
-- including commercial applications, and to alter it and redistribute it --
-- freely, subject to the following restrictions: --
-- --
-- 1. The origin of this software must not be misrepresented; you must not --
-- claim that you wrote the original software. If you use this software --
-- in a product, an acknowledgment in the product documentation would be --
-- appreciated but is not required. --
-- 2. Altered source versions must be plainly marked as such, and must not be --
-- misrepresented as being the original software. --
-- 3. This notice may not be removed or altered from any source distribution. --
-- --
--===============================================================================--

local ScreenManager = {};

-- ------------------------------------------------
-- Local Variables
-- ------------------------------------------------

local stack = {};
local screens = {};

-- ------------------------------------------------
-- Module Functions
-- ------------------------------------------------

---
-- Initialise the ScreenManager and
-- @param screen
-- Initialise the ScreenManager. This pushes the first
-- screen to the stack.
-- @param nscreens - The list of possible screens.
-- @param screen - The first screen to push to the stack.
--
function ScreenManager.init(screen)
function ScreenManager.init(nscreens, screen)
stack = {};
ScreenManager.setScreens(nscreens);
ScreenManager.push(screen);
end

Expand All @@ -35,19 +61,28 @@ end
-- it will overlay all the other screens.
-- Screens below the this new screen will be set inactive.
--
-- @param nscreen
-- @param screen - The name of the screen to push on the stack.
--
function ScreenManager.push(nscreen)
function ScreenManager.push(screen)
-- Deactivate the previous screen if there is one.
if ScreenManager.peek() then
ScreenManager.peek():setActive(false);
end

-- Push the new screen onto the stack.
stack[#stack + 1] = nscreen;
if screens[screen] then
stack[#stack + 1] = screens[screen].new();
else
local str = "{";
for i, v in pairs(screens) do
str = str .. i .. ', ';
end
str = str .. "}";
error('"' .. screen .. '" is not a valid screen. You will have to add a new one to your screen list or use one of the existing screens: ' .. str);
end

-- Create the new screen and initialise it.
nscreen:init();
stack[#stack]:init();
end

---
Expand All @@ -58,7 +93,7 @@ function ScreenManager.peek()
end

---
-- Removes the topmost screen of the stack
-- Removes the topmost screen of the stack.
--
function ScreenManager.pop()
if #stack > 1 then
Expand All @@ -74,7 +109,7 @@ function ScreenManager.pop()
-- Activate next screen on the stack.
ScreenManager.peek():setActive(true);
else
error("Can't close the last screen. Use switch() to clear the screen manager and add a new screen");
error("Can't close the last screen. Use switch() to clear the screen manager and add a new screen.");
end
end

Expand Down Expand Up @@ -121,21 +156,21 @@ end
---
-- Update all screens on the stack whenever the game window gains or
-- loses focus.
-- @param dfocus
-- @param nfocus
--
function ScreenManager.focus(dfocus)
function ScreenManager.focus(nfocus)
for i = 1, #stack do
stack[i]:focus(dfocus);
stack[i]:focus(nfocus);
end
end

---
-- Update all screens on the stack whenever the game window is minimized.
-- @param dvisible
-- @param nvisible
--
function ScreenManager.visible(dvisible)
function ScreenManager.visible(nvisible)
for i = 1, #stack do
stack[i]:visible(dvisible);
stack[i]:visible(nvisible);
end
end

Expand Down Expand Up @@ -193,6 +228,19 @@ function ScreenManager.mousefocus(focus)
ScreenManager.peek():mousefocus(focus);
end

-- ------------------------------------------------
-- Setters
-- ------------------------------------------------

---
-- Set a new table of screens from which to pick a new screen when
-- pushing / switching.
-- @param nscreens
--
function ScreenManager.setScreens(nscreens)
screens = nscreens;
end

-- ------------------------------------------------
-- Return Module
-- ------------------------------------------------
Expand Down
Loading

0 comments on commit 5e8dd3a

Please sign in to comment.