summary refs log tree commit diff stats
path: root/compiler/magicsys.nim
Commit message (Expand)AuthorAgeFilesLines
* cString => cSourceString; tyCString => tyCstring so that error msgs show cstr...Timothee Cour2021-04-171-1/+1
* `import foo {.all.}` reboot (#17706)Timothee Cour2021-04-161-0/+1
* IC: bugfixes (WIP) (#16836)Andreas Rumpf2021-02-021-0/+2
* remove conditionals on nimHasUserErrors, nimNoNilSeqs2, nimNoNilSeqs (#16861)Timothee Cour2021-01-291-2/+0
* IC: next steps (#16705)Andreas Rumpf2021-01-141-50/+0
* IC: next steps (#16550)Andreas Rumpf2021-01-071-5/+2
* big steps torwards an efficient, simple IC implementation (#16543)Andreas Rumpf2021-01-021-8/+8
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-15/+15
* Implements RFCs #209 (#13995)cooldome2020-04-161-0/+25
* miscellaneous bug fixes (part 3) (#13304)Timothee Cour2020-02-071-2/+4
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-2/+2
* [refactoring] remove unused imports in the compiler and in some stdlib modulesAraq2019-07-181-1/+1
* even more strict isNil handling for strings/seqs in order to detect bugsAraq2018-08-221-1/+2
* baby steps for incremental compilationAndreas Rumpf2018-05-301-10/+1
* refactoring: remove idents.legacy global variable and pass the IdentCache aro...Andreas Rumpf2018-05-271-15/+5
* remove more global variables in the Nim compilerAndreas Rumpf2018-05-271-1/+1
* make tests green againAndreas Rumpf2018-05-181-1/+1
* platform.nim doesn't use globals anymore; prepare msgs.nim for not using globalsAndreas Rumpf2018-05-181-2/+2
* options.nim: no global variables anymoreAndreas Rumpf2018-05-131-2/+2
* sem pass compiles againAndreas Rumpf2018-05-121-3/+6
* big refactoring: magicsys compiles againAndreas Rumpf2018-05-101-93/+86
* make tests green againAraq2016-11-011-1/+1
* refactoring complete: explicit ident cacheAraq2016-10-311-0/+4
* big refactoring: step 1Araq2016-10-311-0/+4
* fixes #4295Andreas Rumpf2016-06-071-5/+9
* added undocumented exportNims pragma for Nimscript supportAraq2015-10-031-16/+22
* compiler: Trim .nim files trailing whitespaceAdam Strzelecki2015-09-041-13/+13
* implemented 'guard' annotationAraq2014-09-211-1/+1
* the big renamefest: first stepsAraq2014-08-221-5/+7
* some progress for jester+asyncAraq2014-06-271-0/+2
* case consistency: cs:partial bootstraps on windowsAraq2013-12-291-1/+1
* case consistency: next stepsAraq2013-12-291-1/+1
* case consistency part 4Araq2013-12-271-7/+7
* case consistency part 1Araq2013-12-271-9/+8
* fixes #578Araq2013-08-301-1/+1
* float64 is now an alias to 'float'; fixes #545Araq2013-08-301-4/+9
* implemented large parts of the 'not nil' checkingAraq2013-06-091-1/+15
* get rid of ImportTablePos and ModuleTablePosZahary Karadjov2013-05-121-2/+0
* Removes executable bit for text files.Grzegorz Adam Hankiewicz2013-03-161-0/+0
* small improvementsAraq2013-02-271-1/+4
* temporary debugging code for the memory leak investigationZahary Karadjov2012-11-281-0/+9
* exception tracking barely works; but disabledAraq2012-10-311-1/+1
* 'addSon' for types deprecated for 'int literal type' analysisAraq2012-07-091-0/+10
* changed integer promotion rules; breaks bootstrapping and lots of codeAraq2012-07-081-14/+41
* changed integer promotion rules; added math.fmodAraq2012-06-281-2/+21
* better support for unsigned integers.Zahary Karadjov2012-06-111-0/+6
* year 2012 for most copyright headersAraq2012-01-021-1/+1
* got rid of nstrtabs and nhashes modulesAraq2011-06-101-3/+3
* big repo cleanupAraq2011-04-121-0/+87
pan> PlayerScore[50]; /* Used later to display score on screen. */ /* Init Camera */ Camera2D MainCamera; MainCamera.target = (Vector2){0, 0}; MainCamera.offset = (Vector2){0, 0}; MainCamera.rotation = 0; bool VersusGoing = true; Ball.NextTick = SDL_AtomicGet(&Ticks); Enemy.NextTick = SDL_AtomicGet(&Ticks); Vector2 MouseLastPosition = GetMousePosition(); Vector2 MouseCurrentPosition = GetMousePosition(); bool MouseMoved = false; while(VersusGoing == true && GameGoing == true) { if (WindowShouldClose()) { /* Quit Game if the window is closed. */ GameGoing = false; } MainCamera.zoom = GetScreenHeight()/720.0f; MainCamera.offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f}; MainCamera.target = (Vector2){1280/2.0f, 720/2.0f}; /* Who won? */ if (Enemy.Score >= 5) { Mix_HaltMusic(); Mix_FreeMusic(Background); play_audio(STOP_ALL_SOUNDS); play_audio(MUSIC_DEFEAT); while(!IsKeyDown(KEY_SPACE)) { BeginDrawing(); EnableCursor(); ClearBackground(BLACK); DrawText("You Lose.", 0, 0, 128, RED); DrawText("Press space to return to title screen.", 0, 128, 24, WHITE); EndDrawing(); } return; } else if (Player.Score >= 5) { Mix_HaltMusic(); Mix_FreeMusic(Background); play_audio(STOP_ALL_SOUNDS); play_audio(MUSIC_VICTORY); while(!IsKeyDown(KEY_SPACE)) { BeginDrawing(); EnableCursor(); ClearBackground(BLACK); DrawText("You Win!", 0, 0, 128, BLUE); DrawText("Press space to return to title screen.", 0, 128, 24, WHITE); EndDrawing(); } return; } /* Controls */ MouseMoved = false; MouseCurrentPosition = GetMousePosition(); if (MouseCurrentPosition.y != MouseLastPosition.y) { MouseMoved = true; } MouseLastPosition = MouseCurrentPosition; if( player_controls() == CONTROLLER_UP ){ Player.Y -= 20; } else if ( player_controls() == CONTROLLER_DOWN ){ Player.Y += 20; } else if ( player_controls() == CONTROLLER_PAUSE ){ Mix_PauseMusic(); BeginDrawing(); EndDrawing(); VersusGoing = pause_screen(&MainCamera); Mix_ResumeMusic(); Ball.NextTick = SDL_AtomicGet(&Ticks)+1; Enemy.NextTick = SDL_AtomicGet(&Ticks)+1; } else if (MouseMoved == true) { Player.Y = GetMouseY()-PaddleSprite.height/2.0f; DisableCursor(); } if(GetMouseY() < 0) { SetMousePosition(0, 0); } else if(GetMouseY() > 720) { SetMousePosition(0, 720); } /* Check if players are off-screen */ if (Player.Y < 0) { Player.Y = 0; } else if (Player.Y > 480) { Player.Y = 480; } enemy(&Enemy, Ball); /* Collision */ ball(&Player.HitBox, &Enemy.HitBox, &Ball, &Player.Score, &Enemy.Score); /* Updates hitbox with player's position. */ Player.HitBox.y = Player.Y; /* Turn Scores into strings. */ snprintf(PlayerScore, 50, "Player: %d", Player.Score); snprintf(EnemyScore, 50, "Enemy: %d", Enemy.Score); BeginDrawing(); ClearBackground(BLACK); BeginMode2D(MainCamera); DrawRectangle(0, 0, 1280, 720, (Color){20, 20, 20, 255}); DrawTexture(PaddleSprite, 0, Player.Y, WHITE); DrawTexture(PaddleSprite, 1200, Enemy.Y, WHITE); DrawTexture(BallSprite, Ball.X, Ball.Y, WHITE); DrawText(PlayerScore, 0, 0, 32, BLUE); DrawText(EnemyScore, 1130, 688, 32, RED); EndMode2D(); EndDrawing(); } Mix_HaltMusic(); Mix_FreeMusic(Background); play_audio(STOP_ALL_SOUNDS); return; }