예제 #1
0
def font(name='FiraMono'):
    global cache_font
    x = cache_font.get(name, None)
    if x:
        return x
    x = ccircle.Font('../../res/%s.ttf' % name)
    cache_font[name] = x
    return x
예제 #2
0
          ["e", "e", "e", "e", "e", "e", "e", "e", "e", "e"],
          ["e", "e", "e", "e", "e", "e", "e", "e", "e", "e"],
          ["e", "e", "e", "e", "e", "e", "e", "e", "e", "e"],
          ["e", "e", "e", "e", "e", "e", "e", "e", "e", "e"],
          ["e", "e", "e", "e", "e", "e", "e", "e", "e", "e"],
          ["e", "e", "e", "e", "e", "e", "e", "e", "e", "e"]]]

waves = [[1, 300, 6], [2, 400, 4], [1, 120, 20], [3, 600, 10], [2, 200, 40],
         [4, 500, 15], [5, 350, 75], [6, 50, 2], [3, 150, 40], [6, 300, 10],
         [5, 140, 50], [7, 50, 1], [5, 50, 200], [4, 50, 200], [7, 230, 5]]
wave = 1

load = 0
load2 = 0

font1 = ccircle.Font("Montel.ttf")

money = 600
lives = 50
wave = 0

pause = 0

difficulty = 1


def draw_button(x, y, r, case, text):
    global pg
    global mouseX
    global mouseY
    window.drawCircle(x, y, r + 4, 0.0, 0.0, 0.0)
예제 #3
0
import os
d = os.path.dirname(os.path.realpath(__file__))
import sys
sys.path.append(d + '\\dist')

import ccircle
import random
import time
from math import *

window = ccircle.Window('CCircle Module Test', 800, 800)
cat = ccircle.Image('res/cat.png')
font = ccircle.Font('res/FiraMono.ttf')

sound = ccircle.Sound()
sound.addSine(0, 1, 120, 0.2)
sound.addSine(0, 1, 60, 0.2)
sound.addSine(0, 1, 90, 0.2)
sound.addSaw(1, 2, 60, 0.2)
sound.addSaw(1, 2, 240, 0.2)
sound.addSaw(1, 2, 480, 0.2)
sound.play()

t = 0
while window.isOpen():
  window.clear(0.1, 0.1, 0.1)
  mx, my = window.getMousePos()
  window.drawPoint(mx, my, 8)

  t += 1.0
  cat.draw(16, 16, 128, 128, t)
예제 #4
0
import ccircle
import problem
import solution
import time

trader = solution.StockTrader()
account, market = problem.create(trader)

window = ccircle.Window('Scenario 2: Beating the Stock Market', 1600, 900, 32,
                        32)
window.toggleMaximized()
wx, wy = window.getSize()

fMenu = ccircle.Font('../res/NovaFlat.ttf')
fMono = ccircle.Font('../res/FiraMono.ttf')
day = 1


def lerp(x, y, t):
    return x + t * (y - x)


def panel(x, y, sx, sy, b, cInner, cOuter):
    global window
    window.drawRect(x, y, sx, sy, *cOuter)
    window.drawRect(x + b, y + b, sx - 2 * b, sy - 2 * b, *cInner)


def rect(x, y, sx, sy, r, g, b):
    global window
    window.drawRect(x, y, sx, sy, r, g, b)
예제 #5
0
파일: C4.py 프로젝트: rboshe/ccircle
import ccircle

window = ccircle.Window()
window.toggleMaximized()

font = ccircle.Font('NovaFlat.ttf')

winner = None

turn = True

data = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]


def drawBoard(data, window):
    for y in range(6):
        for x in range(7):
            if data[y][x] == "R":
                window.drawLine(x * 228, (y + 0) * 139, (x + 1) * 228,
                                (y + 1) * 139, 4, 1, 0, 0)
                window.drawLine(x * 228, (y + 1) * 139, (x + 1) * 228,
                                (y + 0) * 139, 4, 1, 0, 0)
            if data[y][x] == "Y":
                window.drawLine(x * 228, (y + 0) * 139, (x + 1) * 228,
                                (y + 1) * 139, 4, 1, 1, 0)
                window.drawLine(x * 228, (y + 1) * 139, (x + 1) * 228,
                                (y + 0) * 139, 4, 1, 1, 0)


def getColumn(