Open clort81 opened 2 years ago
I ported it for fun tonight. There's now a CMakeLists.txt file and extra instructions for Linux.
Works for me on two different machines. Let me know if you have any questions.
Christian.
On Fri, Jan 21, 2022 at 8:43 AM clort81 @.***> wrote:
Title says you wrote it on linux. Can it build run on linux+sdl?
Cheers!
— Reply to this email directly, view it on GitHub https://github.com/cschladetsch/xiq/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7YZR5MOZJ57UN657X5GDUXB6ZNANCNFSM5MN4NYPQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
It would be great experience for you to fix the two issues: the screen is halved and the audio is double frequency. These are related of course.
In any case, I've ported to Linux as asked. See the Updated instructions in the top-level Readme.
Got a couple hours for it. Doing now. Thanks. Gets pretty far. gcc (12) complains about:
[ 73%] Building CXX object CMakeFiles/xiq.dir/Source/Playfield.cpp.o
/pr/TermFun/xiq/Source/Playfield.cpp: In member function ‘void Playfield::Clear()’:
/pr/TermFun/xiq/Source/Playfield.cpp:25:13: error: ‘x’ was not declared in this scope
25 | Set(x,0, Line);
| ^
/pr/TermFun/xiq/Source/Playfield.cpp: At global scope:
/pr/TermFun/xiq/Source/Playfield.cpp:28:5: error: expected unqualified-id before ‘for’
28 | for (int y = 0; y < height; ++y)
| ^~~
/pr/TermFun/xiq/Source/Playfield.cpp:28:21: error: ‘y’ does not name a type; did you mean ‘yn’?
28 | for (int y = 0; y < height; ++y)
| ^
| yn
/pr/TermFun/xiq/Source/Playfield.cpp:28:33: error: expected unqualified-id before ‘++’ token
28 | for (int y = 0; y < height; ++y)
| ^~
/pr/TermFun/xiq/Source/Playfield.cpp:33:1: error: expected declaration before ‘}’ token
33 | }
| ^
/pr/TermFun/xiq/Source/Playfield.cpp: In member function ‘int Playfield::CalcNewArea(Direction, Point2)’:
/pr/TermFun/xiq/Source/Playfield.cpp:44:5: error: expected ‘,’ or ‘;’ before ‘switch’
44 | switch (dir.value)
| ^~~~~~
make[2]: *** [CMakeFiles/xiq.dir/build.make:328: CMakeFiles/xiq.dir/Source/Playfield.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/xiq.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
I don't know C++ but if this were C, variables x and y would need to be declared global somewhere. Cheers!
There was some deleted code. Unsure why. I've pushed a fix.
Note that the outcome will be squashed by 50%x50%. Some pixel format change in SDL over the years.
Anyway, it should build now.
It's actually good code to learn C++ on, as it doesn't much other basic OOP from C++.
Sorry for delay! World has gone insane.
Builds now!
124616 Oct 28 02:08 xiq
I love the 8-bit sound!
Will look at rendering but no ideas yet. <3 don't take unhealthy things! :) [Edit] okay, the stride in void SetPixel() must be wrong. Trying to turn on brain... [Edit] yeah every new y-row, we are getting the correct pointer cause it's adjusted for stride, but then moving to the right times the x variable, we're not accounting for the size in bytes of a pixel! [Edit] so we could do:
Uint32 pixelSize = SDL_BYTESPERPIXEL(pixelFormat);
Uint8 *pixel = (Uint8 *)pixels + (y * surface->pitch) + (x * pixelSize);
For speed it'd be better to calc pixelSize once, somewhere outside of SetPixel [Edit] no this can't be right, the circles are being drawn at correct positions.. strange.
Title says you wrote it on linux. Can it build run on linux+sdl?
Cheers!