ChrisOS Research ProjectOperating systems · language systems · graphics · machine emulation
DOCUMENTATION ARCHIVEMAIN BRANCH
ChrisOS/Referência de fonte: APPS/BALL/BALL.CC

Referência de fonte: APPS/BALL/BALL.CC

Registro determinístico da fonte. O conteúdo completo do arquivo é reproduzido abaixo; esta página não substitui a interpretação arquitetural dos capítulos autorais.

Identidade do arquivo

Campo Valor
Path APPS/BALL/BALL.CC
Lines 49
Bytes 748
SHA-256 924e3dc1566bc6b8809c54773e765b2b2cd7e3c72b5664656191b2d2eccfaa00
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Dependências sintáticas detectadas

Linha Include
— Nenhum include de preprocessor detectado.

Símbolos detectados

Linha Símbolo
7 main

Fonte completa

O bloco seguinte é o arquivo textual integral na revisão indicada. Não há elisão, abreviação ou paráfrase.

int g_x;
int g_y;
int g_vx;
int g_vy;
int g_ready;

void main() {
  int live;
  int bw;
  int bh;
  g_ready = 0;
  while (1) {
    live = win_begin(360, 280, "Ball");
    if (live == 0) {
      return;
    }
    bw = 360;
    bh = 280;
    if (g_ready == 0) {
      g_x = 40;
      g_y = 60;
      g_vx = 3;
      g_vy = 2;
      g_ready = 1;
    }
    g_x = g_x + g_vx;
    g_y = g_y + g_vy;
    if (g_x < 4) {
      g_x = 4;
      g_vx = 0 - g_vx;
    }
    if (g_x > bw - 24) {
      g_x = bw - 24;
      g_vx = 0 - g_vx;
    }
    if (g_y < 24) {
      g_y = 24;
      g_vy = 0 - g_vy;
    }
    if (g_y > bh - 24) {
      g_y = bh - 24;
      g_vy = 0 - g_vy;
    }
    fillrgb(g_x, g_y, 20, 20, 0x0000C060);
    win_end();
    wait(1);
  }
}

Papel deste registro

O atlas garante rastreabilidade arquivo-a-arquivo. Responsabilidade, invariantes, ownership, concorrência, segurança, desempenho e interação entre subsistemas pertencem aos capítulos autorais e devem citar este arquivo quando aplicável.

Registro do documento ID: source-924e3dc1566bc6b8 Reviewed source: da3df29cb397 Class: generated-source-reference