diff --git a/README.md b/README.md index 62e76b4..0312137 100644 --- a/README.md +++ b/README.md @@ -1,96 +1,49 @@ -

+

prettylight

-

Pretty lights for Game Maker

- -- [Screenshots](#screenshots) -- [Credits](#credits) -- [Prerequisites](#prerequisites) -- [Setting Up](#setting-up) -- [Drawing Lights](#drawing-lights) - - [Ambient Lighting](#ambient-lighting) -- [Light Sprites](#light-sprites) -- [Extra Effects](#extra-effects) - - [Vivid Lighting](#vivid-lighting) - - [Ambient Blurring](#ambient-blurring) +

Pretty lights for GameMaker

-## Screenshots - -![Tercon Major](http://i.imgur.com/jMfCAMY.png) +

Version 2.0

-![Protocol](http://i.imgur.com/NN0c4ex.png) +prettylight is a powerful lighting engine for use with GameMaker: Studio. It makes use of surfaces and shaders to give you a simple to use yet optimal solution to your problems in need of lighting up! -![Ahriman's Treasure](http://i.imgur.com/YEpCTx5.png) +## Screenshots -![Skolgbor](http://i.imgur.com/QEYSaAh.png) +![](http://i.imgur.com/8lQR4pk.png) +![](http://i.imgur.com/820eNjo.png) ## Credits -prettylight is a simplistic and powerful lighting engine for use with GameMaker: Studio. It features code by FatalSleep and xygthop3, who are amazing coders and I can't thank them enough for the resources they create. - -Please give credit to **Nik Sudan, FatalSleep and xygthop3** if you decide to use it in your projects! - -## Prerequisites - -prettylight requires a few things in your project in order for it to function. - -- A view -- A light sprite called ```sprLight``` -- A light controller object -- At least one light object - -prettylight comes with a prebuilt light controller and parent object, but you can implement their functionality into other objects. - -## Setting Up - -The lights are controlled with the light controller object. This should have a pretty low depth so it runs before other objects. The controller object needs to run 4 functions: - -- ``` lights_init( shaders? , view_id ) ``` - this sets up the lighting system, call this in a **creation or trigger event** -- ``` lights_step() ``` - this processes the lighting system, call this in a **step event** -- ``` lights_draw() ``` - this controls the drawing for the lighting system, call this in the **draw gui event** -- ``` lights_finish() ``` - this ends the lighting system, call this in the **room/game end event** - -For the function ``` lights_init() ```, "shaders?" defines whether or not to apply shaders to the lighting system and "view_id" is the id 0-15 of whichever view you wish to enable lighting on. - -## Drawing Lights - -In order to draw lights you need to register light objects. You can do this with the function ``` lights_add( obj1, obj2, obj3, ... ) ```. Typical usage would be registering a light parent object using this. - -Call the ``` light_set() ``` script to set up your light object. Just make sure that all the properties are set, otherwise an error will be thrown. There are 5 additional functions you can use to customise certain features: - -- ``` light_set_alpha( value ) ``` - sets the light's alpha -- ``` light_set_color( colour ) ``` - sets the light's colour -- ``` light_set_scale( xscale, yscale ) ``` - sets the light's scale -- ``` light_set_spite( sprite, index ) ``` - sets the light's sprite -- ``` light_set_offset( xoffset, yoffset ) ``` - sets the light's x,y offset +Lots of lighting help by **FatalSleep**, gaussian blur shaders written by **xygthop3**. -#### Ambient Lighting +## Usage -In the light controller you can specify ambient lighting. This will get displayed in areas that aren't lit up. To modify this, use the function ``` lights_set_ambience( colour, alpha ) ```. I've specified one I normally use in the controller that's included - it produces a nice brooding blue overlay. +### Setting Up -## Light Sprites +prettylight doesn't need much to work. It needs the appropriate scripts and shaders to run properly, that's all. -In prettylight, lights rely on sprites. A basic radial one is included, but you can introduce more interesting patterns with ease. Lights need to be in a certain way for it to function properly: +First things first, you'll want to initialise the system within your control object. Simply call `pl_init()` in your **create event** to set up the engine, and preferably add all light object parents within the `pl_add()` method. For example, all your light sources would be children of an object called `objLight` - you'd then add that parent object to the light objects list in order for it to work. This is so the engine knows which objects it should mess with when lighting things up! -- Lights should only use white -- A white area indicates a fully lit section -- A transparent area indicates a non-lit section +You'll need to process the engine in a **step event** of your choosing (**begin step** is preferred) using `pl_update()`, draw the lights in the **draw event** with `pl_draw()`, and end the system in the **room end**/**game end** event using `pl_end()`. -The one sprite that's included with the package, ```sprLight```, is required for the package to work, so don't modify it! +You'll also need a view to draw the lights. prettylight is currently set to process in the view with id 0 (the default one). -## Extra Effects +### Making Lights -Two extra effects are enabled by default, but you can turn these off. +In order for something to light up, make sure it or it's parent is added to the light object list using `pl_add(obj1, obj2, ...)` as stated above. Then simply call `pl_light_init(radius, colour, alpha)` in your create event. You may modify your light using the available methods, but please note you can't specify a radius larger than the one you initially put in. -#### Vivid Lighting +### Customisation -This amplifies lights in general and really brings out the colour used. This isn't very intensive but with lots of lights it might slow down the game a little bit. +You may toggle certain options using the provided scripts: -- ``` lights_set_vivid( active? ) ``` - whether to enable vivid lighting +- `pl_set_vivid(active?)` - toggles vivid lighting (uses additional surface) +- `pl_set_blurring(active?)` - toggles blurring (uses shaders) +- `pl_option_set_ambience(color, brightness)` - make changes to the ambience +- `pl_option_set_blur(amount, alpha)` - make changes to the blur -#### Ambient Blurring +## What's Next? -This makes use of xygthop3's gaussian blur shaders, and it makes everything look all bloomy and fuzzy and nice. This can be very intensive and might not work for older computers, so be sure to make it some sort of option if you decide to use it. If you turn off shaders in ``` lights_init() ``` blurring will not work. You can configure this with three functions: +prettylight is currently maintained primarily by [Nik Sudan](http://github.com/niksudan), but I'm more than happy to approve merge requests that help the project develop even further! Future features that would be cool include: -- ``` lights_set_blur( active? ) ``` - whether to enable ambient blurring -- ``` lights_set_blur_alpha( alpha ) ``` - the alpha overlay (1 = fully blurred, 0 = no blur) -- ``` lights_set_blur_amount( amount ) ``` - the blur amount (the bigger the number, the more intensive it is) +- Shadow casters (pretty much coded, needs optimising though!) +- Ambient blur (was in version 1, would be nice to have a comeback!) +- Light styles (cartoony, pixelly, etc.) diff --git a/prettylight.gmx/Configs/Default.config.gmx b/prettylight.gmx/Configs/Default.config.gmx index 9fa3654..2ab04ff 100644 --- a/prettylight.gmx/Configs/Default.config.gmx +++ b/prettylight.gmx/Configs/Default.config.gmx @@ -64,6 +64,7 @@ 1 nil + false false false true @@ -89,6 +90,7 @@ Supersonic Ads true false + Created with GameMaker:Studio false false @@ -101,6 +103,7 @@ true -1 + true false index.html -1 diff --git a/prettylight.gmx/Configs/Default/WinPhone/ApplicationIcon.png b/prettylight.gmx/Configs/Default/WinPhone/ApplicationIcon.png new file mode 100644 index 0000000..6a8b619 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/ApplicationIcon.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleSmall.png b/prettylight.gmx/Configs/Default/WinPhone/CycleSmall.png new file mode 100644 index 0000000..0c1ec77 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleSmall.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide1.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide1.png new file mode 100644 index 0000000..3712d16 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide1.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide2.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide2.png new file mode 100644 index 0000000..35b28ed Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide2.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide3.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide3.png new file mode 100644 index 0000000..44e6be9 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide3.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide4.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide4.png new file mode 100644 index 0000000..47d951a Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide4.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide5.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide5.png new file mode 100644 index 0000000..639c830 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide5.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide6.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide6.png new file mode 100644 index 0000000..ea135f7 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide6.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide7.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide7.png new file mode 100644 index 0000000..a629727 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide7.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide8.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide8.png new file mode 100644 index 0000000..9886ebc Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide8.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/CycleWide9.png b/prettylight.gmx/Configs/Default/WinPhone/CycleWide9.png new file mode 100644 index 0000000..a35a404 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/CycleWide9.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/FlipMedBack.png b/prettylight.gmx/Configs/Default/WinPhone/FlipMedBack.png new file mode 100644 index 0000000..8d70d4c Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/FlipMedBack.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/FlipMedFront.png b/prettylight.gmx/Configs/Default/WinPhone/FlipMedFront.png new file mode 100644 index 0000000..e047b99 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/FlipMedFront.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/FlipSmallBack.png b/prettylight.gmx/Configs/Default/WinPhone/FlipSmallBack.png new file mode 100644 index 0000000..49bea0c Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/FlipSmallBack.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/FlipSmallFront.png b/prettylight.gmx/Configs/Default/WinPhone/FlipSmallFront.png new file mode 100644 index 0000000..c6592f0 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/FlipSmallFront.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/FlipWideBack.png b/prettylight.gmx/Configs/Default/WinPhone/FlipWideBack.png new file mode 100644 index 0000000..3cf7cfd Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/FlipWideBack.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/FlipWideFront.png b/prettylight.gmx/Configs/Default/WinPhone/FlipWideFront.png new file mode 100644 index 0000000..796576d Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/FlipWideFront.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/IconicSmall.png b/prettylight.gmx/Configs/Default/WinPhone/IconicSmall.png new file mode 100644 index 0000000..c58c492 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/IconicSmall.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/IconicWide.png b/prettylight.gmx/Configs/Default/WinPhone/IconicWide.png new file mode 100644 index 0000000..70a8e68 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/IconicWide.png differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage.jpg b/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage.jpg new file mode 100644 index 0000000..b4df444 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage.jpg differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage480.jpg b/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage480.jpg new file mode 100644 index 0000000..b0e0704 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage480.jpg differ diff --git a/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage720.jpg b/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage720.jpg new file mode 100644 index 0000000..04b7ae0 Binary files /dev/null and b/prettylight.gmx/Configs/Default/WinPhone/SplashScreenImage720.jpg differ diff --git a/prettylight.gmx/Configs/Default/android/icons/icon_hdpi.png b/prettylight.gmx/Configs/Default/android/icons/icon_hdpi.png new file mode 100644 index 0000000..ded177e Binary files /dev/null and b/prettylight.gmx/Configs/Default/android/icons/icon_hdpi.png differ diff --git a/prettylight.gmx/Configs/Default/android/icons/icon_ldpi.png b/prettylight.gmx/Configs/Default/android/icons/icon_ldpi.png new file mode 100644 index 0000000..edf85a0 Binary files /dev/null and b/prettylight.gmx/Configs/Default/android/icons/icon_ldpi.png differ diff --git a/prettylight.gmx/Configs/Default/android/icons/icon_mdpi.png b/prettylight.gmx/Configs/Default/android/icons/icon_mdpi.png new file mode 100644 index 0000000..a6f63db Binary files /dev/null and b/prettylight.gmx/Configs/Default/android/icons/icon_mdpi.png differ diff --git a/prettylight.gmx/Configs/Default/android/icons/icon_xhdpi.png b/prettylight.gmx/Configs/Default/android/icons/icon_xhdpi.png new file mode 100644 index 0000000..19049f5 Binary files /dev/null and b/prettylight.gmx/Configs/Default/android/icons/icon_xhdpi.png differ diff --git a/prettylight.gmx/Configs/Default/android/icons/icon_xxhdpi.png b/prettylight.gmx/Configs/Default/android/icons/icon_xxhdpi.png new file mode 100644 index 0000000..efc628d Binary files /dev/null and b/prettylight.gmx/Configs/Default/android/icons/icon_xxhdpi.png differ diff --git a/prettylight.gmx/Configs/Default/android/icons/icon_xxxhdpi.png b/prettylight.gmx/Configs/Default/android/icons/icon_xxxhdpi.png new file mode 100644 index 0000000..72d7d3c Binary files /dev/null and b/prettylight.gmx/Configs/Default/android/icons/icon_xxxhdpi.png differ diff --git a/prettylight.gmx/Configs/Default/android/icons/ouyaIcon.png b/prettylight.gmx/Configs/Default/android/icons/ouyaIcon.png new file mode 100644 index 0000000..6ef7d2d Binary files /dev/null and b/prettylight.gmx/Configs/Default/android/icons/ouyaIcon.png differ diff --git a/prettylight.gmx/Configs/Default/android/splash.png b/prettylight.gmx/Configs/Default/android/splash.png new file mode 100644 index 0000000..75cc0f7 Binary files /dev/null and b/prettylight.gmx/Configs/Default/android/splash.png differ diff --git a/prettylight.gmx/Configs/Default/ios/iPadRetinaSplash.png b/prettylight.gmx/Configs/Default/ios/iPadRetinaSplash.png new file mode 100644 index 0000000..7dad383 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/iPadRetinaSplash.png differ diff --git a/prettylight.gmx/Configs/Default/ios/iPadsplash.png b/prettylight.gmx/Configs/Default/ios/iPadsplash.png new file mode 100644 index 0000000..3dbaca7 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/iPadsplash.png differ diff --git a/prettylight.gmx/Configs/Default/ios/iPhone5splash.png b/prettylight.gmx/Configs/Default/ios/iPhone5splash.png new file mode 100644 index 0000000..7f605cc Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/iPhone5splash.png differ diff --git a/prettylight.gmx/Configs/Default/ios/iPhone6PlusSplash.png b/prettylight.gmx/Configs/Default/ios/iPhone6PlusSplash.png new file mode 100644 index 0000000..0e997c6 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/iPhone6PlusSplash.png differ diff --git a/prettylight.gmx/Configs/Default/ios/iPhone6Splash.png b/prettylight.gmx/Configs/Default/ios/iPhone6Splash.png new file mode 100644 index 0000000..34e3e79 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/iPhone6Splash.png differ diff --git a/prettylight.gmx/Configs/Default/ios/iPhoneRetinasplash.png b/prettylight.gmx/Configs/Default/ios/iPhoneRetinasplash.png new file mode 100644 index 0000000..cc606c4 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/iPhoneRetinasplash.png differ diff --git a/prettylight.gmx/Configs/Default/ios/iPhonesplash.png b/prettylight.gmx/Configs/Default/ios/iPhonesplash.png new file mode 100644 index 0000000..1425f78 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/iPhonesplash.png differ diff --git a/prettylight.gmx/Configs/Default/ios/icons/icon114.png b/prettylight.gmx/Configs/Default/ios/icons/icon114.png new file mode 100644 index 0000000..8202e2c Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/icons/icon114.png differ diff --git a/prettylight.gmx/Configs/Default/ios/icons/icon120.png b/prettylight.gmx/Configs/Default/ios/icons/icon120.png new file mode 100644 index 0000000..8748c68 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/icons/icon120.png differ diff --git a/prettylight.gmx/Configs/Default/ios/icons/icon144.png b/prettylight.gmx/Configs/Default/ios/icons/icon144.png new file mode 100644 index 0000000..5a3f193 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/icons/icon144.png differ diff --git a/prettylight.gmx/Configs/Default/ios/icons/icon152.png b/prettylight.gmx/Configs/Default/ios/icons/icon152.png new file mode 100644 index 0000000..7826ff5 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/icons/icon152.png differ diff --git a/prettylight.gmx/Configs/Default/ios/icons/icon57.png b/prettylight.gmx/Configs/Default/ios/icons/icon57.png new file mode 100644 index 0000000..e1f43da Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/icons/icon57.png differ diff --git a/prettylight.gmx/Configs/Default/ios/icons/icon72.png b/prettylight.gmx/Configs/Default/ios/icons/icon72.png new file mode 100644 index 0000000..7142a87 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/icons/icon72.png differ diff --git a/prettylight.gmx/Configs/Default/ios/icons/icon76.png b/prettylight.gmx/Configs/Default/ios/icons/icon76.png new file mode 100644 index 0000000..8087c5b Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/icons/icon76.png differ diff --git a/prettylight.gmx/Configs/Default/ios/splash.png b/prettylight.gmx/Configs/Default/ios/splash.png new file mode 100644 index 0000000..0b9f026 Binary files /dev/null and b/prettylight.gmx/Configs/Default/ios/splash.png differ diff --git a/prettylight.gmx/Configs/Default/linux/icon64.png b/prettylight.gmx/Configs/Default/linux/icon64.png new file mode 100644 index 0000000..58d096e Binary files /dev/null and b/prettylight.gmx/Configs/Default/linux/icon64.png differ diff --git a/prettylight.gmx/Configs/Default/linux/splash.png b/prettylight.gmx/Configs/Default/linux/splash.png new file mode 100644 index 0000000..f56c9f8 Binary files /dev/null and b/prettylight.gmx/Configs/Default/linux/splash.png differ diff --git a/prettylight.gmx/Configs/Default/tizen/icon117.png b/prettylight.gmx/Configs/Default/tizen/icon117.png new file mode 100644 index 0000000..e21137f Binary files /dev/null and b/prettylight.gmx/Configs/Default/tizen/icon117.png differ diff --git a/prettylight.gmx/Configs/Default/tizen/splash.png b/prettylight.gmx/Configs/Default/tizen/splash.png new file mode 100644 index 0000000..de5af64 Binary files /dev/null and b/prettylight.gmx/Configs/Default/tizen/splash.png differ diff --git a/prettylight.gmx/background/bgExample.background.gmx b/prettylight.gmx/background/bgExample.background.gmx new file mode 100644 index 0000000..affe361 --- /dev/null +++ b/prettylight.gmx/background/bgExample.background.gmx @@ -0,0 +1,19 @@ + + + 0 + 16 + 16 + 0 + 0 + 0 + 0 + -1 + -1 + + 0 + + 0 + 64 + 64 + images\bgExample.png + diff --git a/prettylight.gmx/background/images/bgExample.png b/prettylight.gmx/background/images/bgExample.png new file mode 100644 index 0000000..5eaa910 Binary files /dev/null and b/prettylight.gmx/background/images/bgExample.png differ diff --git a/prettylight.gmx/objects/objLightControl.object.gmx b/prettylight.gmx/objects/control.object.gmx similarity index 88% rename from prettylight.gmx/objects/objLightControl.object.gmx rename to prettylight.gmx/objects/control.object.gmx index 574b82d..b386520 100644 --- a/prettylight.gmx/objects/objLightControl.object.gmx +++ b/prettylight.gmx/objects/control.object.gmx @@ -25,14 +25,10 @@ 1 - /// Controller for lights -lights_init( true , 0 ); + /// Start prettylight -// To make non-lit up areas blue (ooo) -lights_set_ambience( make_color_hsv(200, 125, 50), 0.5 ); - -// Register light objects -lights_add( objLight ); +pl_init(); +pl_add(objLight); @@ -55,8 +51,9 @@ lights_add( objLight ); 1 - /// Process light system -lights_step(); + /// Process prettylight + +pl_update(); @@ -79,14 +76,15 @@ lights_step(); 1 - /// End light system -lights_finish(); + /// End prettylight + +pl_end(); - + 1 603 @@ -103,8 +101,9 @@ lights_finish(); 1 - /// Draw lights -lights_draw(); + /// Draw prettylight + +pl_draw(); diff --git a/prettylight.gmx/objects/objExample.object.gmx b/prettylight.gmx/objects/objExample.object.gmx new file mode 100644 index 0000000..de1eec2 --- /dev/null +++ b/prettylight.gmx/objects/objExample.object.gmx @@ -0,0 +1,62 @@ + + + sprExample + 0 + -1 + 0 + 0 + <undefined> + <undefined> + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + /// Example object that moves around + +if (keyboard_check(vk_left)) { + x -= 13; +} else if (keyboard_check(vk_right)) { + x += 13; +} + +if (keyboard_check(vk_up)) { + y -= 13; +} else if (keyboard_check(vk_down)) { + y += 13; +} + + + + + + + 0 + 0 + 0 + 0.5 + 0.100000001490116 + 0 + 0.100000001490116 + 0.100000001490116 + 0.200000002980232 + -1 + 0 + + 166,202 + 202,202 + + diff --git a/prettylight.gmx/objects/objLight.object.gmx b/prettylight.gmx/objects/objLight.object.gmx index 1719325..37e7be5 100644 --- a/prettylight.gmx/objects/objLight.object.gmx +++ b/prettylight.gmx/objects/objLight.object.gmx @@ -25,19 +25,9 @@ 1 - /// Light object + /// Example light object -/** - * This object represents an object that emits light - * Assign this to any object as it's parent to register the object. - * - * You can then configure the light properties by either - * - Configuring all possible options with light_set() - * - Configuring commonly used options with various light_set functions -*/ - -// The default light settings -light_set( sprLight, 0, 0, 0, 1, 1, 0, c_white, 1 ); +pl_light_init(90, make_color_rgb(252, 150, 55), 1); diff --git a/prettylight.gmx/objects/objLightBig.object.gmx b/prettylight.gmx/objects/objLightBig.object.gmx new file mode 100644 index 0000000..bd946bd --- /dev/null +++ b/prettylight.gmx/objects/objLightBig.object.gmx @@ -0,0 +1,49 @@ + + + <undefined> + 0 + -1 + 0 + 0 + objLight + <undefined> + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + /// Example big light object + +pl_light_init(180, make_color_rgb(252, 150, 55), 1); + + + + + + + 0 + 0 + 0 + 0.5 + 0.100000001490116 + 0 + 0.100000001490116 + 0.100000001490116 + 0.200000002980232 + -1 + 0 + + diff --git a/prettylight.gmx/prettylight.project.gmx b/prettylight.gmx/prettylight.project.gmx index ae39225..441bd1b 100644 --- a/prettylight.gmx/prettylight.project.gmx +++ b/prettylight.gmx/prettylight.project.gmx @@ -6,51 +6,54 @@ - - sprites\sprLight - + sprites\sprExample - + + background\bgExample + - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + + + + + - shaders\shd_gaussian_horizontal.shader - shaders\shd_gaussian_vertical.shader + shaders\pl_shd_gaussian_horizontal.shader + shaders\pl_shd_gaussian_vertical.shader - - objects\objLight - objects\objLightControl - + objects\control + objects\objLight + objects\objLightBig + objects\objExample - + + rooms\rmExample + help.rtf diff --git a/prettylight.gmx/rooms/rmExample.room.gmx b/prettylight.gmx/rooms/rmExample.room.gmx new file mode 100644 index 0000000..b3ff649 --- /dev/null +++ b/prettylight.gmx/rooms/rmExample.room.gmx @@ -0,0 +1,74 @@ + + + + 1280 + 720 + 32 + 32 + 0 + 30 + 0 + 12632256 + -1 + + -1 + -1 + -1 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 0 + 1024 + 768 + 0 + 10 + 0.100000001490116 + diff --git a/prettylight.gmx/scripts/light_set.gml b/prettylight.gmx/scripts/light_set.gml deleted file mode 100644 index a985c2e..0000000 --- a/prettylight.gmx/scripts/light_set.gml +++ /dev/null @@ -1,18 +0,0 @@ -///light_set( sprite, index, xoffset, yoffset, xscale, yscale, rot, colour, alpha ); - -/** - * Set initial properties for a light object - * - * @author FatalSleep - * @author Nik - */ - -ls = argument0; -li = argument1; -xo = argument2; -yo = argument3; -xs = argument4; -ys = argument5; -rs = argument6; -cs = argument7; -as = argument8; diff --git a/prettylight.gmx/scripts/light_set_alpha.gml b/prettylight.gmx/scripts/light_set_alpha.gml deleted file mode 100644 index f02fd4b..0000000 --- a/prettylight.gmx/scripts/light_set_alpha.gml +++ /dev/null @@ -1,9 +0,0 @@ -///light_set_alpha( value ) - -/** - * Sets the alpha value for a light - * - * @author Nik - */ - -as = argument0; diff --git a/prettylight.gmx/scripts/light_set_color.gml b/prettylight.gmx/scripts/light_set_color.gml deleted file mode 100644 index 555cc7c..0000000 --- a/prettylight.gmx/scripts/light_set_color.gml +++ /dev/null @@ -1,9 +0,0 @@ -///light_set_color( colour ); - -/** - * Sets the colour of a light - * - * @author Nik - */ - -cs = argument0; diff --git a/prettylight.gmx/scripts/light_set_offset.gml b/prettylight.gmx/scripts/light_set_offset.gml deleted file mode 100644 index 3ef2242..0000000 --- a/prettylight.gmx/scripts/light_set_offset.gml +++ /dev/null @@ -1,10 +0,0 @@ -///light_set_offset( xoffset, yoffset ); - -/** - * Set the light's offset from the origin - * - * @author FatalSleep - */ - -xo = argument0; -yo = argument1; diff --git a/prettylight.gmx/scripts/light_set_scale.gml b/prettylight.gmx/scripts/light_set_scale.gml deleted file mode 100644 index e2d7619..0000000 --- a/prettylight.gmx/scripts/light_set_scale.gml +++ /dev/null @@ -1,10 +0,0 @@ -///light_set_scale( xscale, yscale ) - -/** - * Sets the scale of the light sprite - * - * @author Nik - */ - -xs = argument0; -ys = argument1; diff --git a/prettylight.gmx/scripts/light_set_sprite.gml b/prettylight.gmx/scripts/light_set_sprite.gml deleted file mode 100644 index b1d6abe..0000000 --- a/prettylight.gmx/scripts/light_set_sprite.gml +++ /dev/null @@ -1,10 +0,0 @@ -///light_set_sprite( sprite, index ) - -/** - * Sets the sprite for the light - * - * @author Nik - */ - -ls = argument0; -li = argument1; diff --git a/prettylight.gmx/scripts/lights_add.gml b/prettylight.gmx/scripts/lights_add.gml deleted file mode 100644 index a91170c..0000000 --- a/prettylight.gmx/scripts/lights_add.gml +++ /dev/null @@ -1,4 +0,0 @@ -///lights_add( obj1, obj2, obj3, ... ) - for( var i = 0; i < argument_count; i ++ ) { - ds_list_add( light_list , argument[ i ] ); - }; diff --git a/prettylight.gmx/scripts/lights_draw.gml b/prettylight.gmx/scripts/lights_draw.gml deleted file mode 100644 index 3751830..0000000 --- a/prettylight.gmx/scripts/lights_draw.gml +++ /dev/null @@ -1,61 +0,0 @@ -///lights_draw() - -/** - * Draws the lighting system - * Preferably called in a Draw GUI event - * - * @author FatalSleep - * @author xygthop3 - * @author Nik - */ - -// Process the lights -surface_set_target( lights ); -draw_clear_alpha( alc, ala ); -draw_set_blend_mode( bm_add ); -for ( var i = 0; i < ds_list_size( light_list ); i ++ ) { - with ( ds_list_find_value( light_list , i ) ) { - draw_sprite_ext( ls , li , x - view_xview[global.light_view_id] + xo , y - view_yview[global.light_view_id] + yo , xs , ys , rs , cs , as ); - } -}; -draw_set_blend_mode( bm_normal ); -surface_reset_target(); - -draw_set_alpha( 1 ); - -// Make lights more vivid if necessary -if ( lv ) { - draw_set_blend_mode( bm_add ); - draw_surface_ext( lights, 0, 0, view_wport[global.light_view_id] / view_wview[global.light_view_id], view_hport[global.light_view_id] / view_hview[global.light_view_id], 0, c_white, 0.5 ); -} - -// Draw lights -draw_set_blend_mode_ext( bm_dest_color, bm_src_color ); -draw_surface_ext( lights, 0, 0, view_wport[global.light_view_id] / view_wview[global.light_view_id], view_hport[global.light_view_id] / view_hview[global.light_view_id], 0, c_white, 1 ); -draw_set_blend_mode( bm_normal ); - -// Process the blurring -if ( ab ) { - // We grab the application surface and blur it horizontally - surface_set_target( blurring ); - if ( shader_enabled ) { - shader_set( shd_gaussian_horizontal ); - } - shader_set_uniform_f( uni_resolution_hoz, var_resolution_x, var_resolution_y ); - draw_surface( application_surface, 0, 0 ); - shader_reset(); - surface_reset_target(); - - // Now we grab that result and blur it vertically - surface_set_target( result ); - if ( shader_enabled ) { - shader_set( shd_gaussian_vertical ); - } - shader_set_uniform_f( uni_resolution_vert, var_resolution_x, var_resolution_y ); - draw_surface( blurring, 0, 0 ); - shader_reset(); - surface_reset_target(); - - // Overlay the blur on top - draw_surface_ext( result , 0, 0, 1, 1, 0, c_white, boa ); -} diff --git a/prettylight.gmx/scripts/lights_finish.gml b/prettylight.gmx/scripts/lights_finish.gml deleted file mode 100644 index d75f136..0000000 --- a/prettylight.gmx/scripts/lights_finish.gml +++ /dev/null @@ -1,13 +0,0 @@ -///lights_finish() - -/** - * Ends the light system - * Preferably called on Room End or Game End - * - * @author Nik - */ - -surface_free( lights ); -surface_free( blurring ); -surface_free( result ); -ds_list_destroy( light_list ); diff --git a/prettylight.gmx/scripts/lights_init.gml b/prettylight.gmx/scripts/lights_init.gml deleted file mode 100644 index 24d42c4..0000000 --- a/prettylight.gmx/scripts/lights_init.gml +++ /dev/null @@ -1,40 +0,0 @@ -///lights_init( shaders? , view_id ) - -/** - * Initialises the lighting system - * Preferably called in a creation or trigger event - * Requires a view to be set - * - * @author Nik - * @author xygthop3 - * @author FatalSleep - */ - -// Options -lights_set_ambience( c_black, 1 ); -lights_set_vivid( true ); -lights_set_blur( true ); -lights_set_blur_alpha( 0.25 ); -lights_set_blur_amount( 3 ); - -// Initialise surfaces -draw_set_color(c_white); -global.light_view_id = argument[1]; -lights = surface_create( view_wport[global.light_view_id], view_hport[global.light_view_id] ); -blurring = surface_create( view_wport[global.light_view_id], view_hport[global.light_view_id] ); -result = surface_create( view_wport[global.light_view_id], view_hport[global.light_view_id] ); - -// Configure light alpha -var s1 = sprite_duplicate( sprLight ); -var s2 = sprite_duplicate( sprLight ); -sprite_set_alpha_from_sprite( s1, s2 ); - -// Initialise gaussian blur shader -uni_resolution_hoz = shader_get_uniform( shd_gaussian_horizontal, "resolution" ); -uni_resolution_vert = shader_get_uniform( shd_gaussian_vertical, "resolution" ); -var_resolution_x = view_wport[global.light_view_id] / bov; -var_resolution_y = view_hport[global.light_view_id] / bov; -shader_enabled = argument[0]; - -// Initialize light list -light_list = ds_list_create(); diff --git a/prettylight.gmx/scripts/lights_set_ambience.gml b/prettylight.gmx/scripts/lights_set_ambience.gml deleted file mode 100644 index 5a2a23f..0000000 --- a/prettylight.gmx/scripts/lights_set_ambience.gml +++ /dev/null @@ -1,10 +0,0 @@ -///lights_set_ambience( colour, alpha ) - -/** - * Sets the ambient colour - * - * @author Nik - */ - -alc = argument0; -ala = argument1; \ No newline at end of file diff --git a/prettylight.gmx/scripts/lights_set_blur.gml b/prettylight.gmx/scripts/lights_set_blur.gml deleted file mode 100644 index 37cc0b8..0000000 --- a/prettylight.gmx/scripts/lights_set_blur.gml +++ /dev/null @@ -1,10 +0,0 @@ -///lights_set_blur( active? ) - -/** - * Make the scene have an ambient blur - * Ambient blurring requires a lot more processing power - * - * @author Nik - */ - -ab = argument0; diff --git a/prettylight.gmx/scripts/lights_set_blur_alpha.gml b/prettylight.gmx/scripts/lights_set_blur_alpha.gml deleted file mode 100644 index bba56e9..0000000 --- a/prettylight.gmx/scripts/lights_set_blur_alpha.gml +++ /dev/null @@ -1,9 +0,0 @@ -///lights_set_blur_alpha( value ) - -/** - * Sets the blur overlay alpha - * - * @author Nik - */ - -boa = argument0; diff --git a/prettylight.gmx/scripts/lights_set_blur_amount.gml b/prettylight.gmx/scripts/lights_set_blur_amount.gml deleted file mode 100644 index f7d4db7..0000000 --- a/prettylight.gmx/scripts/lights_set_blur_amount.gml +++ /dev/null @@ -1,9 +0,0 @@ -///lights_set_blur_amount( value ) - -/** - * Sets the blur overlay amount - * - * @author Nik - */ - -bov = argument0; diff --git a/prettylight.gmx/scripts/lights_set_vivid.gml b/prettylight.gmx/scripts/lights_set_vivid.gml deleted file mode 100644 index fe54447..0000000 --- a/prettylight.gmx/scripts/lights_set_vivid.gml +++ /dev/null @@ -1,10 +0,0 @@ -///lights_set_vivid( active? ) - -/** - * Make lights vivid when drawn - * Vivid lighting requires a bit more processing power - * - * @author Nik - */ - -lv = argument0; diff --git a/prettylight.gmx/scripts/lights_step.gml b/prettylight.gmx/scripts/lights_step.gml deleted file mode 100644 index 1e9e089..0000000 --- a/prettylight.gmx/scripts/lights_step.gml +++ /dev/null @@ -1,20 +0,0 @@ -///lights_step( view_id ) - -/** - * Processes the light system - * Preferably called in a step event - * - * @author FatalSleep - * @author Nik - */ - -// Catch surface errors -if ( !surface_exists( lights ) ) { - lights = surface_create( view_wview[global.light_view_id], view_hview[global.light_view_id] ); -} -if ( !surface_exists( blurring ) ) { - blurring = surface_create( view_wview[global.light_view_id], view_hview[global.light_view_id] ); -} -if ( !surface_exists( result ) ) { - result = surface_create( view_wview[global.light_view_id], view_hview[global.light_view_id] ); -} diff --git a/prettylight.gmx/scripts/pl_add.gml b/prettylight.gmx/scripts/pl_add.gml new file mode 100644 index 0000000..adc62a7 --- /dev/null +++ b/prettylight.gmx/scripts/pl_add.gml @@ -0,0 +1,5 @@ +/// pl_add(obj1, obj2, ...) + +for (var i = 0; i < argument_count; i++) { + ds_list_add(_pl_lightObjects, argument[i]); +} diff --git a/prettylight.gmx/scripts/pl_draw.gml b/prettylight.gmx/scripts/pl_draw.gml new file mode 100644 index 0000000..08a8c6a --- /dev/null +++ b/prettylight.gmx/scripts/pl_draw.gml @@ -0,0 +1,12 @@ +/// pl_draw() + +// Draw vivid lightmap +if (_pl_vivid) { + draw_set_blend_mode(bm_add); + draw_surface_ext(_pl_lightmap, view_xview[0], view_yview[0], 1, 1, 0, c_white, 0.1); +} + +// Draw standard lightmap +draw_set_blend_mode_ext(bm_dest_color, bm_src_color); +draw_surface(_pl_lightmap, view_xview[0], view_yview[0]); +draw_set_blend_mode(bm_normal); diff --git a/prettylight.gmx/scripts/pl_end.gml b/prettylight.gmx/scripts/pl_end.gml new file mode 100644 index 0000000..12caf96 --- /dev/null +++ b/prettylight.gmx/scripts/pl_end.gml @@ -0,0 +1,10 @@ +/// pl_end() + +surface_free(_pl_lightmap); +surface_free(_pl_blurmap); + +for (var i = 0; i < ds_list_size(_pl_lightObjects); i++) { + with (ds_list_find_value(_pl_lightObjects , i)) { + pl_light_destroy(); + } +} diff --git a/prettylight.gmx/scripts/pl_init.gml b/prettylight.gmx/scripts/pl_init.gml new file mode 100644 index 0000000..a1a484f --- /dev/null +++ b/prettylight.gmx/scripts/pl_init.gml @@ -0,0 +1,22 @@ +/// pl_init() + +// Setup light object list +_pl_lightObjects = ds_list_create(); + +// Setup the global light surface +_pl_lightmap = surface_create(view_wview[0], view_hview[0]); +_pl_vivid = true; + +// Setup blurring +_pl_blurmap = surface_create(view_wview[0], view_hview[0]); +_pl_blurring = true; + +// Set options +pl_option_set_ambience(make_color_rgb(1, 16, 32), 0.8); +pl_option_set_blur(5, 0.25); + +// Initialise gaussian blur shader +_pl_uni_resolution_hoz = shader_get_uniform(pl_shd_gaussian_horizontal, "resolution"); +_pl_uni_resolution_vert = shader_get_uniform(pl_shd_gaussian_vertical, "resolution"); +_pl_var_resolution_x = view_wport[0] / _pl_blurringAmount; +_pl_var_resolution_y = view_hport[0] / _pl_blurringAmount; diff --git a/prettylight.gmx/scripts/pl_light_destroy.gml b/prettylight.gmx/scripts/pl_light_destroy.gml new file mode 100644 index 0000000..f397fc4 --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_destroy.gml @@ -0,0 +1,3 @@ +/// pl_light_destroy() + +surface_free(_pl_lightSurface); diff --git a/prettylight.gmx/scripts/pl_light_draw.gml b/prettylight.gmx/scripts/pl_light_draw.gml new file mode 100644 index 0000000..0d052ab --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_draw.gml @@ -0,0 +1,4 @@ +/// pl_light_draw() + +// Draw light +draw_surface(_pl_lightSurface, x - _pl_baseRadius - view_xview[0], y - _pl_baseRadius - view_yview[0]); diff --git a/prettylight.gmx/scripts/pl_light_get_alpha.gml b/prettylight.gmx/scripts/pl_light_get_alpha.gml new file mode 100644 index 0000000..785b9ef --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_get_alpha.gml @@ -0,0 +1,3 @@ +/// pl_light_get_alpha() + +return _pl_alpha; diff --git a/prettylight.gmx/scripts/pl_light_get_color.gml b/prettylight.gmx/scripts/pl_light_get_color.gml new file mode 100644 index 0000000..b64d5e7 --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_get_color.gml @@ -0,0 +1,3 @@ +/// pl_light_get_color() + +return _pl_color; diff --git a/prettylight.gmx/scripts/pl_light_get_radius.gml b/prettylight.gmx/scripts/pl_light_get_radius.gml new file mode 100644 index 0000000..3fd88d7 --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_get_radius.gml @@ -0,0 +1,3 @@ +/// pl_light_get_radius() + +return _pl_radius; diff --git a/prettylight.gmx/scripts/pl_light_init.gml b/prettylight.gmx/scripts/pl_light_init.gml new file mode 100644 index 0000000..9bee7fc --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_init.gml @@ -0,0 +1,10 @@ +/// pl_light_init(radius, colour, alpha) + +// Set light properties +_pl_radius = argument0; +_pl_baseRadius = argument0; +_pl_color = argument1; +_pl_alpha = argument2; + +// Setup the individual light surface +_pl_lightSurface = surface_create(_pl_radius * 2, _pl_radius * 2); diff --git a/prettylight.gmx/scripts/pl_light_set_alpha.gml b/prettylight.gmx/scripts/pl_light_set_alpha.gml new file mode 100644 index 0000000..03f0fde --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_set_alpha.gml @@ -0,0 +1,3 @@ +/// pl_light_set_alpha(value) + +_pl_alpha = argument0; diff --git a/prettylight.gmx/scripts/pl_light_set_color.gml b/prettylight.gmx/scripts/pl_light_set_color.gml new file mode 100644 index 0000000..f9f17d3 --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_set_color.gml @@ -0,0 +1,3 @@ +/// pl_light_set_color(value) + +_pl_color = argument0; diff --git a/prettylight.gmx/scripts/pl_light_set_radius.gml b/prettylight.gmx/scripts/pl_light_set_radius.gml new file mode 100644 index 0000000..14a1d53 --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_set_radius.gml @@ -0,0 +1,3 @@ +/// pl_light_set_radius(value) + +_pl_radius = clamp(argument0, 1, _l_baseRadius); diff --git a/prettylight.gmx/scripts/pl_light_update.gml b/prettylight.gmx/scripts/pl_light_update.gml new file mode 100644 index 0000000..d0c28d6 --- /dev/null +++ b/prettylight.gmx/scripts/pl_light_update.gml @@ -0,0 +1,20 @@ +/// pl_light_update() + +// Prepare the light surface +if (!surface_exists(_pl_lightSurface)) { + _pl_lightSurface = surface_create(_pl_baseRadius * 2, _pl_baseRadius * 2); +} +surface_set_target(_pl_lightSurface); + + draw_clear(c_black); + + // Draw light + draw_set_alpha(_pl_alpha); + draw_circle_color(_pl_baseRadius, _pl_baseRadius, _pl_radius, _pl_color, c_black, false); + + // Reset + draw_set_alpha(1); + draw_set_color(c_black); + +// Reset +surface_reset_target(); diff --git a/prettylight.gmx/scripts/pl_option_set_ambience.gml b/prettylight.gmx/scripts/pl_option_set_ambience.gml new file mode 100644 index 0000000..c9fdf90 --- /dev/null +++ b/prettylight.gmx/scripts/pl_option_set_ambience.gml @@ -0,0 +1,4 @@ +/// pl_option_set_ambience(color, brightness) + +_pl_ambientColor = argument0; +_pl_ambientBrightness = argument1; diff --git a/prettylight.gmx/scripts/pl_option_set_blur.gml b/prettylight.gmx/scripts/pl_option_set_blur.gml new file mode 100644 index 0000000..dcebf45 --- /dev/null +++ b/prettylight.gmx/scripts/pl_option_set_blur.gml @@ -0,0 +1,4 @@ +/// pl_option_set_blur(amount, alpha) + +_pl_blurringAmount = argument0; +_pl_blurringAlpha = argument1; diff --git a/prettylight.gmx/scripts/pl_set_blurring.gml b/prettylight.gmx/scripts/pl_set_blurring.gml new file mode 100644 index 0000000..ff7f57b --- /dev/null +++ b/prettylight.gmx/scripts/pl_set_blurring.gml @@ -0,0 +1,3 @@ +/// pl_set_blurring(active?) + +_pl_blurring = argument0; diff --git a/prettylight.gmx/scripts/pl_set_vivid.gml b/prettylight.gmx/scripts/pl_set_vivid.gml new file mode 100644 index 0000000..17dbf7e --- /dev/null +++ b/prettylight.gmx/scripts/pl_set_vivid.gml @@ -0,0 +1,3 @@ +/// pl_set_vivid(active?) + +_pl_vivid = argument0; diff --git a/prettylight.gmx/scripts/pl_update.gml b/prettylight.gmx/scripts/pl_update.gml new file mode 100644 index 0000000..ea353a7 --- /dev/null +++ b/prettylight.gmx/scripts/pl_update.gml @@ -0,0 +1,70 @@ +/// pl_update() + +// Update lights +for (var i = 0; i < ds_list_size(_pl_lightObjects); i++) { + with (ds_list_find_value(_pl_lightObjects , i)) { + pl_light_update(); + } +} + +// Prepare lightmap +if (!surface_exists(_pl_lightmap)) { + _pl_lightmap = surface_create(view_wview[0], view_hview[0]); +} + +surface_set_target(_pl_lightmap); + + // Draw ambience + draw_clear(c_black); + draw_set_alpha(_pl_ambientBrightness); + draw_set_color(_pl_ambientColor); + draw_rectangle(0, 0, surface_get_width(_pl_lightmap), surface_get_height(_pl_lightmap), false); + + // Draw lights + draw_set_alpha(1); + draw_set_blend_mode(bm_add); + for (var i = 0; i < ds_list_size(_pl_lightObjects); i++) { + with (ds_list_find_value(_pl_lightObjects , i)) { + pl_light_draw(); + } + } + +// Reset +surface_reset_target(); +draw_set_colour(c_white); +draw_set_blend_mode(bm_normal); + +if (_pl_blurring) { + + // Prepare blurmap + if (!surface_exists(_pl_blurmap)) { + _pl_blurmap = surface_create(view_wview[0], view_hview[0]); + } + + surface_set_target(_pl_blurmap); + + // Draw blur + draw_clear(c_black); + draw_set_blend_mode(bm_add); + + shader_set(pl_shd_gaussian_horizontal); + shader_set_uniform_f(_pl_uni_resolution_hoz, _pl_var_resolution_x, _pl_var_resolution_y); + draw_surface(_pl_lightmap, 0, 0); + shader_reset(); + + surface_reset_target(); + + surface_set_target(_pl_lightmap); + + draw_clear(c_black); + + shader_set(pl_shd_gaussian_vertical); + shader_set_uniform_f(_pl_uni_resolution_vert, _pl_var_resolution_x, _pl_var_resolution_y); + draw_surface(_pl_blurmap, 0, 0); + shader_reset(); + + // Reset + surface_reset_target(); + draw_set_colour(c_white); + draw_set_blend_mode(bm_normal); +} diff --git a/prettylight.gmx/shaders/shd_gaussian_horizontal.shader b/prettylight.gmx/shaders/pl_shd_gaussian_horizontal.shader similarity index 100% rename from prettylight.gmx/shaders/shd_gaussian_horizontal.shader rename to prettylight.gmx/shaders/pl_shd_gaussian_horizontal.shader diff --git a/prettylight.gmx/shaders/shd_gaussian_vertical.shader b/prettylight.gmx/shaders/pl_shd_gaussian_vertical.shader similarity index 100% rename from prettylight.gmx/shaders/shd_gaussian_vertical.shader rename to prettylight.gmx/shaders/pl_shd_gaussian_vertical.shader diff --git a/prettylight.gmx/sprites/images/sprExample_0.png b/prettylight.gmx/sprites/images/sprExample_0.png new file mode 100644 index 0000000..2ed6f65 Binary files /dev/null and b/prettylight.gmx/sprites/images/sprExample_0.png differ diff --git a/prettylight.gmx/sprites/images/sprLight_0.png b/prettylight.gmx/sprites/images/sprLight_0.png deleted file mode 100644 index c9e111b..0000000 Binary files a/prettylight.gmx/sprites/images/sprLight_0.png and /dev/null differ diff --git a/prettylight.gmx/sprites/sprLight.sprite.gmx b/prettylight.gmx/sprites/sprExample.sprite.gmx similarity index 60% rename from prettylight.gmx/sprites/sprLight.sprite.gmx rename to prettylight.gmx/sprites/sprExample.sprite.gmx index 7f23499..efd83af 100644 --- a/prettylight.gmx/sprites/sprLight.sprite.gmx +++ b/prettylight.gmx/sprites/sprExample.sprite.gmx @@ -1,25 +1,25 @@ 0 - 128 - 128 + 64 + 64 1 0 0 0 - 0 - 255 - 0 - 255 + 1 + 125 + 1 + 125 0 0 0 0 - 256 - 256 + 128 + 128 - images\sprLight_0.png + images\sprExample_0.png diff --git a/prettylight.gmz b/prettylight.gmz deleted file mode 100644 index 66adb8f..0000000 Binary files a/prettylight.gmz and /dev/null differ