Skip to content

Commit

Permalink
Back-up version of finished projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jkauerl committed Dec 14, 2022
0 parents commit c0f9dde
Show file tree
Hide file tree
Showing 227 changed files with 704,935 additions and 0 deletions.
Binary file added tarea1b/Video Grafica Tarea 1.mp4
Binary file not shown.
Binary file added tarea1b/__pycache__/controlador.cpython-310.pyc
Binary file not shown.
Binary file added tarea1b/__pycache__/controlador.cpython-39.pyc
Binary file not shown.
Binary file added tarea1b/__pycache__/modelo.cpython-310.pyc
Binary file not shown.
Binary file added tarea1b/__pycache__/modelo.cpython-39.pyc
Binary file not shown.
Binary file added tarea1b/__pycache__/vista.cpython-39.pyc
Binary file not shown.
Binary file added tarea1b/assets/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/assets/boo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/assets/pajarito.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/assets/suelo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/assets/tubo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/assets/wasted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/assets/win.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added tarea1b/codigo/__pycache__/modelo.cpython-39.pyc
Binary file not shown.
Binary file added tarea1b/codigo/__pycache__/vista.cpython-39.pyc
Binary file not shown.
Binary file added tarea1b/codigo/assets/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/codigo/assets/pajarito.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/codigo/assets/suelo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/codigo/assets/tubo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/codigo/assets/wasted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tarea1b/codigo/assets/win.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions tarea1b/codigo/controlador.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
Clase controlador, obtiene el input, lo procesa, y manda los mensajes
a los modelos.
"""

from modelo import Pajarito, Tubos
import glfw
import sys
from typing import Union


class Controller(object):
model: Union['Pajarito', None]
tubos: Union['Tubos', None]

def __init__(self):
self.model = None
self.tubos = None

def set_model(self, m):
self.model = m

def on_key(self, window, key, scancode, action, mods):
if not (action == glfw.PRESS or action == glfw.RELEASE):
return

if key == glfw.KEY_ESCAPE:
glfw.set_window_should_close(window, True)

# Controlador modifica al modelo
if key == glfw.KEY_UP:
# print('Move up')
self.model.move_up()

# Raton toca la pantalla....
else:
print('Unknown key')
28 changes: 28 additions & 0 deletions tarea1b/codigo/grafica/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
Grafica library.
"""

import platform as __platform

# patch glfw for MACOS
if __platform.system() == 'Darwin':
import glfw as __glfw


def __create_window(width, height, title, monitor, share):
"""
Creates a window and its associated context.
Wrapper for:
GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
"""
__glfw.window_hint(__glfw.CONTEXT_VERSION_MAJOR, 3)
__glfw.window_hint(__glfw.CONTEXT_VERSION_MINOR, 3)
__glfw.window_hint(__glfw.OPENGL_FORWARD_COMPAT, True)
__glfw.window_hint(__glfw.OPENGL_PROFILE, __glfw.OPENGL_CORE_PROFILE)
# noinspection PyProtectedMember
return __glfw._glfw.glfwCreateWindow(width, height, __glfw._to_char_p(title),
monitor, share)


__glfw.create_window = __create_window
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 22 additions & 0 deletions tarea1b/codigo/grafica/assets_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# coding=utf-8
"""
Convenience functionality to access assets files.
"""

__all__ = ['getAssetPath']

import os.path

__author__ = "Daniel Calderon"
__license__ = "MIT"


def getAssetPath(filename):
"""Convenience function to access assets files regardless from where you run the example script."""

thisFilePath = os.path.abspath(__file__)
thisFolderPath = os.path.dirname(thisFilePath)
parentFolderPath = os.path.dirname(thisFolderPath)
assetsDirectory = os.path.join(parentFolderPath, "assets")
requestedPath = os.path.join(assetsDirectory, filename)
return requestedPath
Loading

0 comments on commit c0f9dde

Please sign in to comment.