-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
game within component (broken in prod)
- Loading branch information
1 parent
6054f40
commit fc350a8
Showing
12 changed files
with
115 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<p>game works!</p> | ||
<div #rendererContainer class="game-container w-full h-screen absolute top-0 left-0"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { GameComponent } from './game.component'; | ||
|
||
describe('GameComponent', () => { | ||
let component: GameComponent; | ||
let fixture: ComponentFixture<GameComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [GameComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(GameComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// game.component.ts | ||
import { Component, ElementRef, ViewChild, AfterViewInit } from '@angular/core'; | ||
import { Game } from "../../client/core/Game.ts"; | ||
|
||
@Component({ | ||
selector: 'app-game', | ||
templateUrl: './game.component.html', | ||
standalone: true, | ||
}) | ||
export class GameComponent implements AfterViewInit { | ||
@ViewChild('rendererContainer') rendererContainer!: ElementRef; | ||
private game?: Game; | ||
|
||
ngAfterViewInit() { | ||
this.game = new Game(this.rendererContainer.nativeElement); | ||
this.game.start(); | ||
console.log('init!') | ||
} | ||
|
||
ngOnDestroy() { | ||
// Add cleanup if needed | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,13 @@ | ||
import { Component } from '@angular/core'; | ||
import {GameComponent} from "../game/game.component.ts"; | ||
|
||
@Component({ | ||
selector: 'app-home', | ||
standalone: true, | ||
template: ` | ||
<h2>Analog</h2> | ||
<h3>The fullstack meta-framework for Angular!</h3> | ||
<p class="read-the-docs"> | ||
<a href="https://analogjs.org" target="_blank">Docs</a> | | ||
<a href="https://github.com/analogjs/analog" target="_blank">GitHub</a> | | ||
<a href="https://github.com/sponsors/brandonroberts" target="_blank"> | ||
Sponsor | ||
</a> | ||
</p> | ||
`, | ||
styles: ` | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
.read-the-docs > * { | ||
color: #fff; | ||
} | ||
@media (prefers-color-scheme: light) { | ||
.read-the-docs > * { | ||
color: #213547; | ||
} | ||
} | ||
`, | ||
template: `<app-game></app-game>`, | ||
styles: ``, | ||
imports: [ | ||
GameComponent | ||
] | ||
}) | ||
export default class HomeComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {Game} from "./core/Game.ts"; | ||
|
||
const game = new Game(); | ||
game.start(); | ||
// import {Game} from "./core/Game.ts"; | ||
// | ||
// const game = new Game(); | ||
// game.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'zone.js/node'; | ||
import '@angular/platform-server/init'; | ||
import { enableProdMode } from '@angular/core'; | ||
import { bootstrapApplication } from '@angular/platform-browser'; | ||
import { renderApplication } from '@angular/platform-server'; | ||
import { provideServerContext } from '@analogjs/router/server'; | ||
import { ServerContext } from '@analogjs/router/tokens'; | ||
|
||
import { AppComponent } from "./app/app.component.ts"; | ||
import { config } from "./app/app.config.server.ts"; | ||
|
||
if (Deno.env.has('PRODUCTION')) { | ||
enableProdMode(); | ||
} | ||
|
||
export function bootstrap() { | ||
return bootstrapApplication(AppComponent, config); | ||
} | ||
|
||
export default async function render( | ||
url: string, | ||
document: string, | ||
serverContext: ServerContext | ||
) { | ||
const html = await renderApplication(bootstrap, { | ||
document, | ||
url, | ||
platformProviders: [provideServerContext(serverContext)], | ||
}); | ||
|
||
return html; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters