Giter VIP home page Giter VIP logo

black-holes-library's Introduction

Mindustry Black Hole Renderer

This is a library mod used for the rendering of black holes.

example.png

Warning

Do not just copy this mod's code into your mod. While it would be really easy to just take my black hole renderer and copy it into other mods, it'll encounter the problem of multiple frame buffers starting on the same layer, thus causing the game to crash.

By using a singular library mod, all mods would use and send data to the same renderer, thus avoiding conflicts.

Note that mods that use this must depend on MEEPofFaith/MindustryBlackHoleRenderer and that this mod must be installed so that other mods can use it. Don't forget to also add black-hole-renderer to your dependncies in mod.json to prevent your mod from loading in the case that this isn't installed, else it will crash.

How to use (Java)

  1. Add the Jitpack repository to your repo.
repositories { maven { url 'https://jitpack.io' } }
  1. Add this mod to your dependencies. See releases for latest version.
dependencies {
    compileOnly 'com.github.MEEPofFaith:MindustryBlackHoleRenderer:<version>'
}
  1. Now that this mod has been added to your gradle. You just need to call BlackHoleRenderer::addBlackHole to draw black holes.

    • Additionally includes SwirlEffect to draw the particles that spin around and fall in.

Drawer and Part

This mod also includes a DrawBlackHole drawer and BlackHolePart part so that you don't need to make your own, and they are also compatable with json.

Sample code:

DrawBlackHole

{
   "type": "DrawBlackHole",
   "size": 5, //Radius of black hole
   "edge": 25, //Extent of the lensing effect
   "warmup": false //True by default. Whether to scale based on building warmup or always max size
}
new DrawBlackHole(<size>, <edge>) //The size and edge can be set with a handy constructor

BlackHolePart

Structured very similarly to other parts.

{
   "type": "BlackHolePart",
   "x": 1,
   "y": 1,
   "moveX": 1,
   "moveY": 1,
   "size": 1, //Size when grow progress is 0. 0 by default
   "sizeTo": 12, //Size when grow progress is 1
   "edge": 4, //Edge when grow progress is 0. 0 by default
   "edgeTo": 32, //Edge when grow progress is 1.
   "progress": "warmup",
   "growProgrss": "warmup"
}

You probably know how to translate json to java so I'm not gonna bother with a java example.

black-holes-library's People

Contributors

meepoffaith avatar guiymour avatar

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.