Browse Source

Bugfix SDL2 surface init + add some labels in UI

Yann Weber 5 years ago
parent
commit
027c9e4f40
2 changed files with 28 additions and 15 deletions
  1. 24
    1
      yaglitch.asm
  2. 4
    14
      yaglitch_ui.asm

+ 24
- 1
yaglitch.asm View File

422
 	jz sdl_error
422
 	jz sdl_error
423
 	pop rcx
423
 	pop rcx
424
 	pop rcx
424
 	pop rcx
425
+
426
+	%ifdef SDL2
427
+		; call memeset to alloc pixels
428
+		push rax
429
+		mov rdi, rax
430
+		call SDL_LockSurface
431
+
432
+		xor rdx, rdx
433
+		xor rcx, rcx
434
+		MOV_surf_w ecx, visu_surf
435
+		xor rax, rax
436
+		MOV_surf_pitch eax, visu_surf
437
+		mul ecx
438
+		MOV_surf_pixels rdi, visu_surf
439
+		xor rsi, rsi
440
+		;mov rsi, 0xFF ;white
441
+		mov rdx, rax
442
+		call SDL_memset ; seems to malloc the pixels
443
+
444
+		pop rdi ; surface addr
445
+		call SDL_UnlockSurface
446
+	%endif
447
+
425
 	; RAZ surface & blit
448
 	; RAZ surface & blit
426
-	call clear_screen
449
+	;call clear_screen ;useless
427
 
450
 
428
 	%ifdef MIX_AUDIO
451
 	%ifdef MIX_AUDIO
429
 		; init callback heap infos
452
 		; init callback heap infos

+ 4
- 14
yaglitch_ui.asm View File

3
 	push rdi
3
 	push rdi
4
 	call SDL_LockSurface
4
 	call SDL_LockSurface
5
 
5
 
6
-	%ifdef SDL2
7
-		xor rdx, rdx
8
-		xor rcx, rcx
9
-		MOV_surf_w ecx, visu_surf
10
-		xor rax, rax
11
-		MOV_surf_pitch eax, visu_surf
12
-		mul ecx
13
-		MOV_surf_pixels rdi, visu_surf
14
-		xor rsi, rsi
15
-		;mov rsi, 0xFF ;white
16
-		mov rdx, rax
17
-		call SDL_memset ; seems to malloc the pixels
18
-	%endif
19
-
20
 	%ifdef SDL1
6
 	%ifdef SDL1
21
 		xor rcx, rcx
7
 		xor rcx, rcx
22
 		MOV_surf_w ecx, visu_surf
8
 		MOV_surf_w ecx, visu_surf
41
 	pop rdi ; surface addr
27
 	pop rdi ; surface addr
42
 	call SDL_UnlockSurface
28
 	call SDL_UnlockSurface
43
 
29
 
30
+blitflip_visu:
31
+
44
 	mov rdi, [visu_surf]
32
 	mov rdi, [visu_surf]
45
 	xor rsi, rsi
33
 	xor rsi, rsi
46
 	mov rdx, [visu_scr]
34
 	mov rdx, [visu_scr]
49
 	test rax, rax
37
 	test rax, rax
50
 	jnz sdl_error
38
 	jnz sdl_error
51
 
39
 
40
+flip_visu:
41
+
52
 	%ifdef SDL2
42
 	%ifdef SDL2
53
 		mov rdi, [visu_win]
43
 		mov rdi, [visu_win]
54
 		call SDL_UpdateWindowSurface
44
 		call SDL_UpdateWindowSurface

Loading…
Cancel
Save