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

Commit 06a2cab

Browse files
committed
Merge branch 'release/0104'
2 parents 5e8dd3a + 404e612 commit 06a2cab

22 files changed

Lines changed: 1235 additions & 655 deletions

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
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.
44

5-
Check the [wiki](https://bitbucket.org/rmcode/logivi/wiki/Home) for instructions and further information.
5+
Check the [wiki](https://github.com/rm-code/logivi/wiki) for instructions and further information.

conf.lua

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ local GAME_TITLE = "LoGiVi";
2424

2525
local LOVE_VERSION = "0.9.2";
2626

27-
local GAME_VERSION = "0052";
27+
local GAME_VERSION = "0104";
2828

2929
-- ------------------------------------------------
3030
-- Local variables
@@ -47,8 +47,8 @@ function love.conf(t)
4747

4848
t.window.title = GAME_TITLE;
4949
t.window.icon = nil;
50-
t.window.width = 0;
51-
t.window.height = 0;
50+
t.window.width = 800;
51+
t.window.height = 600;
5252
t.window.borderless = false;
5353
t.window.resizable = true;
5454
t.window.minwidth = 800;
@@ -95,3 +95,12 @@ function getVersion()
9595
return GAME_VERSION;
9696
end
9797
end
98+
99+
---
100+
-- Returns the title.
101+
--
102+
function getTitle()
103+
if GAME_TITLE then
104+
return GAME_TITLE;
105+
end
106+
end

lib/Camera.lua

Lines changed: 0 additions & 113 deletions
This file was deleted.

lib/camera/Camera.lua

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
--[[
2+
Copyright (c) 2010-2013 Matthias Richter
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
Except as contained in this notice, the name(s) of the above copyright holders
15+
shall not be used in advertising or otherwise to promote the sale, use or
16+
other dealings in this Software without prior written authorization.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
THE SOFTWARE.
25+
]]--
26+
27+
local _PATH = (...):match('^(.*[%./])[^%.%/]+$') or ''
28+
local cos, sin = math.cos, math.sin
29+
30+
local camera = {}
31+
camera.__index = camera
32+
33+
local function new(x,y, zoom, rot)
34+
x,y = x or love.graphics.getWidth()/2, y or love.graphics.getHeight()/2
35+
zoom = zoom or 1
36+
rot = rot or 0
37+
return setmetatable({x = x, y = y, scale = zoom, rot = rot}, camera)
38+
end
39+
40+
function camera:lookAt(x,y)
41+
self.x, self.y = x,y
42+
return self
43+
end
44+
45+
function camera:move(x,y)
46+
self.x, self.y = self.x + x, self.y + y
47+
return self
48+
end
49+
50+
function camera:pos()
51+
return self.x, self.y
52+
end
53+
54+
function camera:rotate(phi)
55+
self.rot = self.rot + phi
56+
return self
57+
end
58+
59+
function camera:rotateTo(phi)
60+
self.rot = phi
61+
return self
62+
end
63+
64+
function camera:zoom(mul)
65+
self.scale = self.scale * mul
66+
return self
67+
end
68+
69+
function camera:zoomTo(zoom)
70+
self.scale = zoom
71+
return self
72+
end
73+
74+
function camera:attach()
75+
local cx,cy = love.graphics.getWidth()/(2*self.scale), love.graphics.getHeight()/(2*self.scale)
76+
love.graphics.push()
77+
love.graphics.scale(self.scale)
78+
love.graphics.translate(cx, cy)
79+
love.graphics.rotate(self.rot)
80+
love.graphics.translate(-self.x, -self.y)
81+
end
82+
83+
function camera:detach()
84+
love.graphics.pop()
85+
end
86+
87+
function camera:draw(func)
88+
self:attach()
89+
func()
90+
self:detach()
91+
end
92+
93+
function camera:cameraCoords(x,y)
94+
-- x,y = ((x,y) - (self.x, self.y)):rotated(self.rot) * self.scale + center
95+
local w,h = love.graphics.getWidth(), love.graphics.getHeight()
96+
local c,s = cos(self.rot), sin(self.rot)
97+
x,y = x - self.x, y - self.y
98+
x,y = c*x - s*y, s*x + c*y
99+
return x*self.scale + w/2, y*self.scale + h/2
100+
end
101+
102+
function camera:worldCoords(x,y)
103+
-- x,y = (((x,y) - center) / self.scale):rotated(-self.rot) + (self.x,self.y)
104+
local w,h = love.graphics.getWidth(), love.graphics.getHeight()
105+
local c,s = cos(-self.rot), sin(-self.rot)
106+
x,y = (x - w/2) / self.scale, (y - h/2) / self.scale
107+
x,y = c*x - s*y, s*x + c*y
108+
return x+self.x, y+self.y
109+
end
110+
111+
function camera:mousepos()
112+
return self:worldCoords(love.mouse.getPosition())
113+
end
114+
115+
-- the module
116+
return setmetatable({new = new},
117+
{__call = function(_, ...) return new(...) end})

lib/screenmanager/Readme.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#ScreenManager
2+
3+
The ScreenManager library is a state manager at heart which allows some nifty things, like stacking multiple screens on top of each other.
4+
5+
It also offers hooks for most of LÖVE's callback functions. Based on the type of callback the calls are rerouted to either only the active screen (love.keypressed, love.quit, ...) or to all screens (love.resize, love.visible, ...).
6+
7+
## Example
8+
9+
This is a simple example of how the ScreenManager should be used (note: You will have to change the paths in the example to fit your setup).
10+
11+
```
12+
#!lua
13+
-- main.lua
14+
15+
local ScreenManager = require('lib/ScreenManager');
16+
17+
function love.load()
18+
local screens = {
19+
main = require('src/screens/MainScreen');
20+
};
21+
22+
ScreenManager.init(screens, 'main');
23+
end
24+
25+
function love.draw()
26+
ScreenManager.draw();
27+
end
28+
29+
function love.update(dt)
30+
ScreenManager.update(dt);
31+
end
32+
```
33+
Note how MainScreen inherits from Screen.lua. This isn't mandatory, but recommended since Screen.lua already has templates for most of the callback functions.
34+
35+
```
36+
#!lua
37+
-- MainScreen.lua
38+
39+
local Screen = require('lib/Screen');
40+
41+
local MainScreen = {};
42+
43+
function MainScreen.new()
44+
local self = Screen.new();
45+
46+
local x, y, w, h = 20, 20, 40, 20;
47+
48+
function self:draw()
49+
love.graphics.rectangle('fill', x, y, w, h);
50+
end
51+
52+
function self:update(dt)
53+
w = w + 2;
54+
h = h + 1;
55+
end
56+
57+
return self;
58+
end
59+
60+
return MainScreen;
61+
```
62+
63+
## License
64+
65+
Copyright (c) 2014 - 2015 Robert Machmer
66+
67+
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.
68+
69+
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:
70+
71+
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.
72+
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
73+
3. This notice may not be removed or altered from any source distribution.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--===============================================================================--
22
-- --
3-
-- Copyright (c) 2014 Robert Machmer --
3+
-- Copyright (c) 2014 - 2015 Robert Machmer --
44
-- --
55
-- This software is provided 'as-is', without any express or implied --
66
-- warranty. In no event will the authors be held liable for any damages --
@@ -61,6 +61,8 @@ function Screen.new()
6161

6262
function self:mousefocus(focus) end
6363

64+
function self:quit(dquit) end
65+
6466
function self:isActive()
6567
return active;
6668
end

0 commit comments

Comments
 (0)