monitors = screeninfo.get_monitors() drag = False offset = Vec2(rl.GetMousePosition()) width = height = 160 window_vel = glm.vec2() window_pos = glm.vec2(monitors[0].width - width, monitors[0].height - height) rl.SetConfigFlags(rl.FLAG_WINDOW_TRANSPARENT | rl.FLAG_WINDOW_UNDECORATED | rl.FLAG_VSYNC_HINT | rl.FLAG_MSAA_4X_HINT) rl.InitWindow(width, height, b'') rl.SetWindowPosition(int(window_pos.x), int(window_pos.y)) #rl.SetTargetFPS(500) target = rl.LoadRenderTexture(width, height) # Top-Level Window Support Only On Windows if sys.platform == 'win32': import win32gui, win32con, pywintypes # Set window to always top without moving it win32gui.SetWindowPos( pywintypes.HANDLE(ffi.cast('int', rl.GetWindowHandle())), win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOSIZE | win32con.SWP_NOMOVE) #tint = glm.vec4(255, 255, 255, 255) When mouse over, brighten everything fade trans = 155 elapsed = CTM() # Generate an 'L' pattern with pixels
import sys, math, time, random import glm from raylib.dynamic import raylib as rl, ffi from raylib.colors import * CTM = lambda: round(time.time() * 1000) BEES = bool(sys.argv[1:]) rl.SetTraceLogLevel(rl.LOG_ERROR) rl.SetConfigFlags(rl.FLAG_WINDOW_RESIZABLE) rl.InitWindow(512, 512, b'Friendly Bees') rl.SetTargetFPS(60) #rl.DisableCursor() canvas = rl.LoadRenderTexture(rl.GetScreenWidth(), rl.GetScreenHeight()) rl.SetTextureWrap(canvas.texture, rl.WRAP_MIRROR_REPEAT) def random_point_in_circle(center, radius): a = random.random() * 2 * math.pi r = radius * math.sqrt(random.random()) x = r * math.cos(a) z = r * math.sin(a) return glm.vec3(x + center.x, center.y, z + center.z) class Particle: def __init__(self, pos): self.pos = pos self.scl = 16 if BEES else 2
[[2, 12, 6], [0, .5, 0], [0, 1, 0], 45, rl.CAMERA_PERSPECTIVE]) model = rl.LoadModel(b"resources/models/barracks.obj") # // Load OBJ model texture = rl.LoadTexture(b"resources/models/barracks_diffuse.png" ) # // Load model texture (diffuse map) #// Assign texture to default model material model.materials[0].maps[rl.MAP_DIFFUSE].texture = texture #// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader shader = rl.LoadShader(b"", b"resources/shaders/glsl330/swirl.fs") swirlCenterLoc = rl.GetShaderLocation(shader, b"center") angle = 6.282 swirl = ffi.new("struct Vector2 *", [0, 0]) target = rl.LoadRenderTexture(screenWidth, screenHeight) rl.SetTargetFPS(60) # // Set our game to run at 60 frames-per-second #//-------------------------------------------------------------------------------------- #// Main game loop while not rl.WindowShouldClose(): #// Detect window close button or ESC key #// Update #//---------------------------------------------------------------------------------- angle -= 0.002 camera.position.x = math.sin(angle) * 30.0 camera.position.z = math.cos(angle) * 30.0 rl.UpdateCamera(camera) #// Update camera swirl.x = rl.GetMouseX()