16 |
17 |
18 |
19 |
{post.data.title}
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/tests/odyc-e2e/functional/canvases-singleton/index.test.ts:
--------------------------------------------------------------------------------
1 | import { expect, test } from 'vitest'
2 | import { init } from './index'
3 |
4 | test('createGame does not create multiple canvases when called multiple times', async () => {
5 | init()
6 | const rendererCanvases = document.querySelectorAll('.odyc-renderer-canvas')
7 | expect(rendererCanvases.length).toBe(1)
8 |
9 | const dialogCanvases = document.querySelectorAll('.odyc-dialog-canvas')
10 | expect(dialogCanvases.length).toBe(1)
11 |
12 | const promptCanvases = document.querySelectorAll('.odyc-prompt-canvas')
13 | expect(promptCanvases.length).toBe(1)
14 |
15 | const messageCanvases = document.querySelectorAll('.odyc-message-canvas')
16 | expect(messageCanvases.length).toBe(1)
17 |
18 | const filterCanvases = document.querySelectorAll('.odyc-filter-canvas')
19 | expect(filterCanvases.length).toBe(1)
20 | })
21 |
--------------------------------------------------------------------------------
/tests/odyc-e2e/visual/template-foreground/index.test.ts:
--------------------------------------------------------------------------------
1 | import { expect, test } from 'vitest'
2 | import { init } from './index'
3 | import { page } from '@vitest/browser/context'
4 | import { assertEventuelly, registerImageSnapshot } from '../../helpers'
5 |
6 | test('renders foreground templates above the player', async () => {
7 | registerImageSnapshot(expect)
8 |
9 | const { game, state } = init()
10 |
11 | await assertEventuelly(async () => {
12 | const screenshot = await page.screenshot({ base64: true, save: false })
13 | await expect(screenshot).toMatchImageSnapshot('sprite-in-foreground')
14 | })
15 |
16 | game.setCell(0, 0, { foreground: false })
17 |
18 | await assertEventuelly(async () => {
19 | const screenshot = await page.screenshot({ base64: true, save: false })
20 | await expect(screenshot).toMatchImageSnapshot('sprite-in-background')
21 | })
22 | })
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/enhancement.yml:
--------------------------------------------------------------------------------
1 | name: Feature request!
2 | description: Enhancements. e.g. “I wish Odyc did this.” Suggest an idea!
3 | labels: [enhancement]
4 | body:
5 | - type: textarea
6 | id: problem
7 | attributes:
8 | label: Is your feature request related to a problem? Please describe.
9 | description: "Optional: A clear and concise description of what the problem is. Ex. I'm always frustrated when ..."
10 | - type: textarea
11 | id: solution
12 | attributes:
13 | label: Describe the solution you'd like
14 | description: A clear and concise description of what you want to happen.
15 | validations:
16 | required: true
17 | - type: textarea
18 | id: context
19 | attributes:
20 | label: Additional context
21 | description: 'Optional: Add any other context or screenshots about the feature request here.'
22 |
--------------------------------------------------------------------------------
/apps/odyc.dev/src/content/docs/0-getting-started/2-quick-start.md:
--------------------------------------------------------------------------------
1 | ---
2 | category: Getting started
3 | title: Quick Start
4 | ---
5 |
6 |
7 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
8 |
9 | ## Installation
10 |
11 | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
12 |
13 | ```bash
14 | npm install odyc
15 | ```
16 |
17 | ## Your First Game
18 |
19 | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
20 |
21 | ```javascript
22 | import { createGame } from 'odyc'
23 |
24 | const game = createGame({
25 | // Lorem ipsum configuration
26 | })
27 | ```
28 |
29 | ## Next Steps
30 |
31 | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
32 |
--------------------------------------------------------------------------------
/apps/odyc.dev/src/content/docs/fr/0-getting-started/2-quick-start.md:
--------------------------------------------------------------------------------
1 | ---
2 | category: Commencer
3 | title: Démarrage rapide
4 | ---
5 |
6 |
7 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
8 |
9 | ## Installation
10 |
11 | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
12 |
13 | ```bash
14 | npm install odyc
15 | ```
16 |
17 | ## Votre premier jeu
18 |
19 | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
20 |
21 | ```javascript
22 | import { createGame } from 'odyc'
23 |
24 | const game = createGame({
25 | // Configuration lorem ipsum
26 | })
27 | ```
28 |
29 | ## Étapes suivantes
30 |
31 | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
32 |
--------------------------------------------------------------------------------
/apps/odyc.dev/astro.config.mjs:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | import tailwindcss from '@tailwindcss/vite'
3 | import { defineConfig } from 'astro/config'
4 | import svelte from '@astrojs/svelte'
5 | import { defaultLocale, locales } from '#lib/i18n/index.ts'
6 |
7 | import expressiveCode from 'astro-expressive-code'
8 |
9 | // https://astro.build/config
10 | export default defineConfig({
11 | i18n: {
12 | locales: [...locales],
13 | defaultLocale,
14 | fallback: {
15 | fr: 'en',
16 | },
17 | routing: {
18 | fallbackType: 'rewrite',
19 | },
20 | },
21 | vite: {
22 | plugins: [tailwindcss()],
23 | },
24 |
25 | integrations: [
26 | svelte(),
27 | expressiveCode({
28 | themes: ['min-light'],
29 | styleOverrides: {
30 | borderRadius: 'none',
31 | borderColor: 'var(--color-gray-200)',
32 | frames: {
33 | shadowColor: 'none',
34 | },
35 | },
36 | }),
37 | ],
38 | })
39 |
--------------------------------------------------------------------------------
/packages/odyc/src/shaders/glow.frag.glsl:
--------------------------------------------------------------------------------
1 | precision mediump float;
2 |
3 | varying vec2 v_texCoords;
4 | uniform sampler2D u_texture;
5 | uniform vec2 u_size;
6 |
7 | uniform float u_intensity;
8 |
9 | #define PI 3.14159265359
10 | #define TWO_PI 6.28318530718
11 | #define CELL_SIZE 24.
12 |
13 | vec3 blur() {
14 | vec2 radius = CELL_SIZE / u_size;
15 | vec3 blur = vec3(0);
16 | float count = 0.;
17 |
18 | for (int j = 0; j < 16; j++) {
19 | float d = float(j) * TWO_PI / 16.;
20 | vec2 offset = vec2(cos(d), sin(d)) / (u_size / CELL_SIZE);
21 | blur += texture2D(u_texture, v_texCoords + offset).rgb;
22 | count++;
23 | }
24 | return blur / count;
25 | }
26 |
27 | void main() {
28 | vec3 color = texture2D(u_texture, v_texCoords).rgb;
29 | vec3 with_blur = mix(color, blur(), u_intensity);
30 | gl_FragColor = vec4(max(color, with_blur), 1.);
31 | }
32 |
--------------------------------------------------------------------------------
/packages/odyc/src/ender.ts:
--------------------------------------------------------------------------------
1 | import { Camera } from './camera.js'
2 | import { GameState } from './gameState/index.js'
3 | import { MessageBox } from './messageBox.js'
4 |
5 | type EnderParams