コード例 #1
0
def engine_init():
    global al, channel
    try:
        gs.LoadPlugins(gs.get_default_plugins_path())
    except:
        pass
    render.init(demo_screen_size[0], demo_screen_size[1], "pkg.core")

    # mount the system file driver
    gs.MountFileDriver(gs.StdFileDriver("assets/"), "@assets/")

    al = None
    channel = None
コード例 #2
0
import gs.plus.clock as clock

import os
import sys
import math
import random

if getattr(sys, 'frozen', False):
	app_path = os.path.dirname(sys.executable)
else:
	app_path = os.path.dirname(os.path.realpath(__file__))

gs.LoadPlugins(gs.get_default_plugins_path())

# gs.plus.create_workers()
render.init(1024, 921, os.path.normcase(os.path.realpath(os.path.join(app_path, "pkg.core"))))
# render.init(1920, 1200, os.path.normcase(os.path.realpath(os.path.join(app_path, "pkg.core"))), 1, gs.Window.Fullscreen)
gs.MountFileDriver(gs.StdFileDriver())

# get the big resolution
size = render.get_renderer().GetCurrentOutputWindow().GetSize()

big_resolution = gs.Vector2(160, 144)
big_resolution = gs.Vector2(1920, 1200)


size_pixel = gs.Vector2(size.x / big_resolution.x, size.y / big_resolution.y)
half_size_pixel = size_pixel * 0.5

gameboy_palette = [gs.Color(50/255, 60/255, 37/255),
				   gs.Color(83/255, 101/255, 61/255),
コード例 #3
0
import gs.plus
import gs.plus.render as render
import gs.plus.camera as camera
import gs.plus.input as input
import gs.plus.scene as scene
import gs.plus.clock as clock
from math import pi, cos, sin, asin
import codecs

filename_out = "../src/simulation"
scale_factor = 5.0

gs.plus.create_workers()
gs.LoadPlugins(gs.get_default_plugins_path())

render.init(1280, 720, "../pkg.core")

scn = scene.new_scene()
cam = scene.add_camera(scn, gs.Matrix4.TranslationMatrix(gs.Vector3(0, 3.5, -12.5)))
cam.GetTransform().SetRotation(gs.Vector3(pi * 5.0 / 180.0, pi * -5.0 / 180.0, 0))

scene.add_light(scn, gs.Matrix4.RotationMatrix(gs.Vector3(0.65, -0.45, 0)), gs.Light.Model_Linear, 150)
scene.add_light(
    scn, gs.Matrix4.RotationMatrix(gs.Vector3(0.55, pi, 0.2)), gs.Light.Model_Linear, diffuse=gs.Color(0.3, 0.3, 0.4)
)
scene.add_physic_plane(scn)

# nodes = add_kapla_tower(scn, 0.5, 2, 2, 6, 16)

width, height, length = 1, 1, 1
コード例 #4
0
import gs.plus
import gs.plus.render as render
import gs.plus.camera as camera
import gs.plus.input as input
import gs.plus.scene as scene
import gs.plus.clock as clock
from math import pi, cos, sin, asin
import codecs

filename_out = "../src/simulation"
scale_factor = 5.0

gs.plus.create_workers()
gs.LoadPlugins(gs.get_default_plugins_path())

render.init(1280, 720, "../pkg.core")

scn = scene.new_scene()
cam = scene.add_camera(scn,
                       gs.Matrix4.TranslationMatrix(gs.Vector3(0, 3.5, -12.5)))
cam.GetTransform().SetRotation(
    gs.Vector3(pi * 5.0 / 180.0, pi * -5.0 / 180.0, 0))

scene.add_light(scn, gs.Matrix4.RotationMatrix(gs.Vector3(0.65, -0.45, 0)),
                gs.Light.Model_Linear, 150)
scene.add_light(scn,
                gs.Matrix4.RotationMatrix(gs.Vector3(0.55, pi, 0.2)),
                gs.Light.Model_Linear,
                diffuse=gs.Color(0.3, 0.3, 0.4))
scene.add_physic_plane(scn)
コード例 #5
0
# from node_2_inputs_move_right_left_wheel_new_decision.decision_maker import DecisionMaker

from node_input_to_output.node_input_sensors_previous_behaviours import NodeInputs
from node_input_to_output.action_4_move_right_left_wheel import Actions
from node_input_to_output.decision_maker import DecisionMaker


# import and init OOKPY
import gs
import gs.plus.clock as clock
import gs.plus.input as input
import gs.plus.render as render
import gs.plus.camera as camera

gs.LoadPlugins(gs.get_default_plugins_path())
render.init(640, 480, "pkg.core")
fps = camera.fps_controller(0, 15, 0)

array_perso = []
# init perso

for i in range(5):
	perso_inputs = NodeInputs()
	perso_actions = Actions()
	perso_decision_maker = DecisionMaker()
	perso = Node(perso_actions, perso_inputs, perso_decision_maker)
	array_perso.append(perso)

physic_world = PhysicWorld(gs.Vector2(640, 480))

#input handling (somewhat boilerplate code):
コード例 #6
0
# Conversion routine
# - Load manually each relevant node from a NML file
# - Recreate each node into the scene graph
# - Save the resulting scene into a new file (Json or XML)

root_in = "in"
root_out = "out"
root_assets = "../../game/"
folder_assets = "assets/3d/"

gs.GetFilesystem().Mount(gs.StdFileDriver("../../game/pkg.core"), "@core")
gs.GetFilesystem().Mount(gs.StdFileDriver(root_assets), "@assets")
gs.GetFilesystem().Mount(gs.StdFileDriver(root_out), "@out")

# Init the engine
render.init(640, 400, "../pkg.core")


def convert_folder(folder_path):
    scn = None

    nml_reader = NmlReader()

    for in_file in os.listdir(folder_path):

        if os.path.isdir(os.path.join(folder_path, in_file)):
            convert_folder(os.path.join(folder_path, in_file))
        else:
            if in_file.find(".nms") > -1:
                # Found a NMS file, creates a new scene
                scn = scene.new_scene()
コード例 #7
0
    return False


SCR_PHYSIC_WIDTH = 320
SCR_PHYSIC_HEIGHT = 200

SCR_DISP_WIDTH = 320 * 2
SCR_DISP_HEIGHT = 200 * 2

SCR_SCALE_FACTOR = min(SCR_DISP_WIDTH / SCR_PHYSIC_WIDTH,
                       SCR_DISP_HEIGHT / SCR_PHYSIC_HEIGHT)
SCR_MARGIN_X = (SCR_DISP_WIDTH - (SCR_PHYSIC_WIDTH * SCR_SCALE_FACTOR)) / 2.0

gs.LoadPlugins(gs.get_default_plugins_path())

render.init(SCR_DISP_WIDTH, SCR_DISP_HEIGHT, "pkg.core")

# provide access to the data folder
gs.MountFileDriver(gs.StdFileDriver("assets/"), "@assets/")

gameReset()
player.initial_pox_z = (board.board_length * 0.45)
player.reset()

while not input.key_press(gs.InputDevice.KeyEscape):
    dt = clock.update()  # 1.0 / 60.0

    # update mouse
    gs.GetInputSystem().Update()

    # get the mouse device
コード例 #8
0
ファイル: main.py プロジェクト: Trofis/GGJ-GourouGame
	# 	],
	# ]
]

gourou_web_page = ['https://fr.wikipedia.org/wiki/T%C3%A9moins_de_J%C3%A9hovah',
                   'https://fr.wikipedia.org/wiki/Ra%C3%ABl',
                   'https://fr.wikipedia.org/wiki/Scientologie',
                   '@data/sylvain_durif.webm',
                   'https://fr.wikipedia.org/wiki/S%C5%8Dka_Gakkai',
                   'https://fr.wikipedia.org/wiki/Shri_Ram_Chandra_Mission',
                   'https://fr.wikipedia.org/wiki/Gilbert_Bourdin_(aumisme)',
                   'https://fr.wikipedia.org/wiki/Alejandro_Jodorowsky',
                   'https://fr.wikipedia.org/wiki/In%C3%A9die']

gs.LoadPlugins(gs.get_default_plugins_path())
render.init(SCREEN_W, SCREEN_H, "pkg.core")
gs.MountFileDriver(gs.StdFileDriver("assets"), '@data')
gs.MountFileDriver(gs.StdFileDriver("pkg.core"), "@core")


def musique():
	global sound
	audio.init()
	sound = audio.get_mixer().Stream("@data/Guru_02.wav")


def joue_sfx_selection():
	audio.get_mixer().Stream("@data/Input_Guru_01.wav")


def joue_sfx_phase():
コード例 #9
0
ファイル: main.py プロジェクト: ErkMkd/Fractaloid_Express
    Demo.signal_scene=Scene_base.SIG_RIEN

# ================================================================
#               Départ programme
# ================================================================

# -----------Initialisation du système de fichiers:

gs.GetFilesystem().Mount(gs.StdFileDriver())  # Racine du projet
gs.GetFilesystem().Mount(gs.StdFileDriver("pkg.core"), "@core")  # Resources du runtime


# ------------Inits des moteurs de rendu:

render.init(1600, 900,"@core", 1)   #x,y, main path, antialiasing (1 à 8)

Demo.init()
Demo.signal_scene=Scene_base.SIG_RIEN

# -----------Init des scènes:
Scene_01.init()
Scene_Terrain_Marching.init()

Demo.Scene_actuelle=Scene_Terrain_Marching

# ----------- Positionnement initial:

active_scene_actuelle()
Demo.Scene_actuelle.restart()
コード例 #10
0
                'sphere_red': {'offset': 8, 'length': 4, 'angle': 45},
                'cube': {'offset': 12, 'length': 9, 'angle': 90},
                'elastic_cube': {'offset': 12, 'length': 9, 'angle': 90, 'restitution': 1.0},
                'elastic_sphere': {'offset': 8, 'length': 4, 'angle': 45, 'restitution': 1.0}}


def tile_quantizer(x):
	x /= sphere_radius
	x = int(x)
	x *= sphere_radius
	return x

gs.plus.create_workers()
gs.LoadPlugins(gs.get_default_plugins_path())

render.init(1024, int(1024 * md_screen_h / md_screen_w), "../pkg.core")

scn = scene.new_scene()
scn.GetPhysicSystem().SetDefaultRigidBodyAxisLock(gs.LockZ + gs.LockRotX + gs.LockRotY)
scn.GetPhysicSystem().SetDebugVisuals(True)

cam = scene.add_camera(scn, gs.Matrix4.TranslationMatrix(gs.Vector3(0, 0.0, -md_screen_w * 1.15)))

screen = scene.add_plane(scn, mat=gs.Matrix4.TransformationMatrix(gs.Vector3(0,0,0), gs.Vector3(radians(-90),0,0)), width=md_screen_w, depth=md_screen_h)

scene.add_light(scn, gs.Matrix4.RotationMatrix(gs.Vector3(0.65, -0.45, 0)), gs.Light.Model_Linear, 150)
scene.add_light(scn, gs.Matrix4.RotationMatrix(gs.Vector3(0.55, pi, 0.2)), gs.Light.Model_Linear, diffuse=gs.Color(0.3, 0.3, 0.4))
ground = scene.add_physic_plane(scn, mat=gs.Matrix4.TransformationMatrix(gs.Vector3(0,-md_screen_h / 2,0), gs.Vector3(0,0,0)))


def enable_ground(flag):
コード例 #11
0
# import gs.plus.input as input
import os
from utils import *

gs.LoadPlugins(gs.get_default_plugins_path())

# provide access to the data folder
gs.MountFileDriver(gs.StdFileDriver("data/"), "@data/")

scaled_copies = 16
min_factor = 0.25

for spr_file in os.listdir("data/"):

    if not spr_file.startswith("scaled_"):
        render.init(512, 512, "../pkg.core")

        spr_pic = gs.LoadPicture("@data/" + spr_file)
        w, h = spr_pic.GetWidth(), spr_pic.GetHeight()

        render.uninit()

        render.init(w * scaled_copies, h, "../pkg.core")

        capture_buffer = gs.Picture(w * scaled_copies, h, gs.Picture.RGBA8)

        for i in range(2):
            render.clear(gs.Color(1, 0, 1))
            for i in range(scaled_copies):
                sprite_scale_factor = RangeAdjust(float(i), 0.0,
                                                  float(scaled_copies), 1.0,
コード例 #12
0
fade_percent = 1
fade_speed = 1.0
state_fade_in = 1
state_ready = 2
state_fade_out = 3

state = state_fade_out

if getattr(sys, 'frozen', False):
	app_path = os.path.dirname(sys.executable)
else:
	app_path = os.path.dirname(os.path.realpath(__file__))

# gs.plus.create_workers()
gs.LoadPlugins(gs.get_default_plugins_path())
render.init(1280, 720, os.path.normcase(os.path.realpath(os.path.join(app_path, "pkg.core"))))
gs.MountFileDriver(gs.StdFileDriver("assets"), '@assets')

audio.init()

# provide access to the assets folder
data_path = os.path.normcase(os.path.realpath(app_path))
gs.GetFilesystem().Mount(gs.StdFileDriver(data_path))

render.set_blend_mode2d(render.BlendAlpha)

globals.current_scene.setup()

def fade_between_scene():
	global state, fade_percent
	if globals.prev_scene_fade != globals.current_scene:
コード例 #13
0
    Demo.signal_scene = Scene_base.SIG_RIEN


# ================================================================
#               Départ programme
# ================================================================

# -----------Initialisation du système de fichiers:

gs.GetFilesystem().Mount(gs.StdFileDriver())  # Racine du projet
gs.GetFilesystem().Mount(gs.StdFileDriver("pkg.core"),
                         "@core")  # Resources du runtime

# ------------Inits des moteurs de rendu:

render.init(1600, 900, "@core", 1)  #x,y, main path, antialiasing (1 à 8)

Demo.init()
Demo.signal_scene = Scene_base.SIG_RIEN

# -----------Init des scènes:
Scene_01.init()
Scene_Terrain_Marching.init()

Demo.Scene_actuelle = Scene_Terrain_Marching

# ----------- Positionnement initial:

active_scene_actuelle()
Demo.Scene_actuelle.restart()