Skip to content

Commit e723316

Browse files
"oohh BROOOOTHER, this GUY STINKS!!1!!"
- renamed "FILTERS_ALLOWED" to "SHADERS_ALLOWED" for better consistency - renamed "SOUND_EFFECTS_ALLOWED" to "SOUND_FILTERS_ALLOWED" for better consistency - added scanline shader - added shift mechanic for text boxes
1 parent bc0ae08 commit e723316

21 files changed

+549
-176
lines changed

.prettierrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module.exports = {
1010
useTabs: false,
1111
tabWidth: 2,
1212

13-
// Use single quotes
14-
singleQuote: true,
13+
// Use double quotes
14+
singleQuote: false,
1515
quoteProps: "preserve",
1616
parser: "json",
1717

.vscode/extensions.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"recommendations": [
3-
"openfl.lime-vscode-extension",
4-
"redhat.vscode-xml",
5-
"vshaxe.haxe-extension-pack",
6-
"vshaxe.haxe-checkstyle",
7-
"streetsidesoftware.code-spell-checker"
8-
]
2+
"recommendations": [
3+
"openfl.lime-vscode-extension",
4+
"redhat.vscode-xml",
5+
"vshaxe.haxe-extension-pack",
6+
"vshaxe.haxe-checkstyle",
7+
"streetsidesoftware.code-spell-checker"
8+
]
99
}

.vscode/launch.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
"name": "Build + Debug",
6-
"type": "lime",
7-
"request": "launch"
8-
},
9-
{
10-
"name": "Debug",
11-
"type": "lime",
12-
"request": "launch",
13-
"preLaunchTask": null
14-
},
15-
{
16-
"name": "Macro",
17-
"type": "haxe-eval",
18-
"request": "launch"
19-
}
20-
]
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Build + Debug",
6+
"type": "lime",
7+
"request": "launch"
8+
},
9+
{
10+
"name": "Debug",
11+
"type": "lime",
12+
"request": "launch",
13+
"preLaunchTask": null
14+
},
15+
{
16+
"name": "Macro",
17+
"type": "haxe-eval",
18+
"request": "launch"
19+
}
20+
]
2121
}

.vscode/settings.json

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
11
{
2-
"search.exclude": {
3-
"export/**/*.*": true
4-
},
5-
"[haxe]": {
6-
"editor.formatOnSave": true,
7-
"editor.formatOnSaveMode":"modifications",
8-
"editor.formatOnPaste": false,
9-
"editor.codeActionsOnSave": {
10-
"source.sortImports": "explicit"
11-
}
12-
},
13-
"haxe.enableExtendedIndentation": true,
14-
"cSpell.words": [
15-
"Haxe"
16-
]
2+
"search.exclude": {
3+
"export/**/*.*": true
4+
},
5+
"[haxe]": {
6+
"editor.formatOnSave": true,
7+
"editor.formatOnSaveMode": "modifications",
8+
"editor.formatOnPaste": false,
9+
"editor.codeActionsOnSave": {
10+
"source.sortImports": "explicit"
11+
}
12+
},
13+
"haxe.enableExtendedIndentation": true,
14+
"cSpell.words": [
15+
"GRAVEACCENT",
16+
"Haxe",
17+
"IBEAM",
18+
"NUMPADEIGHT",
19+
"NUMPADFIVE",
20+
"NUMPADFOUR",
21+
"NUMPADMINUS",
22+
"NUMPADMULTIPLY",
23+
"NUMPADNINE",
24+
"NUMPADONE",
25+
"NUMPADPERIOD",
26+
"NUMPADPLUS",
27+
"NUMPADSEVEN",
28+
"NUMPADSIX",
29+
"NUMPADTHREE",
30+
"NUMPADTWO",
31+
"NUMPADZERO",
32+
"NUMPADSLASH",
33+
"openeditors"
34+
]
1735
}

.vscode/tasks.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"version": "2.0.0",
3-
"tasks": [
4-
{
5-
"type": "lime",
6-
"command": "test",
7-
"group": {
8-
"kind": "build",
9-
"isDefault": true
10-
}
11-
}
12-
]
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "lime",
6+
"command": "test",
7+
"group": {
8+
"kind": "build",
9+
"isDefault": true
10+
}
11+
}
12+
]
1313
}

assets/shaders/scanline.frag

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#pragma header
2+
const float scale = 1.0;
3+
4+
void main()
5+
{
6+
if (mod(floor(openfl_TextureCoordv.y * openfl_TextureSize.y / scale), 2.0) == 0.0)
7+
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
8+
else
9+
gl_FragColor = texture2D(bitmap, openfl_TextureCoordv);
10+
}

project.hxp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class Project extends HXProject
105105
* Enables the game to use filters, giving it a more unsettling and unnerving vibe.
106106
* Sort of like the analog horror videos you see on YouTube.
107107
*/
108-
static final FILTERS_ALLOWED:FeatureFlag = 'FILTERS_ALLOWED';
108+
static final SHADERS_ALLOWED:FeatureFlag = 'SHADERS_ALLOWED';
109109

110110
/**
111111
* Allows the developer(s) to use built-in editors,
@@ -124,7 +124,7 @@ class Project extends HXProject
124124
* Enables the game to programmatically change sounds and add
125125
* all kinds of effects to them.
126126
*/
127-
static final SOUND_EFFECTS_ALLOWED:FeatureFlag = 'SOUND_EFFECTS_ALLOWED';
127+
static final SOUND_FILTERS_ALLOWED:FeatureFlag = 'SOUND_FILTERS_ALLOWED';
128128

129129
public function new()
130130
{
@@ -360,7 +360,7 @@ class Project extends HXProject
360360

361361
// Enable dope ass screen filters
362362
// (if the platform is on desktop)
363-
FILTERS_ALLOWED.apply(this, isDesktop());
363+
SHADERS_ALLOWED.apply(this, isDesktop());
364364

365365
// Enable the editors if the game is in debug mode,
366366
// otherwise, disable them of course
@@ -372,7 +372,7 @@ class Project extends HXProject
372372

373373
// Allows the game to programmatically change sounds
374374
// (only works on desktop)
375-
SOUND_EFFECTS_ALLOWED.apply(this, isDesktop());
375+
SOUND_FILTERS_ALLOWED.apply(this, isDesktop());
376376
}
377377

378378
/**
@@ -444,7 +444,7 @@ class Project extends HXProject
444444
// ===================
445445

446446
// Manipulating sound effects programmatically
447-
if (SOUND_EFFECTS_ALLOWED.isEnabled(this))
447+
if (SOUND_FILTERS_ALLOWED.isEnabled(this))
448448
{
449449
addHaxelib('flxsoundfilters');
450450
}
@@ -458,7 +458,7 @@ class Project extends HXProject
458458

459459
function configureAssets()
460460
{
461-
info('ADDING ASSET PATHS');
461+
// info('ADDING ASSET PATHS');
462462

463463
// Add font assets
464464
addAssetPath('assets/fonts', 'assets/fonts', 'default', ['*.ttf'], []);
@@ -722,7 +722,7 @@ class Project extends HXProject
722722
}
723723
else
724724
{
725-
info(' Adding asset path ${path}...');
725+
// info(' Adding asset path ${path}...');
726726
}
727727

728728
for (file in sys.FileSystem.readDirectory(path))

source/InitState.hx

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
package;
22

3-
import starcore.menus.MainMenuState;
4-
import starcore.backend.util.FlixelUtil;
5-
import starcore.backend.util.LoggerUtil;
6-
import openfl.display.StageQuality;
7-
import flixel.tweens.FlxTween;
3+
import flixel.FlxG;
4+
import flixel.FlxState;
85
import flixel.math.FlxMath;
9-
import starcore.backend.util.CacheUtil;
6+
import flixel.system.FlxAssets;
7+
import flixel.tweens.FlxTween;
8+
import lime.app.Application;
9+
import openfl.Lib;
10+
import openfl.display.StageQuality;
11+
import openfl.display.StageScaleMode;
1012
import starcore.backend.data.ClientPrefs;
13+
import starcore.backend.util.CacheUtil;
14+
import starcore.backend.util.FlixelUtil;
15+
import starcore.backend.util.LoggerUtil;
1116
import starcore.backend.util.PathUtil;
12-
import flixel.system.FlxAssets;
13-
import openfl.filters.ShaderFilter;
14-
import flixel.FlxG;
15-
import flixel.FlxState;
17+
import starcore.menus.MainMenuState;
1618
#if DISCORD_ALLOWED
1719
import starcore.backend.api.DiscordClient;
1820
#end
19-
import lime.app.Application;
20-
import openfl.Lib;
21-
import openfl.display.StageScaleMode;
22-
#if FILTERS_ALLOWED
23-
import starcore.filters.*;
21+
#if SHADERS_ALLOWED
22+
import starcore.shaders.*;
2423
#end
2524
#if web
2625
import js.Browser;
@@ -101,20 +100,20 @@ class InitState extends FlxState
101100
});
102101
#end
103102

104-
// Assign the filters AFTER all assets have been loaded!
105-
#if FILTERS_ALLOWED
106-
CacheUtil.vcrBorderFilter = new VCRBorderFilter();
107-
CacheUtil.vcrMario85Filter = new VCRMario85Filter();
103+
// Assign the shaders AFTER all assets have been loaded!
104+
#if SHADERS_ALLOWED
105+
CacheUtil.vcrBorderFilter = new VCRBorderShader();
106+
CacheUtil.vcrMario85Filter = new VCRMario85Shader();
108107
#end
109108
}
110109

111110
function addBackgroundProcesses():Void
112111
{
113112
// Log info
114113
LoggerUtil.log('Adding background processes');
115-
// Update the filters that need to
114+
// Update the shaders that need to
116115
// constantly be reset
117-
#if FILTERS_ALLOWED
116+
#if SHADERS_ALLOWED
118117
FlxG.signals.postUpdate.add(() ->
119118
{
120119
CacheUtil.vcrMario85Filter.update(FlxG.elapsed);
@@ -140,7 +139,7 @@ class InitState extends FlxState
140139
FlxG.sound.volume = (!(Math.abs(FlxG.sound.volume) < FlxMath.EPSILON)) ? 0.1 : 0;
141140
CacheUtil.isWindowFocused = true;
142141
// Set the volume back to the last volume used
143-
FlxTween.num(FlxG.sound.volume, CacheUtil.lastVolumeUsed, 0.3, {type: FlxTweenType.ONESHOT}, (v) ->
142+
FlxTween.num(FlxG.sound.volume, CacheUtil.lastVolumeUsed, 0.3, {type: FlxTweenType.ONESHOT}, (v:Float) ->
144143
{
145144
FlxG.sound.volume = v;
146145
});
@@ -155,8 +154,8 @@ class InitState extends FlxState
155154
// Set the last volume used to the current volume
156155
CacheUtil.lastVolumeUsed = FlxG.sound.volume;
157156
CacheUtil.isWindowFocused = false;
158-
// Tween the volume to 0.03
159-
FlxTween.num(FlxG.sound.volume, (!(Math.abs(FlxG.sound.volume) < FlxMath.EPSILON)) ? 0.05 : 0, 0.3, {type: FlxTweenType.ONESHOT}, (v) ->
157+
// Tween the volume to 0.05
158+
FlxTween.num(FlxG.sound.volume, (!(Math.abs(FlxG.sound.volume) < FlxMath.EPSILON)) ? 0.05 : 0, 0.3, {type: FlxTweenType.ONESHOT}, (v:Float) ->
160159
{
161160
FlxG.sound.volume = v;
162161
});
@@ -167,12 +166,6 @@ class InitState extends FlxState
167166
// Do shit like saving the user's data when the game closes
168167
Application.current.window.onClose.add(() ->
169168
{
170-
// Despite it saying "closeGame", it's not actually closing
171-
// the game since the parameter "sysShutdown" is false. What's
172-
// actually happening is all of the data is still saving and other utilities
173-
// (i.e. Discord RPC and logging) are still being shutdown. This is just for keeping the
174-
// code D.R.Y and still doing everything that is needed when the game closes!
175-
// - Kori ;3
176169
FlixelUtil.closeGame(false);
177170
});
178171
}

source/starcore/backend/api/DiscordClient.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package starcore.backend.api;
22

3+
import starcore.backend.data.Constants;
34
#if DISCORD_ALLOWED
45
import starcore.backend.util.LoggerUtil;
56
import starcore.backend.data.ClientPrefs;
@@ -16,7 +17,6 @@ import sys.thread.Thread;
1617
final class DiscordClient
1718
{
1819
static var presence:DiscordRichPresence = new DiscordRichPresence();
19-
static var appId:String = '1361513332883980309'; // ID for the Discord application
2020

2121
function new() {}
2222

@@ -30,7 +30,7 @@ final class DiscordClient
3030
// Log info
3131
LoggerUtil.log('Initializing Discord rich presence');
3232
// Initialize the client
33-
Discord.Initialize(appId, null, true, null);
33+
Discord.Initialize(Constants.DISCORD_APP_ID, null, true, null);
3434
// Start the timer (for the amount of time the player has played the game)
3535
presence.startTimestamp = Math.floor(Sys.time());
3636
// Start a thread that runs in the background which
@@ -49,8 +49,8 @@ final class DiscordClient
4949
}
5050
});
5151
}
52-
// Add an event listener that shuts down Discord rich presence
53-
// when the game closes
52+
// Add an event listener that shuts down
53+
// Discord rich presence when the game closes
5454
Application.current.window.onClose.add(() ->
5555
{
5656
shutdown();

0 commit comments

Comments
 (0)