Some progress on moving the cursor

This commit is contained in:
octospacc 2022-08-02 15:37:53 +02:00
parent 9590362bec
commit 73be9daa2e
3 changed files with 6 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -4,7 +4,7 @@ BloccSpacc is a portable isometric voxel sandbox game, mainly focused on buildin
### Development status / roadmap: ### Development status / roadmap:
- [ ] Breaking/placing blocks - [x] Breaking/placing blocks (broken because view is broken)
- [ ] View mode / Edit mode - [ ] View mode / Edit mode
- [ ] Moving cursor in all 3 axis - [ ] Moving cursor in all 3 axis
- [ ] Rotating view - [ ] Rotating view

View File

@ -155,7 +155,7 @@ void DrawMap( struct xyz ChunksNum ) {
struct xyz MapCoords = OrthoToIso ( x, y, z, BlockSize ); struct xyz MapCoords = OrthoToIso ( x, y, z, BlockSize );
DrawSurf( DrawSurf(
MapCoords.x - Camera.x - BlockSize/2, MapCoords.x - Camera.x - BlockSize/2,
MapCoords.z - Camera.z - y*BlockSize/2 - Camera.y, MapCoords.z - Camera.z - y*BlockSize/2, //- Camera.y,
Blockset, & Blocks[Map[ChunksNum.y-1-y][z][x]], Screen Blockset, & Blocks[Map[ChunksNum.y-1-y][z][x]], Screen
); );
} }
@ -169,7 +169,7 @@ void SetCamera() {
int z = ( CursorPos.z + BlockSize/2 ); int z = ( CursorPos.z + BlockSize/2 );
struct xyz xyz = OrthoToIso ( x, y, z, 1 ); struct xyz xyz = OrthoToIso ( x, y, z, 1 );
Camera.x = xyz.x - ScreenWidth/2; Camera.x = xyz.x - ScreenWidth/2;
Camera.y = y - ScreenHeight/2;//xyz.y - ScreenHeight/2; //Camera.y = y - ScreenHeight/2 + BlockSize;//xyz.y - ScreenHeight/2;
Camera.z = xyz.z - ScreenHeight/2; Camera.z = xyz.z - ScreenHeight/2;
} }
@ -177,7 +177,7 @@ void DrawCursor() {
struct xyz CursorCoords = OrthoToIso ( CursorPos.x, CursorPos.y, CursorPos.z, 1 ); struct xyz CursorCoords = OrthoToIso ( CursorPos.x, CursorPos.y, CursorPos.z, 1 );
DrawSurf( DrawSurf(
CursorCoords.x - Camera.x - BlockSize/2, CursorCoords.x - Camera.x - BlockSize/2,
CursorCoords.z - Camera.z - BlockSize/2, //- CursorCoords.y - Camera.y - BlockSize/2, CursorCoords.z - Camera.z - BlockSize/2 - CursorPos.y/2, //- CursorCoords.y - Camera.y - BlockSize/2,
Cursorset, & Cursors [1], Screen ); Cursorset, & Cursors [1], Screen );
} }
@ -252,6 +252,7 @@ int main( int argc, char* args[] ) {
ChunksNum.z = ChunkSize; ChunksNum.z = ChunkSize;
SetRandomNoiseMap(); SetRandomNoiseMap();
CursorPos.y = BlockSize * (ChunksNum.y - 1);
while ( !Quit ) { while ( !Quit ) {
while ( SDL_PollEvent( & Event ) ) { while ( SDL_PollEvent( & Event ) ) {
@ -319,3 +320,4 @@ int main( int argc, char* args[] ) {
SDL_Quit(); SDL_Quit();
return 0; return 0;
} }