From 3afefa76afe106f549a616583612413015c48aa0 Mon Sep 17 00:00:00 2001 From: piernov Date: Thu, 3 Apr 2014 19:10:20 +0200 Subject: Importation initiale du projet --- Gestion de projet.txt | 2 ++ Problemes_resolutions.txt | 3 ++ Sans nom 1.odt | Bin 0 -> 38204 bytes main.lua | 88 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 Gestion de projet.txt create mode 100644 Problemes_resolutions.txt create mode 100644 Sans nom 1.odt create mode 100644 main.lua diff --git a/Gestion de projet.txt b/Gestion de projet.txt new file mode 100644 index 0000000..7d4e773 --- /dev/null +++ b/Gestion de projet.txt @@ -0,0 +1,2 @@ +http://cube2.fr/forum/viewtopic.php?f=109&t=3050 +http://git.piernov.org/ \ No newline at end of file diff --git a/Problemes_resolutions.txt b/Problemes_resolutions.txt new file mode 100644 index 0000000..18c521b --- /dev/null +++ b/Problemes_resolutions.txt @@ -0,0 +1,3 @@ +Décalage de toute l'interface de 50 pixels vers la droite → Utilisation d'un canvas déssiné à x=50 +Canvas non pris en charge par les PC du lycée → Utilisation de fakecanvas +fakecanvas ne supporte pas löve 0.9 → Portage vers löve 0.9 et suppression de la fonctionnalité de flip, inutilisée et plus difficile à porter diff --git a/Sans nom 1.odt b/Sans nom 1.odt new file mode 100644 index 0000000..b8ce4e8 Binary files /dev/null and b/Sans nom 1.odt differ diff --git a/main.lua b/main.lua new file mode 100644 index 0000000..10d0633 --- /dev/null +++ b/main.lua @@ -0,0 +1,88 @@ +require 'love2d-fakecanvas/fakecanvas' + +colors = { { 0, 0, 255, 255}, {0, 255, 0, 255}, {0, 255, 255, 255}, {255, 0, 0, 255}, {255, 0, 255, 255}, {255, 255, 0, 255} } + +local circle_s = love.graphics.circle + +function love.graphics.circle(t, x, y, r, d) + local color = {love.graphics.getColor()} + love.graphics.setColor(0, 0, 0, 255) + circle_s("line",x,y,r+0.5,d) + love.graphics.setColor(unpack(color)) + circle_s(t,x,y,r,d) +end + +local rect_s = love.graphics.rectangle + +function love.graphics.rectangle(t, x, y, r, d) + local color = {love.graphics.getColor()} + love.graphics.setColor(0, 0, 0, 255) + rect_s("line",x,y,r,d) + love.graphics.setColor(unpack(color)) + rect_s(t,x,y,r,d) +end + +function love.load() + love.window.setMode(450, 600, {fullscreen = false, fsaa = 4}) + love.window.setTitle("Mastermind") + love.graphics.setBackgroundColor(255, 255, 255) + +canvas = love.graphics.newCanvas(400, 600) + love.graphics.setCanvas(canvas) + canvas:clear() + love.graphics.setBlendMode('alpha') + + + love.graphics.setColor(255, 0, 127, 255) + love.graphics.rectangle("fill", 0, 525, 400, 75) + for j=1,6 do + love.graphics.setColor(unpack(colors[j])) + love.graphics.circle("fill", 57*j, 562, 25, 100) + end + for g=0,6 do + love.graphics.setColor(125, 41-5*g, 0+25*g, 255) + love.graphics.rectangle("fill", 0, 75*g, 100, 75) + love.graphics.setColor(42*g, 255, 15*g, 255) + love.graphics.rectangle("fill", 100, 75*g, 300, 75) + love.graphics.setColor(255, 255, 255, 255) + for i=1,4 do + love.graphics.circle("fill", 100+(60*i), 38+(75*g), 25, 100) + end + for h=0,1 do + for k=1,2 do + love.graphics.circle("fill", (40*k)-10, 22+(75*g)+(30*h), 13, 100) + end + end + end + + love.graphics.setCanvas() + +end + +x1 = 0 +y1 = 0 +p1 = 0 +clicked = 0 + +function love.mousepressed(x, y, p) + x1 = x + y1 = y + p1 = p + x = x - 50 + if y > 525 then + for j=1,6 do + if math.sqrt(math.pow(57*j - x, 2) + math.pow(562 - y, 2)) < 25 then + clicked = j + end + end + end +end + +function love.draw() + love.graphics.setColor(0, 0, 0, 255) + love.graphics.print(x1 .. " " .. y1 .. " " .. p1, 0, 0) + love.graphics.print(clicked, 0, 30) + love.graphics.setColor(255, 255, 255, 255) + love.graphics.setBlendMode('premultiplied') + love.graphics.draw(canvas, 50, 0) +end -- cgit v1.2.3-70-g09d2