Code Monkey home page Code Monkey logo

renpygame's Introduction

Renpygame

IMPORTANT: This is a continuation of a project not mine, abandoned from 2008 Renpygame (not working). Currently compared to 2008, it is not possible to directly use the pygame_sdl2 library, especially to "draw".

Renpygame is a framework that allows pygame games to be integrated with Ren'Py. It's intended for people who are capable programmers.

The idea is to create a library that uses pygame_sdl2 and overrides functions that can be handled by the renpy library.

The big problem is that the mode for drawing is very different. The only way I found was to use CDD and use that events to draw and update an element.

Use of events to draw limits a lot -> you can't create loops to update a renpy.Displayable -> that's why you can't copy and paste a game, but modify it slightly.

ezgif com-video-to-gif


TO DOWNLOAD THIS TEST PROJECT

# Basic command to download projects from git
git clone https://github.com/DRincs-Productions/Renpygame
# IMPORTANT -> Will add the libraries needed to run the program
cd Renpygame
git submodule update --init --recursive

Other minigames

(Add topics renpygame to add it to the list)
https://github.com/topics/renpygame

Instructions

Wiki

Why use pygame-renpygame and not renpy-CDD?

pygame-renpygame's pros:

  • You can use pygame and renpy functions
  • huge number of minigames on github
  • popularity (pygame is also often used in universities)
  • typification (I am endeavouring to add the type everywhere)

renpy's pros:

  • durability (CDD is developed by the same developer as renpy)
  • you can create simple and effective effects on images thanks to Transforms (in the future it could also be integrated into Renpygame)

Performance

(in development)

(I don't made any tests for now) Renpygame use CDD for draw and renpy for open a file, but I use a typification and is a external library. So, the performance is the same as renpy, excluding possible implementation errors.

Insert Toolkit in your project

I recommend the following ways to include it in your project:

  • Pull branch (to insert it into your game and update it easily)
  • Fork (to improve the repo or create a Toolkit based on mine)
  • Manually (not recommended)

Pull branch

To insert or update the Toolkit in your repo with Pull branch I recommend the following procedure:

(only if you want to insert the repo) Create a new empty branch, in the example I'll use renpygame

git checkout -b renpygame
git checkout renpygame
git config pull.rebase false
git pull https://github.com/DRincs-Productions/Renpygame.git tool-only --allow-unrelated-histories
git submodule update --remote

At the end make a merge inside the arm of the project.

Supported Modules

A good number of functions should already work even if they have not yet been tested

  • renpygame.color
  • renpygame.constants (Still to be tested, should already be working)
  • renpygame.cursors (Still to be tested, should already be working)
  • renpygame.display (Incomplete)
  • renpygame.display.Surface
  • renpygame.draw
  • renpygame.event (Still to be tested, should already be working)
  • renpygame.font
  • renpygame.image (Incomplete)
  • renpygame.joystick
  • renpygame.key (Incomplete)
  • renpygame.locals (Still to be tested, should already be working)
  • renpygame.mixer (Incomplete)
  • renpygame.mixer.music (Incomplete)
  • renpygame.mouse (Still to be tested, should already be working)
  • renpygame.rect
  • renpygame.sprite (Incomplete)
  • renpygame.time (Still to be tested, should already be working)
  • renpygame.transform (Incomplete)

renpygame's People

Contributors

blackram-oss avatar tiliv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

zhounan354

renpygame's Issues

implement commented things

To make it work I had to comment out some things in the code, which you should implement.

To find it I added this comment

# TODO: has been commented pe make it work

Fix blinking during draw

class RenpyGameByTimer(renpy.Displayable):

    def __init__(
        self,
        **kwargs,
    ):
        self.child_render = renpy.Render(1920, 1080)
        self.current_frame_number = 0

        # renpy.Displayable init
        super(RenpyGameByTimer, self).__init__(**kwargs)

    def render(self, width: int, height: int, st: float, at: float) -> renpy.Render:
        return self.child_render

    def event(self, ev: EventType, x: int, y: int, st: float):
        self.current_frame_number += 1
        canvas = self.child_render.canvas()
        # if self.current_frame_number % 2 == 0:
        canvas.circle((255, 0, 0), (100, 100), 50)
        # elif self.current_frame_number % 3 == 0:
        canvas.circle((0, 255, 0), (200, 200), 50)
        # elif self.current_frame_number % 5 == 0:
        canvas.circle((255, 255, 255), (300, 300), 50)
        print("event", self.current_frame_number)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.