├── .gitattributes ├── .gitignore ├── Breakout ├── Makefile ├── Resources │ ├── Breakout.rsf │ ├── banner.bin │ ├── banner.png │ ├── hb_default.cwav │ ├── icon.bin │ └── icon.png ├── bounce_properties.png ├── include │ ├── Breakout.hpp │ ├── audio │ │ ├── filesystem.h │ │ └── sfx.h │ ├── draw.hpp │ ├── file │ │ └── file_access.hpp │ ├── gfx │ │ ├── lodepng.h │ │ └── pp2d.h │ ├── ishupe.hpp │ ├── objects.hpp │ └── tinyc2.h ├── readme.txt ├── romfs │ ├── bounce0.raw │ ├── bounce1.raw │ ├── bounce2.raw │ ├── bounce3.raw │ ├── bounce4.raw │ ├── bounce5.raw │ ├── bounce6.raw │ ├── bounce7.raw │ └── sprites │ │ ├── background │ │ ├── Title.png │ │ ├── press_select.png │ │ ├── thanksbeta.png │ │ └── waveform.png │ │ ├── ball00.png │ │ ├── brick │ │ ├── brick00.png │ │ ├── brick01.png │ │ ├── brick02.png │ │ ├── brick03.png │ │ ├── brick04.png │ │ ├── brick05.png │ │ ├── brick06.png │ │ ├── brick07.png │ │ ├── brick08.png │ │ ├── brick09.png │ │ ├── brick10.png │ │ ├── brick11.png │ │ ├── brick12.png │ │ ├── brick13.png │ │ ├── brick14.png │ │ └── brick15.png │ │ ├── misc │ │ ├── extra_ball │ │ │ ├── ball01.png │ │ │ ├── ball02.png │ │ │ ├── ball03.png │ │ │ ├── ball04.png │ │ │ ├── ball05.png │ │ │ ├── ball06.png │ │ │ └── ball07.png │ │ ├── laser_paddle.png │ │ └── laser_trail.png │ │ ├── paddle.png │ │ ├── paddle_big.png │ │ ├── paddle_small.png │ │ ├── powerup │ │ ├── laser00.png │ │ ├── laser01.png │ │ ├── laser02.png │ │ ├── laser03.png │ │ ├── laser04.png │ │ ├── laser05.png │ │ ├── life00.png │ │ ├── life01.png │ │ ├── life02.png │ │ ├── life03.png │ │ ├── life04.png │ │ ├── life05.png │ │ ├── multi_ball00.png │ │ ├── multi_ball01.png │ │ ├── multi_ball02.png │ │ ├── multi_ball03.png │ │ ├── multi_ball04.png │ │ ├── multi_ball05.png │ │ ├── paddle_big00.png │ │ ├── paddle_big01.png │ │ ├── paddle_big02.png │ │ ├── paddle_big03.png │ │ ├── paddle_big04.png │ │ ├── paddle_big05.png │ │ ├── paddle_small00.png │ │ ├── paddle_small01.png │ │ ├── paddle_small02.png │ │ ├── paddle_small03.png │ │ ├── paddle_small04.png │ │ └── paddle_small05.png │ │ └── test.png └── source │ ├── Breakout.cpp │ ├── audio │ ├── filesystem.cpp │ └── sfx.cpp │ ├── draw.cpp │ ├── file │ └── file_access.cpp │ ├── gfx │ ├── lodepng.c │ └── pp2d.c │ ├── ishupe.cpp │ ├── objects.cpp │ └── vshader.v.pica ├── BreakoutLeft.png ├── BreakoutRight.png ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md └── _config.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio 2 | .vs 3 | ARM 4 | Debug 5 | Breakout.sln 6 | Breakout/ARM 7 | Breakout/Breakout.vcxproj 8 | Breakout/Breakout.vcxproj.filters 9 | Breakout/Breakout.vcxproj.user 10 | 11 | # Build 12 | Breakout/build 13 | 14 | # Binaries 15 | *.3dsx 16 | *.cia 17 | *.elf 18 | *.smdh 19 | *.cxi 20 | /Breakout/Debug 21 | 22 | #Extra 23 | #Just the audio files before I've done any editing or conversion to them 24 | Breakout/OriginalSounds/ 25 | -------------------------------------------------------------------------------- /Breakout/Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | 5 | ifeq ($(strip $(DEVKITARM)),) 6 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 7 | endif 8 | 9 | TOPDIR ?= $(CURDIR) 10 | include $(DEVKITARM)/3ds_rules 11 | 12 | #--------------------------------------------------------------------------------- 13 | # TARGET is the name of the output 14 | # BUILD is the directory where object files & intermediate files will be placed 15 | # SOURCES is a list of directories containing source code 16 | # DATA is a list of directories containing data files 17 | # INCLUDES is a list of directories containing header files 18 | # 19 | # NO_SMDH: if set to anything, no SMDH file is generated. 20 | # ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional) 21 | # APP_TITLE is the name of the app stored in the SMDH file (Optional) 22 | # APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional) 23 | # APP_AUTHOR is the author of the app stored in the SMDH file (Optional) 24 | # ICON is the filename of the icon (.png), relative to the project folder. 25 | # If not set, it attempts to use one of the following (in this order): 26 | # - .png 27 | # - icon.png 28 | # - /default_icon.png 29 | #--------------------------------------------------------------------------------- 30 | TARGET := $(notdir $(CURDIR)) 31 | BUILD := build 32 | SOURCES := source source/gfx source/audio source/file 33 | DATA := data 34 | INCLUDES := include 35 | ROMFS := romfs 36 | APP_TITLE := "Breakout" 37 | APP_DESCRIPTION := "A 3ds Breakout Clone" 38 | APP_AUTHOR := "Matthew Rease" 39 | 40 | #--------------------------------------------------------------------------------- 41 | # options for code generation 42 | #--------------------------------------------------------------------------------- 43 | ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft 44 | 45 | CFLAGS := -g -Wall -O2 -mword-relocations \ 46 | -fomit-frame-pointer -ffunction-sections -ffast-math \ 47 | $(ARCH) 48 | 49 | CFLAGS += $(INCLUDE) -DARM11 -D_3DS 50 | 51 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17 -Wno-psabi 52 | 53 | ASFLAGS := -g $(ARCH) 54 | LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) 55 | 56 | LIBS := -lz -lcitro3d -lctru -lm 57 | 58 | #--------------------------------------------------------------------------------- 59 | # list of directories containing libraries, this must be the top level containing 60 | # include and lib 61 | #--------------------------------------------------------------------------------- 62 | LIBDIRS := $(CTRULIB) $(PORTLIBS) 63 | 64 | #--------------------------------------------------------------------------------- 65 | # no real need to edit anything past this point unless you need to add additional 66 | # rules for different file extensions 67 | #--------------------------------------------------------------------------------- 68 | ifneq ($(BUILD),$(notdir $(CURDIR))) 69 | #--------------------------------------------------------------------------------- 70 | 71 | export OUTPUT := $(CURDIR)/$(TARGET) 72 | export TOPDIR := $(CURDIR) 73 | 74 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 75 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 76 | 77 | export DEPSDIR := $(CURDIR)/$(BUILD) 78 | 79 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 80 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 81 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 82 | PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica))) 83 | SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist))) 84 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 85 | 86 | #--------------------------------------------------------------------------------- 87 | # use CXX for linking C++ projects, CC for standard C 88 | #--------------------------------------------------------------------------------- 89 | ifeq ($(strip $(CPPFILES)),) 90 | #--------------------------------------------------------------------------------- 91 | export LD := $(CC) 92 | #--------------------------------------------------------------------------------- 93 | else 94 | #--------------------------------------------------------------------------------- 95 | export LD := $(CXX) 96 | #--------------------------------------------------------------------------------- 97 | endif 98 | #--------------------------------------------------------------------------------- 99 | 100 | export OFILES := $(addsuffix .o,$(BINFILES)) \ 101 | $(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \ 102 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 103 | 104 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 105 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 106 | -I$(CURDIR)/$(BUILD) 107 | 108 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) 109 | 110 | ifeq ($(strip $(ICON)),) 111 | icons := $(wildcard *.png) 112 | ifneq (,$(findstring $(TARGET).png,$(icons))) 113 | export APP_ICON := $(TOPDIR)/$(TARGET).png 114 | else 115 | ifneq (,$(findstring icon.png,$(icons))) 116 | export APP_ICON := $(TOPDIR)/icon.png 117 | endif 118 | endif 119 | else 120 | export APP_ICON := $(TOPDIR)/$(ICON) 121 | endif 122 | 123 | ifeq ($(strip $(NO_SMDH)),) 124 | export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh 125 | endif 126 | 127 | ifneq ($(ROMFS),) 128 | export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) 129 | endif 130 | 131 | .PHONY: $(BUILD) clean all 132 | 133 | #--------------------------------------------------------------------------------- 134 | all: $(BUILD) 135 | 136 | $(BUILD): 137 | @[ -d $@ ] || mkdir -p $@ 138 | @bannertool makesmdh -s $(APP_TITLE) -l $(APP_DESCRIPTION) -p $(APP_AUTHOR) -i $(CURDIR)/Resources/icon.png -o $(CURDIR)/$(TARGET).smdh 139 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 140 | 141 | #--------------------------------------------------------------------------------- 142 | clean: 143 | @echo clean ... 144 | @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf $(TARGET)-strip.elf $(TARGET).cia $(TARGET).3ds 145 | 146 | #--------------------------------------------------------------------------------- 147 | $(TARGET)-strip.elf: $(BUILD) 148 | 149 | @$(STRIP) $(TARGET).elf -o $(TARGET)-strip.elf 150 | 151 | #--------------------------------------------------------------------------------- 152 | cia: $(TARGET)-strip.elf $(BUILD) 153 | @bannertool makebanner -i $(CURDIR)/Resources/banner.png -ca $(CURDIR)/Resources/hb_default.cwav -o $(CURDIR)/Resources/banner.bin 154 | @bannertool makesmdh -s $(APP_TITLE) -l $(APP_DESCRIPTION) -p $(APP_AUTHOR) -i $(CURDIR)/Resources/icon.png -o $(CURDIR)/$(TARGET).smdh 155 | @makerom -f cia -o $(CURDIR)/$(TARGET).cia -elf $(CURDIR)/$(TARGET)-strip.elf -rsf $(CURDIR)/Resources/$(TARGET).rsf -exefslogo -target t -icon $(CURDIR)/$(TARGET).smdh -banner $(CURDIR)/Resources/banner.bin 156 | @echo "built ... $(TARGET).cia" 157 | 158 | #--------------------------------------------------------------------------------- 159 | send: $(BUILD) 160 | 161 | @3dslink -a 10.0.0.115 $(TARGET).3dsx 162 | 163 | #--------------------------------------------------------------------------------- 164 | else 165 | 166 | DEPENDS := $(OFILES:.o=.d) 167 | 168 | #--------------------------------------------------------------------------------- 169 | # main targets 170 | #--------------------------------------------------------------------------------- 171 | ifeq ($(strip $(NO_SMDH)),) 172 | $(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh 173 | else 174 | $(OUTPUT).3dsx : $(OUTPUT).elf 175 | endif 176 | 177 | $(OUTPUT).elf : $(OFILES) 178 | 179 | #--------------------------------------------------------------------------------- 180 | # you need a rule like this for each extension you use as binary data 181 | #--------------------------------------------------------------------------------- 182 | %.bin.o : %.bin 183 | #--------------------------------------------------------------------------------- 184 | @echo $(notdir $<) 185 | @$(bin2o) 186 | 187 | #--------------------------------------------------------------------------------- 188 | %.jpeg.o: %.jpeg 189 | #--------------------------------------------------------------------------------- 190 | @echo $(notdir $<) 191 | @$(bin2o) 192 | 193 | #--------------------------------------------------------------------------------- 194 | %.ttf.o : %.ttf 195 | #--------------------------------------------------------------------------------- 196 | @echo $(notdir $<) 197 | @$(bin2o) 198 | 199 | #--------------------------------------------------------------------------------- 200 | %.png.o : %.png 201 | #--------------------------------------------------------------------------------- 202 | @echo $(notdir $<) 203 | @$(bin2o) 204 | 205 | #--------------------------------------------------------------------------------- 206 | # rules for assembling GPU shaders 207 | #--------------------------------------------------------------------------------- 208 | define shader-as 209 | $(eval CURBIN := $*.shbin) 210 | $(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d) 211 | echo "$(CURBIN).o: $< $1" > $(DEPSFILE) 212 | echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h 213 | echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h 214 | echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h 215 | picasso -o $(CURBIN) $1 216 | bin2s $(CURBIN) | $(AS) -o $*.shbin.o 217 | endef 218 | 219 | %.shbin.o %_shbin.h : %.v.pica %.g.pica 220 | @echo $(notdir $^) 221 | @$(call shader-as,$^) 222 | 223 | %.shbin.o %_shbin.h : %.v.pica 224 | @echo $(notdir $<) 225 | @$(call shader-as,$<) 226 | 227 | %.shbin.o %_shbin.h : %.shlist 228 | @echo $(notdir $<) 229 | @$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file))) 230 | @$(call shader-as,$<) 231 | 232 | -include $(DEPENDS) 233 | 234 | #--------------------------------------------------------------------------------------- 235 | endif 236 | #--------------------------------------------------------------------------------------- 237 | -------------------------------------------------------------------------------- /Breakout/Resources/Breakout.rsf: -------------------------------------------------------------------------------- 1 | BasicInfo: 2 | Title : Breakout 3 | ProductCode : CTR-B-BOUT 4 | Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem 5 | 6 | RomFs: 7 | # Specifies the root path of the read only file system to include in the ROM. 8 | RootPath : romfs 9 | 10 | TitleInfo: 11 | Category : Application 12 | UniqueId : 0x71612 13 | 14 | Option: 15 | UseOnSD : true # true if App is to be installed to SD 16 | FreeProductCode : true # Removes limitations on ProductCode 17 | MediaFootPadding : false # If true CCI files are created with padding 18 | EnableCrypt : false # Enables encryption for NCCH and CIA 19 | EnableCompress : true # Compresses where applicable (currently only exefs:/.code) 20 | 21 | AccessControlInfo: 22 | CoreVersion : 2 23 | 24 | # Exheader Format Version 25 | DescVersion : 2 26 | 27 | # Minimum Required Kernel Version (below is for 4.5.0) 28 | ReleaseKernelMajor : "02" 29 | ReleaseKernelMinor : "33" 30 | 31 | # ExtData 32 | UseExtSaveData : false # enables ExtData 33 | #ExtSaveDataId : 0x300 # only set this when the ID is different to the UniqueId 34 | 35 | # FS:USER Archive Access Permissions 36 | # Uncomment as required 37 | FileSystemAccess: 38 | #- CategorySystemApplication 39 | #- CategoryHardwareCheck 40 | #- CategoryFileSystemTool 41 | #- Debug 42 | #- TwlCardBackup 43 | #- TwlNandData 44 | #- Boss 45 | - DirectSdmc 46 | #- Core 47 | #- CtrNandRo 48 | #- CtrNandRw 49 | #- CtrNandRoWrite 50 | #- CategorySystemSettings 51 | #- CardBoard 52 | #- ExportImportIvs 53 | #- DirectSdmcWrite 54 | #- SwitchCleanup 55 | #- SaveDataMove 56 | #- Shop 57 | #- Shell 58 | #- CategoryHomeMenu 59 | 60 | # Process Settings 61 | MemoryType : Application # Application/System/Base 62 | SystemMode : 64MB # 64MB(Default)/96MB/80MB/72MB/32MB 63 | IdealProcessor : 0 64 | AffinityMask : 1 65 | Priority : 16 66 | MaxCpu : 0 # Let system decide 67 | HandleTableSize : 0x200 68 | DisableDebug : false 69 | EnableForceDebug : false 70 | CanWriteSharedPage : true 71 | CanUsePrivilegedPriority : false 72 | CanUseNonAlphabetAndNumber : true 73 | PermitMainFunctionArgument : true 74 | CanShareDeviceMemory : true 75 | RunnableOnSleep : false 76 | SpecialMemoryArrange : true 77 | 78 | # New3DS Exclusive Process Settings 79 | SystemModeExt : 124MB # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode 80 | CpuSpeed : 804MHz # 268MHz(Default)/804MHz 81 | EnableL2Cache : true # false(default)/true 82 | CanAccessCore2 : true 83 | 84 | # Virtual Address Mappings 85 | IORegisterMapping: 86 | - 1ff00000-1ff7ffff # DSP memory 87 | MemoryMapping: 88 | - 1f000000-1f5fffff:r # VRAM 89 | 90 | # Accessible SVCs, : 91 | SystemCallAccess: 92 | ArbitrateAddress: 34 93 | Break: 60 94 | CancelTimer: 28 95 | ClearEvent: 25 96 | ClearTimer: 29 97 | CloseHandle: 35 98 | ConnectToPort: 45 99 | ControlMemory: 1 100 | CreateAddressArbiter: 33 101 | CreateEvent: 23 102 | CreateMemoryBlock: 30 103 | CreateMutex: 19 104 | CreateSemaphore: 21 105 | CreateThread: 8 106 | CreateTimer: 26 107 | DuplicateHandle: 39 108 | ExitProcess: 3 109 | ExitThread: 9 110 | GetCurrentProcessorNumber: 17 111 | GetHandleInfo: 41 112 | GetProcessId: 53 113 | GetProcessIdOfThread: 54 114 | GetProcessIdealProcessor: 6 115 | GetProcessInfo: 43 116 | GetResourceLimit: 56 117 | GetResourceLimitCurrentValues: 58 118 | GetResourceLimitLimitValues: 57 119 | GetSystemInfo: 42 120 | GetSystemTick: 40 121 | GetThreadContext: 59 122 | GetThreadId: 55 123 | GetThreadIdealProcessor: 15 124 | GetThreadInfo: 44 125 | GetThreadPriority: 11 126 | MapMemoryBlock: 31 127 | OutputDebugString: 61 128 | QueryMemory: 2 129 | ReleaseMutex: 20 130 | ReleaseSemaphore: 22 131 | SendSyncRequest1: 46 132 | SendSyncRequest2: 47 133 | SendSyncRequest3: 48 134 | SendSyncRequest4: 49 135 | SendSyncRequest: 50 136 | SetThreadPriority: 12 137 | SetTimer: 27 138 | SignalEvent: 24 139 | SleepThread: 10 140 | UnmapMemoryBlock: 32 141 | WaitSynchronization1: 36 142 | WaitSynchronizationN: 37 143 | Backdoor: 123 144 | 145 | # Service List 146 | # Maximum 34 services (32 if firmware is prior to 9.3.0) 147 | ServiceAccessControl: 148 | - cfg:u 149 | - fs:USER 150 | - gsp::Gpu 151 | - hid:USER 152 | - ndm:u 153 | - pxi:dev 154 | - APT:U 155 | - ac:u 156 | - act:u 157 | - am:net 158 | - boss:U 159 | - cam:u 160 | - cecd:u 161 | - csnd:SND 162 | - frd:u 163 | - http:C 164 | - ir:USER 165 | - ir:u 166 | - ir:rst 167 | - ldr:ro 168 | - mic:u 169 | - news:u 170 | - nfc:u 171 | - nim:aoc 172 | - nwm::UDS 173 | - ptm:u 174 | - qtm:u 175 | - soc:U 176 | - ssl:C 177 | - y2r:u 178 | 179 | 180 | SystemControlInfo: 181 | SaveDataSize: 0K 182 | RemasterVersion: B1.03.0 183 | StackSize: 0x40000 184 | 185 | # Modules that run services listed above should be included below 186 | # Maximum 48 dependencies 187 | # If a module is listed that isn't present on the 3DS, the title will get stuck at the logo (3ds waves) 188 | # So act, nfc and qtm are commented for 4.x support. Uncomment if you need these. 189 | # : 190 | Dependency: 191 | ac: 0x0004013000002402 192 | #act: 0x0004013000003802 193 | am: 0x0004013000001502 194 | boss: 0x0004013000003402 195 | camera: 0x0004013000001602 196 | cecd: 0x0004013000002602 197 | cfg: 0x0004013000001702 198 | codec: 0x0004013000001802 199 | csnd: 0x0004013000002702 200 | dlp: 0x0004013000002802 201 | dsp: 0x0004013000001a02 202 | friends: 0x0004013000003202 203 | gpio: 0x0004013000001b02 204 | gsp: 0x0004013000001c02 205 | hid: 0x0004013000001d02 206 | http: 0x0004013000002902 207 | i2c: 0x0004013000001e02 208 | ir: 0x0004013000003302 209 | mcu: 0x0004013000001f02 210 | mic: 0x0004013000002002 211 | ndm: 0x0004013000002b02 212 | news: 0x0004013000003502 213 | #nfc: 0x0004013000004002 214 | nim: 0x0004013000002c02 215 | nwm: 0x0004013000002d02 216 | pdn: 0x0004013000002102 217 | ps: 0x0004013000003102 218 | ptm: 0x0004013000002202 219 | #qtm: 0x0004013020004202 220 | ro: 0x0004013000003702 221 | socket: 0x0004013000002e02 222 | spi: 0x0004013000002302 223 | ssl: 0x0004013000002f02 224 | -------------------------------------------------------------------------------- /Breakout/Resources/banner.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/Resources/banner.bin -------------------------------------------------------------------------------- /Breakout/Resources/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/Resources/banner.png -------------------------------------------------------------------------------- /Breakout/Resources/hb_default.cwav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/Resources/hb_default.cwav -------------------------------------------------------------------------------- /Breakout/Resources/icon.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/Resources/icon.bin -------------------------------------------------------------------------------- /Breakout/Resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/Resources/icon.png -------------------------------------------------------------------------------- /Breakout/bounce_properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/bounce_properties.png -------------------------------------------------------------------------------- /Breakout/include/Breakout.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | //using std::string; 7 | #include 8 | #include 9 | #include 10 | #include 11 | #define _USE_MATH_DEFINES 12 | #include 13 | #include <3ds.h> 14 | #include 15 | #include "gfx/pp2d.h" 16 | #include 17 | #include 18 | 19 | extern PrintConsole bottomScreen, versionWin, killBox, debugBox; 20 | 21 | #define texture_count 62 22 | #define brick_types 12 23 | #define powerup_types 4 24 | #define ball_sprites 7 25 | #define def_level_count 6 26 | #define SAVE_FILES 3 27 | #define AMOUNT_OF_POWERUPS 5 28 | 29 | #define O3DS_CHECKS 250 30 | #define N3DS_CHECKS 300 31 | #define BRICK_FILES 16 32 | 33 | extern std::string versiontxtt, versiontxtn; 34 | extern std::string buildnumber, ishupeversion; 35 | extern std::vector saved_level; 36 | extern int designed_level[SAVE_FILES][50]; 37 | extern std::string saved_level_filename[SAVE_FILES]; 38 | extern int vernumqik; 39 | extern size_t ball00ID, paddleBigID, paddleSmallID; 40 | extern std::vector pLaserID, pLifeID, pMultiBallID, pPaddleBigID, pPaddleSmallID; 41 | 42 | #define ANSI "\x1b[" 43 | #define RED "31" 44 | #define B_RED "41" 45 | #define GREEN "32" 46 | #define B_GREEN "42" 47 | #define YELLOW "33" 48 | #define B_YELLOW "43" 49 | #define BLUE "34" 50 | #define B_BLUE "44" 51 | #define MAGENTA "35" 52 | #define B_MAGENTA "45" 53 | #define CYAN "36" 54 | #define B_CYAN "46" 55 | #define WHITE "37" 56 | #define B_WHITE "47" 57 | #define BRIGHT "2" 58 | #define CRESET "\x1b[0m" 59 | #define PRESET "\x1b[0;0H" 60 | #define ASEP ";" 61 | #define CEND "m" 62 | #define PEND "H" 63 | 64 | // For level creation 65 | 66 | #define lvlFullLine(a) a, a, a, a, a, a, a, a, a, a 67 | -------------------------------------------------------------------------------- /Breakout/include/audio/filesystem.h: -------------------------------------------------------------------------------- 1 | //shamelessly grabbed from Smealum's portal3DS 2 | //https://github.com/smealum/portal3DS 3 | 4 | #ifndef FILESYSTEM_H 5 | #define FILESYSTEM_H 6 | 7 | #include <3ds.h> 8 | 9 | //void filesystemInit(int argc, char** argv); 10 | //void filesystemExit(); 11 | 12 | FILE* openFile(const char* fn, const char* mode); 13 | void* bufferizeFile(const char* filename, u32* size, bool binary, bool linear); 14 | 15 | #endif -------------------------------------------------------------------------------- /Breakout/include/audio/sfx.h: -------------------------------------------------------------------------------- 1 | //shamelessly grabbed from Smealum's portal3DS 2 | //https://github.com/smealum/portal3DS 3 | 4 | #ifndef SFX_H 5 | #define SFX_H 6 | 7 | #define NUMSFX (32) 8 | 9 | typedef struct 10 | { 11 | u8* data; 12 | u32 size; 13 | u32 format; 14 | bool used; 15 | }SFX_s; 16 | 17 | void initSound(void); 18 | void exitSound(void); 19 | void initSFX(SFX_s* s); 20 | void loadSFX(SFX_s* s, const char* filename, u32 format); 21 | SFX_s* createSFX(const char* filename, u32 format); 22 | void playSFX(SFX_s* s); 23 | void playMSC(SFX_s* s); 24 | void stopSFX(void); 25 | void stopMSC(void); 26 | 27 | #endif -------------------------------------------------------------------------------- /Breakout/include/draw.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | Draws an object 5 | 6 | Must have member function getCoords(bool X), and member texture_id 7 | */ 8 | template 9 | void draw_object(obj &object) { 10 | pp2d_draw_texture(object.texture_id, object.x, object.y); 11 | } 12 | /* 13 | Draws a ball 14 | */ 15 | extern void draw_object(ball &ball_to_draw); 16 | -------------------------------------------------------------------------------- /Breakout/include/file/file_access.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Breakout.hpp" 3 | 4 | /* 5 | Creates Save Files 6 | [Dynamic, based upon header definition SAVE_FILES] 7 | int setup_type: 8 | 0 if old save level file (breakout_level.bsl) 9 | 1 if no save files ever (0 renames breakout_level to breakout_level_0) 10 | */ 11 | void create_save_files(int setup_type); 12 | 13 | /* 14 | Loads save files into memory 15 | [save level array/vector] 16 | */ 17 | void load_save_files(); 18 | -------------------------------------------------------------------------------- /Breakout/include/gfx/pp2d.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file pp2d.h 3 | * @author Bernardo Giordano 4 | * @date 12 September 2017 5 | * @brief pp2d header 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "lodepng.h" 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include <3ds.h> 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "vshader_shbin.h" 23 | 24 | #define TOP_WIDTH 400 25 | #define BOTTOM_WIDTH 320 26 | #define SCREEN_HEIGHT 240 27 | 28 | /** 29 | * @brief Used to transfer the final rendered display to the framebuffer 30 | */ 31 | #define DISPLAY_TRANSFER_FLAGS \ 32 | (GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \ 33 | GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \ 34 | GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO)) 35 | 36 | /** 37 | * @brief Creates a 8 byte RGBA color 38 | * @param r red component of the color 39 | * @param g green component of the color 40 | * @param b blue component of the color 41 | * @param a alpha component of the color 42 | */ 43 | #define RGBA8(r, g, b, a) ((((r)&0xFF)<<0) | (((g)&0xFF)<<8) | (((b)&0xFF)<<16) | (((a)&0xFF)<<24)) 44 | 45 | /** 46 | * @brief Creates a 8 byte ABGR color 47 | * @param a alpha component of the color 48 | * @param b blue component of the color 49 | * @param g green component of the color 50 | * @param r red component of the color 51 | */ 52 | #define ABGR8(a, b, g, r) ((((a)&0xFF)<<0) | (((b)&0xFF)<<8) | (((g)&0xFF)<<16) | (((r)&0xFF)<<24)) 53 | 54 | /** 55 | * @brief Converts a RGB565 color to RGBA8 color (adds maximum alpha) 56 | * @param rgb 565 to be converted 57 | */ 58 | #define RGB565_TO_RGBA8(rgb) \ 59 | (RGBA8(((rgb>>11)&0x1F)*0xFF/0x1F, ((rgb>>5)&0x3F)*0xFF/0x3F, (rgb&0x1F)*0xFF/0x1F, 255)) 60 | 61 | /** 62 | * @brief Converts a RGB565 color to ABGR8 color (adds maximum alpha) 63 | * @param rgb 565 to be converted 64 | */ 65 | #define RGB565_TO_ABGR8(rgb) \ 66 | (RGBA8(255, (rgb&0x1F)*0xFF/0x1F, ((rgb>>5)&0x3F)*0xFF/0x3F, ((rgb>>11)&0x1F)*0xFF/0x1F)) 67 | 68 | #define BACKGROUND_COLOR ABGR8(255, 0, 0, 0) 69 | #define PP2D_NEUTRAL RGBA8(255, 255, 255, 255) 70 | 71 | #define DEFAULT_DEPTH 0.5f 72 | 73 | #define MAX_TEXTURES 1024 74 | #define MAX_SPRITES 1600 75 | 76 | #define TEXT_VTX_ARRAY_COUNT (4*1024) 77 | 78 | typedef enum { 79 | NONE, 80 | HORIZONTAL, 81 | VERTICAL, 82 | BOTH 83 | } flipType; 84 | 85 | typedef struct { 86 | float position[3]; 87 | float texcoord[2]; 88 | } textVertex_s; 89 | 90 | /** 91 | * @brief Starts a new frame on the specified screen 92 | * @param target GFX_TOP or GFX_BOTTOM 93 | */ 94 | void pp2d_begin_draw(gfxScreen_t target, gfx3dSide_t side); 95 | 96 | /** 97 | * @brief Changes target screen to the specified target 98 | * @param target GFX_TOP or GFX_BOTTOM 99 | */ 100 | void pp2d_draw_on(gfxScreen_t target, gfx3dSide_t side); 101 | 102 | /** 103 | * @brief Draw a rectangle 104 | * @param x of the top left corner 105 | * @param y of the top left corner 106 | * @param width on the rectangle 107 | * @param height of the rectangle 108 | * @param color RGBA8 to fill the rectangle 109 | */ 110 | void pp2d_draw_rectangle(int x, int y, int width, int height, u32 color); 111 | 112 | /** 113 | * @brief Prints a char pointer 114 | * @param x position to start drawing 115 | * @param y position to start drawing 116 | * @param scaleX multiplier for the text width 117 | * @param scaleY multiplier for the text height 118 | * @param color RGBA8 the text will be drawn 119 | * @param text to be printed on the screen 120 | */ 121 | void pp2d_draw_text(float x, float y, float scaleX, float scaleY, u32 color, const char* text); 122 | 123 | /** 124 | * @brief Prints a char pointer in the middle of the target screen 125 | * @param target screen to draw the text to 126 | * @param y position to start drawing 127 | * @param scaleX multiplier for the text width 128 | * @param scaleY multiplier for the text height 129 | * @param color RGBA8 the text will be drawn 130 | * @param text to be printed on the screen 131 | */ 132 | void pp2d_draw_text_center(gfxScreen_t target, float y, float scaleX, float scaleY, u32 color, const char* text); 133 | 134 | /** 135 | * @brief Prints a char pointer in the middle of the target screen 136 | * @param x position to start drawing 137 | * @param y position to start drawing 138 | * @param scaleX multiplier for the text width 139 | * @param scaleY multiplier for the text height 140 | * @param color RGBA8 the text will be drawn 141 | * @param wrapX wrap width 142 | * @param text to be printed on the screen 143 | */ 144 | void pp2d_draw_text_wrap(float x, float y, float scaleX, float scaleY, u32 color, float wrapX, const char* text); 145 | 146 | /** 147 | * @brief Prints a char pointer with arguments 148 | * @param x position to start drawing 149 | * @param y position to start drawing 150 | * @param scaleX multiplier for the text width 151 | * @param scaleY multiplier for the text height 152 | * @param color RGBA8 the text will be drawn 153 | * @param text to be printed on the screen 154 | * @param ... arguments 155 | */ 156 | void pp2d_draw_textf(float x, float y, float scaleX, float scaleY, u32 color, const char* text, ...); 157 | 158 | /** 159 | * @brief Prints a texture 160 | * @param id of the texture 161 | * @param x position on the screen to draw the texture 162 | * @param y position on the screen to draw the texture 163 | */ 164 | void pp2d_draw_texture(size_t id, int x, int y); 165 | 166 | /** 167 | * @brief Prints a texture with color modulation 168 | * @param id of the texture 169 | * @param x position on the screen to draw the texture 170 | * @param y position on the screen to draw the texture 171 | * @param color RGBA8 to modulate the texture with 172 | */ 173 | void pp2d_draw_texture_blend(size_t id, int x, int y, u32 color); 174 | 175 | /** 176 | * @brief Prints a flipped texture 177 | * @param id of the texture 178 | * @param x position on the screen to draw the texture 179 | * @param y position on the screen to draw the texture 180 | * @param fliptype HORIZONTAL, VERTICAL or BOTH 181 | */ 182 | 183 | void pp2d_draw_texture_flip(size_t id, int x, int y, flipType fliptype); 184 | 185 | /** 186 | * @brief Prints a rotated texture 187 | * @param id of the texture 188 | * @param x position on the screen to draw the texture 189 | * @param y position on the screen to draw the texture 190 | * @param angle in degrees to rotate the texture 191 | */ 192 | void pp2d_draw_texture_rotate(size_t id, int x, int y, float angle); 193 | 194 | /** 195 | * @brief Prints a texture with a scale factor 196 | * @param id of the texture 197 | * @param x position on the screen to draw the texture 198 | * @param y position on the screen to draw the texture 199 | * @param scaleX width scale factor 200 | * @param scaleY height scale factor 201 | */ 202 | void pp2d_draw_texture_scale(size_t id, int x, int y, float scaleX, float scaleY); 203 | 204 | /** 205 | * @brief Prints a portion of a texture 206 | * @param id of the texture 207 | * @param x position on the screen to draw the texture 208 | * @param y position on the screen to draw the texture 209 | * @param xbegin position to start drawing 210 | * @param ybegin position to start drawing 211 | * @param width to draw from the xbegin position 212 | * @param height to draw from the ybegin position 213 | */ 214 | void pp2d_draw_texture_part(size_t id, int x, int y, int xbegin, int ybegin, int width, int height); 215 | 216 | /** 217 | * @brief Prints a wchar_t pointer 218 | * @param x position to start drawing 219 | * @param y position to start drawing 220 | * @param scaleX multiplier for the text width 221 | * @param scaleY multiplier for the text height 222 | * @param color RGBA8 the text will be drawn 223 | * @param text to be printed on the screen 224 | */ 225 | void pp2d_draw_wtext(float x, float y, float scaleX, float scaleY, u32 color, const wchar_t* text); 226 | 227 | /** 228 | * @brief Prints a wchar_t pointer in the middle of the target screen 229 | * @param target screen to draw the text to 230 | * @param y position to start drawing 231 | * @param scaleX multiplier for the text width 232 | * @param scaleY multiplier for the text height 233 | * @param color RGBA8 the text will be drawn 234 | * @param text to be printed on the screen 235 | */ 236 | void pp2d_draw_wtext_center(gfxScreen_t target, float y, float scaleX, float scaleY, u32 color, const wchar_t* text); 237 | 238 | /** 239 | * @brief Prints a wchar_t pointer 240 | * @param x position to start drawing 241 | * @param y position to start drawing 242 | * @param scaleX multiplier for the text width 243 | * @param scaleY multiplier for the text height 244 | * @param color RGBA8 the text will be drawn 245 | * @param wrapX wrap width 246 | * @param text to be printed on the screen 247 | */ 248 | void pp2d_draw_wtext_wrap(float x, float y, float scaleX, float scaleY, u32 color, float wrapX, const wchar_t* text); 249 | 250 | /** 251 | * @brief Prints a wchar_t pointer with arguments 252 | * @param x position to start drawing 253 | * @param y position to start drawing 254 | * @param scaleX multiplier for the text width 255 | * @param scaleY multiplier for the text height 256 | * @param color RGBA8 the text will be drawn 257 | * @param text to be printed on the screen 258 | * @param ... arguments 259 | */ 260 | void pp2d_draw_wtextf(float x, float y, float scaleX, float scaleY, u32 color, const wchar_t* text, ...); 261 | 262 | /** 263 | * @brief Ends a frame 264 | */ 265 | void pp2d_end_draw(void); 266 | 267 | /** 268 | * @brief Frees the pp2d environment 269 | */ 270 | void pp2d_exit(void); 271 | 272 | /** 273 | * @brief Initializes the fast draw buffer 274 | * @param id of the texture to bind 275 | */ 276 | void pp2d_fast_draw_init(size_t id); 277 | 278 | /** 279 | * @brief Bufferizes a texture for fast drawing 280 | * @param x to draw the texture to 281 | * @param y to draw the texture to 282 | */ 283 | void pp2d_fast_draw_texture(int x, int y); 284 | 285 | /** 286 | * @brief Bufferizes a portion of a texture for fast drawing 287 | * @param x position on the screen to draw the texture 288 | * @param y position on the screen to draw the texture 289 | * @param xbegin position to start drawing 290 | * @param ybegin position to start drawing 291 | * @param width to draw from the xbegin position 292 | * @param height to draw from the ybegin position 293 | */ 294 | void pp2d_fast_draw_texture_part(int x, int y, int xbegin, int ybegin, int width, int height); 295 | 296 | /** 297 | * @brief Renders the bufferized textures for fast drawing 298 | */ 299 | void pp2d_fast_render(void); 300 | 301 | /** 302 | * @brief Inits the pp2d environment 303 | * @return 0 if everything went correctly, otherwise returns Result code 304 | * @note This will trigger gfxInitDefault by default 305 | */ 306 | Result pp2d_init(void); 307 | 308 | /** 309 | * @brief Calculates a char pointer height 310 | * @param text char pointer to calculate the height of 311 | * @param scaleX multiplier for the text width 312 | * @param scaleY multiplier for the text height 313 | * @return height the text will have if rendered in the supplied conditions 314 | */ 315 | float pp2d_get_text_height(const char* text, float scaleX, float scaleY); 316 | 317 | /** 318 | * @brief Calculates a char pointer height 319 | * @param text char pointer to calculate the height of 320 | * @param scaleX multiplier for the text width 321 | * @param scaleY multiplier for the text height 322 | * @param wrapX wrap width 323 | * @return height the text will have if rendered in the supplied conditions 324 | */ 325 | float pp2d_get_text_height_wrap(const char* text, float scaleX, float scaleY, int wrapX); 326 | 327 | /** 328 | * @brief Calculates width and height for a char pointer 329 | * @param width pointer to the width to return 330 | * @param height pointer to the height to return 331 | * @param scaleX multiplier for the text width 332 | * @param scaleY multiplier for the text height 333 | * @param text to calculate dimensions of 334 | */ 335 | void pp2d_get_text_size(float* width, float* height, float scaleX, float scaleY, const char* text); 336 | 337 | /** 338 | * @brief Calculates a char pointer width 339 | * @param text char pointer to calculate the width of 340 | * @param scaleX multiplier for the text width 341 | * @param scaleY multiplier for the text height 342 | * @return width the text will have if rendered in the supplied conditions 343 | */ 344 | float pp2d_get_text_width(const char* text, float scaleX, float scaleY); 345 | 346 | /** 347 | * @brief Calculates a wchar_t pointer height 348 | * @param text wchar_t pointer to calculate the height of 349 | * @param scaleX multiplier for the text width 350 | * @param scaleY multiplier for the text height 351 | * @return height the text will have if rendered in the supplied conditions 352 | */ 353 | float pp2d_get_wtext_height(const wchar_t* text, float scaleX, float scaleY); 354 | 355 | /** 356 | * @brief Calculates a wchar_t pointer width 357 | * @param text wchar_t pointer to calculate the width of 358 | * @param scaleX multiplier for the text width 359 | * @param scaleY multiplier for the text height 360 | * @return width the text will have if rendered in the supplied conditions 361 | */ 362 | float pp2d_get_wtext_width(const wchar_t* text, float scaleX, float scaleY); 363 | 364 | /** 365 | * @brief Frees a texture 366 | * @param id of the texture to free 367 | */ 368 | void pp2d_free_texture(size_t id); 369 | 370 | /** 371 | * @brief Loads a texture from a a buffer in memory 372 | * @param id of the texture 373 | * @param buf buffer where the texture is stored 374 | * @param width of the texture 375 | * @param height of the texture 376 | */ 377 | void pp2d_load_texture_memory(size_t id, void* buf, u32 width, u32 height); 378 | 379 | /** 380 | * @brief Loads a texture from a png file 381 | * @param id of the texture 382 | * @param path where the png file is located 383 | */ 384 | void pp2d_load_texture_png(size_t id, const char* path); 385 | 386 | /** 387 | * @brief Loads a texture from a buffer in memory 388 | * @param id of the texture 389 | * @param buf buffer where the png is stored 390 | * @param buf_size size of buffer 391 | */ 392 | void pp2d_load_texture_png_memory(size_t id, void* buf, size_t buf_size); 393 | 394 | /** 395 | * @brief Enables 3D service 396 | * @param enable integer 397 | */ 398 | void pp2d_set_3D(int enable); 399 | 400 | /** 401 | * @brief Sets a background color for the specified screen 402 | * @param target GFX_TOP or GFX_BOTTOM 403 | * @param color ABGR8 which will be the background one 404 | */ 405 | void pp2d_set_screen_color(gfxScreen_t target, u32 color); 406 | 407 | /** 408 | * @brief Inits a texture to be drawn 409 | * @param id of the texture 410 | * @param x to draw the texture at 411 | * @param y to draw the texture at 412 | */ 413 | void pp2d_texture_select(size_t id, int x, int y); 414 | 415 | /** 416 | * @brief Inits a portion of a texture to be drawn 417 | * @param id of the texture 418 | * @param x position on the screen to draw the texture 419 | * @param y position on the screen to draw the texture 420 | * @param xbegin position to start drawing 421 | * @param ybegin position to start drawing 422 | * @param width to draw from the xbegin position 423 | * @param height to draw from the ybegin position 424 | */ 425 | void pp2d_texture_select_part(size_t id, int x, int y, int xbegin, int ybegin, int width, int height); 426 | 427 | /** 428 | * @brief Modulates a texture with a color 429 | * @param color to modulate the texture 430 | */ 431 | void pp2d_texture_blend(u32 color); 432 | 433 | /** 434 | * @brief Scales a texture 435 | * @param scaleX width scale factor 436 | * @param scaleY height scale factor 437 | */ 438 | void pp2d_texture_scale(float scaleX, float scaleY); 439 | 440 | /** 441 | * @brief Flips a texture 442 | * @param fliptype HORIZONTAL, VERTICAL or BOTH 443 | */ 444 | void pp2d_texture_flip(flipType fliptype); 445 | 446 | /** 447 | * @brief Rotates a texture 448 | * @param angle in degrees to rotate the texture 449 | */ 450 | void pp2d_texture_rotate(float angle); 451 | 452 | /** 453 | * @brief Sets the depth of a texture 454 | * @param depth factor of the texture 455 | */ 456 | void pp2d_texture_depth(float depth); 457 | 458 | /** 459 | * @brief Renders a texture 460 | */ 461 | void pp2d_texture_draw(void); 462 | 463 | #ifdef __cplusplus 464 | } 465 | #endif 466 | -------------------------------------------------------------------------------- /Breakout/include/ishupe.hpp: -------------------------------------------------------------------------------- 1 | #include "Breakout.hpp" 2 | #include "objects.hpp" 3 | 4 | /* 5 | Returns true if two objects are colliding 6 | 7 | Variable Requirements: 8 | x 9 | y 10 | width 11 | height 12 | */ 13 | template 14 | bool test_collision(type_1 &object_1, type_2 &object_2) { 15 | return ((object_1.x <= (object_2.x + object_2.width)) && 16 | ((object_1.x + object_1.width) >= object_2.x) && 17 | (object_1.y <= (object_2.y + object_2.height)) && 18 | ((object_1.y + object_1.height) >= object_2.y)); 19 | } 20 | 21 | template 22 | bool test_collision(ball &tBall, type_1 &obj) { 23 | return ((tBall.mask_x <= (obj.x + obj.width)) && 24 | ((tBall.mask_x + tBall.mask_width) >= obj.x) && 25 | (tBall.mask_y <= (obj.y + obj.height)) && 26 | ((tBall.mask_y + tBall.mask_height) >= obj.y)); 27 | } 28 | 29 | /* 30 | Returns true if two objects are colliding 31 | 32 | bool: 33 | true: horizontal collision 34 | false: vertical collision 35 | 36 | Variable Requirements: 37 | x 38 | y 39 | mCircle: 40 | rad 41 | type_1 42 | width 43 | height 44 | */ 45 | template 46 | bool test_collision(ball &object_1, type_1 &object_2, bool test_horizontal) { 47 | double ball_x = object_1.getLeft(true) + ((object_1.width - object_1.mask_width) / 2); 48 | double ball_y = object_1.getTop(false) + ((object_1.height - object_1.mask_height) / 2); 49 | double ball_width = object_1.mask_width; 50 | double ball_height = object_1.mask_height; 51 | return ((ball_x <= (object_2.x + object_2.width)) && 52 | ((ball_x + ball_width) >= object_2.x) && 53 | (ball_y <= (object_2.y + object_2.height)) && 54 | ((ball_y + ball_height) >= object_2.y)); 55 | /*return ((object_1.x <= (object_2.x + object_2.width)) && 56 | ((object_1.x + object_1.width) >= object_2.x) && 57 | (object_1.y <= (object_2.y + object_2.height)) && 58 | ((object_1.y + object_1.height) >= object_2.y)); 59 | double line1a2 = object_1.x, line3a4 = object_1.y, line5a6 = object_1.x, line7a8 = object_1.y; 60 | if (test_horizontal) { 61 | line1a2 -= object_1.rad; 62 | line5a6 += object_1.rad; 63 | } 64 | else { 65 | line3a4 -= object_1.rad; 66 | line7a8 += object_1.rad; 67 | } 68 | return (( 69 | line1a2 >= object_2.x && 70 | line1a2 <= object_2.x + object_2.width && 71 | line3a4 >= object_2.y && 72 | line3a4 <= object_2.y + object_2.height 73 | ) || ( 74 | line5a6 >= object_2.x && 75 | line5a6 <= object_2.x + object_2.width && 76 | line7a8 >= object_2.y && 77 | line7a8 <= object_2.y + object_2.height 78 | ));*/ 79 | } 80 | 81 | /* 82 | Returns true if object is offscreen 83 | 84 | Variable Requirements: 85 | x 86 | y 87 | width 88 | height 89 | */ 90 | template 91 | bool off_screen(obj &object) { 92 | return ((object.x + object.width <= 0) || 93 | (object.x >= 400) || 94 | (object.y + object.height <= 0) || 95 | (object.y >= 240)); 96 | } 97 | 98 | /* 99 | Returns true if object is offscreen 100 | 101 | Variable Requirements: 102 | x 103 | y 104 | rad 105 | */ 106 | extern bool off_screen(ball &object); 107 | 108 | #define paddleMax(the_paddle) (399 - the_paddle.width) 109 | extern void movePaddle(bool right, paddle &the_paddle, std::vector &ball_vec); 110 | extern void setBallDirection(ball &tBall, double speed); 111 | extern void moveBall(ball &tBall, bool &cMode); 112 | extern void setNewBallAngle(double &angle); 113 | extern void setAngleGood(double &angle); 114 | -------------------------------------------------------------------------------- /Breakout/include/objects.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern std::vector*> powerup_texture_id; 4 | extern size_t brick_texture_by_type[brick_types]; 5 | extern size_t brick_second_texture_by_type[brick_types]; 6 | extern int brick_point_value[brick_types]; 7 | extern std::vector ball_texture_id; 8 | extern size_t stZ; 9 | 10 | /* 11 | laser object 12 | for use with a paddle object 13 | */ 14 | class laser { 15 | public: 16 | int x, y; 17 | int width, height; 18 | int texture_id; 19 | /* 20 | Sets the lasers default values 21 | 22 | int fx, fy: coordinates 23 | int fwidth, fheight: Laser size 24 | int texture: texture_id 25 | */ 26 | void setDefaults(int fx, int fy, int fwidth, int fheight, int texture) { 27 | x = fx; 28 | y = fy; 29 | width = fwidth; 30 | height = fheight; 31 | texture_id = texture; 32 | } 33 | void setPosition(double X, double Y) { 34 | x = X; 35 | y = Y; 36 | } 37 | void move(double X, double Y) { 38 | x += X; 39 | y += Y; 40 | } 41 | }; 42 | 43 | /* 44 | powerup object 45 | */ 46 | class powerup { 47 | bool defaults_set = false; 48 | int dX, dY; 49 | int dWidth, dHeight; 50 | public: 51 | int x, y; 52 | int width, height; 53 | int type; 54 | std::vector animation_id; 55 | int frame_count; 56 | /* 57 | Sets the powerups default values 58 | 59 | int set_x: x coordinate 60 | int set_y: y coordinate 61 | int set_width: width (mask) 62 | int set_height: height(mask) 63 | int set_texture: texture_id 64 | int type: powerup type 65 | */ 66 | void setDefaults(int fx, int fy, int fwidth, int fheight, int ftype, std::vector textures) { 67 | if (!defaults_set) { 68 | x = fx; dX = fx; 69 | y = fy; dY = fx; 70 | width = fwidth; dWidth = fwidth; 71 | height = fheight; dHeight = fheight; 72 | type = ftype; 73 | animation_id = textures; 74 | frame_count = textures.size(); 75 | defaults_set = true; 76 | } 77 | } 78 | /* 79 | Resets to defaults values 80 | */ 81 | void reset() { 82 | x = dX; 83 | y = dY; 84 | width = dWidth; 85 | height = dHeight; 86 | } 87 | void setPosition(double X, double Y) { 88 | x = X; 89 | y = Y; 90 | } 91 | void move(double X, double Y) { 92 | x += X; 93 | y += Y; 94 | } 95 | }; 96 | 97 | /* 98 | Brick object 99 | */ 100 | class brick { 101 | private: 102 | int internal_brick_type; 103 | void set_hits() { 104 | switch (internal_brick_type) { 105 | case 0: hits_left = 0; 106 | break; 107 | case 1: 108 | case 2: 109 | case 3: 110 | case 4: 111 | case 5: hits_left = 1; 112 | break; 113 | case 6: 114 | case 7: 115 | case 8: 116 | case 9: 117 | case 10: hits_left = 2; 118 | break; 119 | case 11: hits_left = std::numeric_limits::max(); // Technically it is possible to destroy these bricks... but come on, it takes like 2+ billion hits so yeah. 120 | } 121 | } 122 | bool internal_is_used; 123 | int get_powerup() 124 | { 125 | switch (internal_brick_type) { 126 | case 0: return 0; 127 | case 1: 128 | case 2: 129 | case 6: 130 | case 7: { 131 | int temp_number = rand() % 20; 132 | if (temp_number <= 3) 133 | { 134 | temp_number = rand() % 5; 135 | return (temp_number + 1); 136 | } 137 | return 0; 138 | } 139 | case 3: 140 | case 4: 141 | case 5: 142 | case 8: 143 | case 9: 144 | case 10: { 145 | int temp_number = rand() % 4; 146 | if (temp_number == 1) 147 | { 148 | temp_number = rand() % 5; 149 | return (temp_number + 1); 150 | } 151 | return 0; 152 | } 153 | } 154 | return 0; 155 | } 156 | int wait_frame = 0; 157 | double dX, dY; 158 | double dWidth, dHeight; 159 | public: 160 | double x, y; 161 | int texture_id; 162 | int hits_left; 163 | bool has_powerup_on_screen = false; 164 | powerup my_powerup; 165 | int powerup_timer = 0; 166 | bool exists; 167 | double width, height; 168 | double e1(double X) { 169 | double b = y - 1 * x; 170 | return 1 * X + b; 171 | } 172 | double e3(double X) { 173 | double b = (y + height) - 1 * (x + width); 174 | return 1 * X + b; 175 | } 176 | double e2(double X) { 177 | double b = (y + height) + 1 * x; 178 | return -1 * X + b; 179 | } 180 | double e4(double X) { 181 | double b = y + 1 * (x + width); 182 | return -1 * X + b; 183 | } 184 | /* 185 | fx: Default X 186 | fy: Default Y 187 | fwidth: Default Width 188 | fheight: Default Height 189 | is_used: If false, brick.exist will be false by default 190 | brick_type: value to be used to determine point value and powerup chance 191 | 192 | Sets the default X,Y Coordinate, Width, Height, Palette, Existance, and Brick Type of the Brick 193 | */ 194 | void setDefaults(double fx, double fy, double fwidth, double fheight, bool is_used, int brick_type) 195 | { 196 | x = fx; dX = fx; 197 | y = fy; dY = fy; 198 | width = fwidth; dWidth = fwidth; 199 | height = fheight; dHeight = fheight; 200 | internal_is_used = is_used; 201 | exists = is_used; 202 | internal_brick_type = brick_type; 203 | if (brick_type != 0) texture_id = brick_texture_by_type[brick_type]; 204 | set_hits(); 205 | } 206 | int type() { 207 | return internal_brick_type; 208 | } 209 | void draw() { 210 | if (wait_frame == 9) { 211 | wait_frame = 0; 212 | powerup_timer++; 213 | } 214 | if (powerup_timer >= my_powerup.frame_count) powerup_timer = 0; 215 | pp2d_draw_texture(my_powerup.animation_id[powerup_timer], my_powerup.x, my_powerup.y); 216 | wait_frame++; 217 | } 218 | /* 219 | Sets the exists value to false thus removing it from play 220 | or subtracts one from the hits value (if brick requires multiple hits) 221 | */ 222 | void destroy() 223 | { 224 | if (hits_left <= 1) 225 | exists = false; 226 | else { 227 | hits_left--; 228 | if (internal_brick_type >= 6 && internal_brick_type <= 10) texture_id = brick_second_texture_by_type[internal_brick_type]; 229 | } 230 | } 231 | /* 232 | Resets the brick values to their defaults 233 | */ 234 | void reset() 235 | { 236 | exists = internal_is_used; 237 | x = dX; 238 | y = dY; 239 | width = dWidth; 240 | height = dHeight; 241 | texture_id = brick_texture_by_type[internal_brick_type]; 242 | set_hits(); 243 | powerup_timer = 0; 244 | has_powerup_on_screen = false; 245 | wait_frame = 0; 246 | } 247 | /* 248 | Integer: Returns the point value given by the brick 249 | */ 250 | int point_value() 251 | { 252 | return brick_point_value[internal_brick_type]; 253 | } 254 | /* 255 | Integer: Returns 0 for no powerup or higher number for powerup drop 256 | 1: Laser 257 | 2: Big Paddle 258 | 3: Small Paddle 259 | 4: Life 260 | 5: Multi-Ball 261 | */ 262 | int random_powerup() 263 | { 264 | return get_powerup(); 265 | } 266 | /*spawns powerup*/ 267 | void spawn_powerup(int type) { 268 | my_powerup.setDefaults(x + ((width - 28) / 2), y + ((height - 7) / 2), 18, 7, type, *powerup_texture_id[type - 1]); 269 | has_powerup_on_screen = true; 270 | } 271 | void setPosition(double X, double Y) { 272 | x = X; 273 | y = Y; 274 | } 275 | void move(double X, double Y) { 276 | x += X; 277 | y += Y; 278 | } 279 | }; 280 | 281 | /* 282 | Circle: 283 | X, Y, and Radius 284 | */ 285 | struct circle { 286 | double x, y, rad; 287 | /* 288 | Sets the circles default values for: 289 | i_x: X coord 290 | i_y: Y coord 291 | i_rad: radius 292 | */ 293 | void setDefaults(double fx, double fy, double frad) { 294 | x = fx; 295 | default_x = fx; 296 | y = fy; 297 | default_y = fy; 298 | rad = frad; 299 | default_rad = frad; 300 | } 301 | /*resets circle's position and size*/ 302 | void reset() { 303 | x = default_x; 304 | y = default_y; 305 | rad = default_rad; 306 | } 307 | void setPosition(double X, double Y) { 308 | x = X; 309 | y = Y; 310 | } 311 | void move(double X, double Y) { 312 | x += X; 313 | y += Y; 314 | } 315 | private: 316 | double default_x, default_y, default_rad; 317 | }; 318 | 319 | /* 320 | Ball object 321 | */ 322 | class ball { 323 | int internal_ball_type; 324 | double dX, dY; 325 | double dWidth, dHeight; 326 | public: 327 | double x, y; 328 | bool brickHitH, brickHitV; 329 | double dx, dy; 330 | double width, height; 331 | std::vector trail_x, trail_y; 332 | std::vector trail_circle; 333 | bool exists; 334 | double angle; 335 | size_t texture_id; 336 | bool has_interacted; 337 | bool hasHitPadd, has_hit_paddle; 338 | bool hasHitWall, has_hit_wall; 339 | bool is_attached; 340 | bool isInWall, isInPaddle; 341 | int bricks_hit; 342 | double mask_x, mask_y; 343 | double mask_width; 344 | double mask_height; 345 | bool has_rotated_this_frame = false; 346 | bool inside_brick[50] = {lvlFullLine(false), lvlFullLine(false), lvlFullLine(false), lvlFullLine(false), lvlFullLine(false)}; 347 | double mid(bool X) { 348 | return (X ? mask_x + (mask_width / 2.0) : mask_y + (mask_height / 2.0)); 349 | } 350 | /* 351 | sets ball's default position, size, and type 352 | */ 353 | void setDefaults(double fx, double fy, double fwidth, double fheight, int ball_type, double fMw, double fMh) 354 | { 355 | x = fx; dX = fx; 356 | y = fy; dY = fy; 357 | width = fwidth; dWidth = fwidth; 358 | height = fheight; dHeight = fheight; 359 | mask_width = fMw; 360 | mask_height = fMh; 361 | mask_x = x + ((width - mask_width) / 2); 362 | mask_y = y + ((height - mask_height) / 2); 363 | internal_ball_type = ball_type; 364 | if (*ball_texture_id[ball_type] != stZ) texture_id = *ball_texture_id[ball_type]; 365 | exists = true; 366 | trail_x.resize(8); 367 | trail_y.resize(8); 368 | trail_circle.resize(8); 369 | } 370 | /*resets the ball to it's default values*/ 371 | void reset() { 372 | x = dX; 373 | y = dY; 374 | width = dWidth; 375 | height = dHeight; 376 | exists = true; 377 | hasHitPadd = false, hasHitWall = false; 378 | isInPaddle = false, isInWall = false; 379 | brickHitV = false, brickHitH = false; 380 | } 381 | /* 382 | returns the leftmost side of the ball 383 | X: (boolean) if true returns X coordinate, if false returns Y coordinate 384 | */ 385 | double getLeft(bool X) 386 | { 387 | return (X ? x : y + (height / 2)); 388 | } 389 | /* 390 | returns the rightmost side of the ball 391 | X: (boolean) if true returns X coordinate, if false returns Y coordinate 392 | */ 393 | double getRight(bool X) { 394 | return (X ? x + width : y + (height / 2)); 395 | } 396 | /* 397 | returns the upmost side of the ball 398 | X: (boolean) if true returns X coordinate, if false returns Y coordinate 399 | */ 400 | double getTop(bool X) { 401 | return (X ? x + (width / 2): y); 402 | } 403 | /* 404 | returns the downmost side of the ball 405 | X: (boolean) if true returns X coordinate, if false returns Y coordinate 406 | */ 407 | double getBottom(bool X) { 408 | return (X ? x + (width / 2) : y + height); 409 | } 410 | void setPosition(double X, double Y) { 411 | x = X; 412 | y = Y; 413 | } 414 | /* 415 | moves the ball to a new position 416 | dx: horizontal direction 417 | dy: vertical direction 418 | */ 419 | void move(double X, double Y) { 420 | x += X; 421 | y += Y; 422 | } 423 | }; 424 | 425 | /* 426 | Paddle object 427 | */ 428 | class paddle { 429 | double dX, dY; 430 | double dWidth, dHeight; 431 | bool defaults_set = false; 432 | size_t dTexture_id; 433 | public: 434 | double x, y; 435 | double width, height; 436 | size_t texture_id; 437 | bool has_laser; 438 | bool laser_on_screen; 439 | bool has_big; 440 | bool has_small; 441 | bool has_multi; 442 | laser the_laser; 443 | std::vector multi_ball; 444 | /* 445 | sets the paddle's default position size and texture id 446 | fx: X position 447 | fy: Y position 448 | fwidth: paddle width (for collision) 449 | fheight: paddle height (for collision) 450 | ftexture_id: texture id for paddle 451 | */ 452 | void setDefaults(double fx, double fy, double fwidth, double fheight, size_t ftexture_id) 453 | { 454 | if (!defaults_set) { 455 | x = fx; dX = fx; 456 | y = fy; dY = fy; 457 | width = fwidth; dWidth = fwidth; 458 | height = fheight; dHeight = fheight; 459 | texture_id = ftexture_id; 460 | dTexture_id = ftexture_id; 461 | defaults_set = true; 462 | } 463 | } 464 | /*spawns extra balls*/ 465 | void spawn_multi(ball tBall, std::vector &ball_vec) { 466 | ball *new_ball[2] = { new ball, new ball }; 467 | for (int i = 0; i < 2; i++) { 468 | new_ball[i]->setDefaults(tBall.x, tBall.y, tBall.width, tBall.height, 1, tBall.mask_width, tBall.mask_height); 469 | new_ball[i]->angle = tBall.angle + (-20 + (40 * i)); 470 | for (int j = 0; j < 8; j++) 471 | new_ball[i]->trail_circle[7 - j].setDefaults(tBall.x, tBall.y, (0.875 * (j + 1))); 472 | new_ball[i]->is_attached = false; 473 | ball_vec.push_back(*new_ball[i]); 474 | delete new_ball[i]; 475 | } 476 | } 477 | /*runs script for enlarging paddle*/ 478 | void getBig() { 479 | width = 70; 480 | x -= 10; 481 | x = (x < 1 ? 1 : (x > 329 ? 329 : x)); 482 | texture_id = paddleBigID; 483 | } 484 | /*runs script for shrinking paddle*/ 485 | void getSmall() { 486 | width = 30; 487 | x += 10; 488 | texture_id = paddleSmallID; 489 | } 490 | /*removes powerups from paddle*/ 491 | void remove_powerups() { 492 | if (has_big || has_small) { 493 | width = dWidth; 494 | x += (has_big ? 10 : (has_small ? -10 : NULL)); 495 | x = (x < 1 ? 1 : (x > 329 ? 329 : x)); 496 | } 497 | has_laser = false; 498 | has_big = false; 499 | has_small = false; 500 | texture_id = dTexture_id; 501 | } 502 | /*resets the paddle to it's default values*/ 503 | void reset() 504 | { 505 | x = dX; 506 | y = dY; 507 | width = dWidth; 508 | height = dHeight; 509 | has_laser = false; 510 | has_big = false; 511 | has_small = false; 512 | texture_id = dTexture_id; 513 | laser_on_screen = false; 514 | } 515 | /* 516 | returns the leftmost side of the paddle 517 | X: (boolean) if true returns X coordinate, if false returns Y coordinate 518 | */ 519 | double getLeft(bool X) 520 | { 521 | return (X ? x : y + (height / 2.0)); 522 | } 523 | /* 524 | returns the rightmost side of the paddle 525 | X: (boolean) if true returns X coordinate, if false returns Y coordinate 526 | */ 527 | double getRight(bool X) 528 | { 529 | return (X ? x + width : y + (height / 2.0)); 530 | } 531 | /* 532 | returns the upmost side of the paddle 533 | X: (boolean) if true returns X coordinate, if false returns Y coordinate 534 | */ 535 | double getTop(bool X) 536 | { 537 | return (X ? x + (width / 2.0) : y); 538 | } 539 | /* 540 | returns the downmost side of the paddle 541 | X: (boolean) if true returns X coordinate, if false returns Y coordinate 542 | */ 543 | double getBottom(bool X) 544 | { 545 | return (X ? x + (width / 2.0) : y + height); 546 | } 547 | void setPosition(double X, double Y) { 548 | x = X; 549 | y = Y; 550 | } 551 | void move(double X, double Y) { 552 | x += X; 553 | y += Y; 554 | } 555 | }; 556 | -------------------------------------------------------------------------------- /Breakout/readme.txt: -------------------------------------------------------------------------------- 1 | Some Credits: 2 | 3 | bounce 0-2 (.raw) from http://freesound.org/people/xDimebagx/sounds/331305/ 4 | bounce 3-6 (.raw) also from the above, but pitch changed in audacity (3 and 5 are from 1, and 4 and 6 are from 2) 5 | bounce 7.raw ripped from the NES version of Arkanoid (I'm pretty sure Taito doesn't exist anymore, but if they do, and they still own the copyright on this thing tell me so I can remove it). -------------------------------------------------------------------------------- /Breakout/romfs/bounce0.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/bounce0.raw -------------------------------------------------------------------------------- /Breakout/romfs/bounce1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/bounce1.raw -------------------------------------------------------------------------------- /Breakout/romfs/bounce2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/bounce2.raw -------------------------------------------------------------------------------- /Breakout/romfs/bounce3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/bounce3.raw -------------------------------------------------------------------------------- /Breakout/romfs/bounce4.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/bounce4.raw -------------------------------------------------------------------------------- /Breakout/romfs/bounce5.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/bounce5.raw -------------------------------------------------------------------------------- /Breakout/romfs/bounce6.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/bounce6.raw -------------------------------------------------------------------------------- /Breakout/romfs/bounce7.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/bounce7.raw -------------------------------------------------------------------------------- /Breakout/romfs/sprites/background/Title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/background/Title.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/background/press_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/background/press_select.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/background/thanksbeta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/background/thanksbeta.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/background/waveform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/background/waveform.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/ball00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/ball00.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick00.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick01.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick02.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick03.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick04.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick05.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick06.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick07.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick08.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick09.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick10.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick11.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick12.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick13.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick14.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/brick/brick15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/brick/brick15.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/extra_ball/ball01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/extra_ball/ball01.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/extra_ball/ball02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/extra_ball/ball02.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/extra_ball/ball03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/extra_ball/ball03.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/extra_ball/ball04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/extra_ball/ball04.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/extra_ball/ball05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/extra_ball/ball05.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/extra_ball/ball06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/extra_ball/ball06.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/extra_ball/ball07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/extra_ball/ball07.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/laser_paddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/laser_paddle.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/misc/laser_trail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/misc/laser_trail.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/paddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/paddle.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/paddle_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/paddle_big.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/paddle_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/paddle_small.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/laser00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/laser00.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/laser01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/laser01.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/laser02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/laser02.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/laser03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/laser03.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/laser04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/laser04.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/laser05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/laser05.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/life00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/life00.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/life01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/life01.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/life02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/life02.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/life03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/life03.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/life04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/life04.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/life05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/life05.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/multi_ball00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/multi_ball00.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/multi_ball01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/multi_ball01.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/multi_ball02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/multi_ball02.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/multi_ball03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/multi_ball03.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/multi_ball04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/multi_ball04.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/multi_ball05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/multi_ball05.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_big00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_big00.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_big01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_big01.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_big02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_big02.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_big03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_big03.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_big04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_big04.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_big05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_big05.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_small00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_small00.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_small01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_small01.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_small02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_small02.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_small03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_small03.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_small04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_small04.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/powerup/paddle_small05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/powerup/paddle_small05.png -------------------------------------------------------------------------------- /Breakout/romfs/sprites/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/Breakout/romfs/sprites/test.png -------------------------------------------------------------------------------- /Breakout/source/Breakout.cpp: -------------------------------------------------------------------------------- 1 | #include "Breakout.hpp" 2 | #include "objects.hpp" 3 | #include "draw.hpp" 4 | #include "audio/sfx.h" 5 | #include "audio/filesystem.h" 6 | #include "ishupe.hpp" 7 | #include "file/file_access.hpp" 8 | 9 | //By Matthew Rease (马太) https://github.com/Magicrafter13/Breakout 10 | //你好中国!我的名字是马太。我是中文一班。对不起,如果我的中文不好。(I did have to use Google translate for the last sentence :/ ). 11 | 12 | FILE* debug_file,* settings_file; 13 | 14 | //init 15 | std::string versiontxtt = " Beta ", versiontxtn = "01.07.02"; 16 | std::string buildnumber = "18.04.22.1228", ishupeversion = "01.00.00"; 17 | int vernumqik = 0; 18 | u32 kDown, kHeld; 19 | 20 | std::vector saved_level(SAVE_FILES); 21 | int designed_level[SAVE_FILES][50]; 22 | std::string saved_level_filename[SAVE_FILES]; 23 | 24 | int breakout(); 25 | int thanks_for_playing_the_beta(); 26 | int extras_10_13_2017(); 27 | int level_designer(); 28 | int save_level(int selection); 29 | 30 | int lives, points, level; 31 | bool crushBall = false; 32 | int last_power, times_power_1, times_power_2, times_power_3; 33 | int press_select_frame = 0; bool press_select_visible = true; 34 | 35 | paddle the_paddle; std::vector the_ball(1); brick brick_array[def_level_count][50]; 36 | SFX_s *ball_bounce[8]; 37 | size_t titleID, thanksBetaID, waveformID, paddleID, ball00ID, pressSelectID, laserPaddleID, laserID, paddleBigID, paddleSmallID, testID; 38 | std::vector extraBallID, pLaserID(6), pLifeID(6), pMultiBallID(6), pPaddleBigID(6), pPaddleSmallID(6); 39 | 40 | bool cMode = false, update_text; 41 | 42 | /*integer mask for levels*/ 43 | int level_mask[def_level_count][50] = { 44 | { 45 | lvlFullLine(0), 46 | lvlFullLine(0), 47 | lvlFullLine(0), 48 | lvlFullLine(0), 49 | lvlFullLine(0) 50 | }, 51 | { 52 | lvlFullLine(5), 53 | lvlFullLine(4), 54 | lvlFullLine(3), 55 | lvlFullLine(2), 56 | lvlFullLine(1), 57 | }, 58 | { 59 | 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 60 | 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 61 | 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 62 | 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 63 | lvlFullLine(1) 64 | }, 65 | { 66 | 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 67 | 0, 10, 0, 0, 0, 0, 0, 0, 6, 0, 68 | 0, 8, 0, 0, 0, 0, 0, 0, 9, 0, 69 | 0, 9, 3, 1, 3, 4, 3, 2, 8, 0, 70 | 0, 6, 3, 3, 5, 3, 2, 2, 10, 0 71 | }, 72 | { 73 | 0, 0, 1, 1, 2, 2, 1, 1, 0, 0, 74 | 1, 1, 2, 2, 3, 3, 2, 2, 1, 1, 75 | 2, 2, 3, 3, 9, 9, 3, 3, 2, 2, 76 | 1, 1, 2, 2, 3, 3, 2, 2, 1, 1, 77 | 0, 0, 1, 1, 2, 2, 1, 1, 0, 0 78 | }, 79 | { 80 | 5, 0, 3, 2, 0, 0, 2, 3, 0, 5, 81 | 4, 8, 2, 1, 10, 10, 1, 2, 8, 4, 82 | 0, 2, 0, 0, 9, 9, 0, 0, 2, 0, 83 | 4, 8, 2, 1, 10, 10, 1, 2, 8, 4, 84 | 5, 0, 3, 2, 0, 0, 2, 3, 0, 5 85 | } 86 | }; 87 | 88 | /*set ball trail*/ 89 | void trail_new_frame(std::vector &ball_vec) 90 | { 91 | for (auto &tBall : ball_vec) { 92 | tBall.trail_x.insert(tBall.trail_x.begin(), tBall.x); 93 | tBall.trail_y.insert(tBall.trail_y.begin(), tBall.y); 94 | tBall.trail_x.resize(8); tBall.trail_y.resize(8); 95 | tBall.trail_x.shrink_to_fit(); tBall.trail_y.shrink_to_fit(); 96 | for (int i = 0; i < 8; i++) 97 | tBall.trail_circle[i].setPosition(tBall.trail_x[i], tBall.trail_y[i]); 98 | } 99 | } 100 | 101 | /*returns if area is being touched by stylus*/ 102 | bool touchInBox(touchPosition touch, int x, int y, int w, int h) 103 | { 104 | int tx = touch.px; 105 | int ty = touch.py; 106 | kDown = hidKeysDown(); 107 | if (kDown & KEY_TOUCH && tx > x && tx < x + w && ty > y && ty < y + h) 108 | return true; 109 | else 110 | return false; 111 | } 112 | 113 | void resetBalls(std::vector &ball_vec) { 114 | ball_vec.resize(1); 115 | ball_vec[0].reset(); 116 | setNewBallAngle(ball_vec[0].angle); 117 | ball_vec[0].is_attached = true; 118 | } 119 | 120 | touchPosition touch; 121 | 122 | PrintConsole bottomScreen, versionWin, killBox, debugBox; 123 | 124 | FS_Archive sdmcArchive; 125 | 126 | /*open SD card filesystem*/ 127 | void openSD() 128 | { 129 | FSUSER_OpenArchive(&sdmcArchive, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, "")); 130 | } 131 | 132 | /*close SD card filesystem*/ 133 | void closeSD() 134 | { 135 | FSUSER_CloseArchive(sdmcArchive); 136 | } 137 | 138 | /*initialize textures*/ 139 | void init_game_textures() { 140 | size_t id; 141 | for (id = 0; id < BRICK_FILES; id++) { 142 | std::string temp = "romfs:/sprites/brick/brick"; 143 | if (id < 10) temp += "0"; 144 | temp += std::to_string(id) + ".png"; 145 | pp2d_load_texture_png(id, temp.c_str()); 146 | } 147 | std::vector backgroundS = { 148 | "press_select.png", 149 | "thanksbeta.png", 150 | "Title.png", 151 | "waveform.png" 152 | }; 153 | std::vector backgroundI = { 154 | &pressSelectID, 155 | &thanksBetaID, 156 | &titleID, 157 | &waveformID 158 | }; 159 | size_t i = id; 160 | for (id = i; id < i + backgroundS.size(); id++) { 161 | pp2d_load_texture_png(id, ("romfs:/sprites/background/" + backgroundS[id - i]).c_str()); 162 | *backgroundI[id - i] = id; 163 | } 164 | std::vector miscS { 165 | "laser_paddle.png", 166 | "laser_trail.png" 167 | }; 168 | std::vector miscI { 169 | &laserPaddleID, 170 | &laserID 171 | }; 172 | i = id; 173 | for (id = i; id < i + miscS.size(); id++) { 174 | pp2d_load_texture_png(id, ("romfs:/sprites/misc/" + miscS[id - i]).c_str()); 175 | *miscI[id - i] = id; 176 | } 177 | i = id; 178 | int extra_balls = 7; 179 | extraBallID.resize(extra_balls); 180 | for (id = i; id < i + extra_balls; id++) { 181 | pp2d_load_texture_png(id, ("romfs:/sprites/misc/extra_ball/ball" + (((id - i + 1) < 10) ? ("0" + std::to_string((id - i + 1))) : (std::to_string((id - i + 1)))) + ".png").c_str()); 182 | extraBallID[id - i] = id; 183 | } 184 | std::vector powerupS { 185 | "laser", 186 | "life", 187 | "multi_ball", 188 | "paddle_big", 189 | "paddle_small" 190 | }; 191 | std::vector*> powerupI = { 192 | &pLaserID, 193 | &pLifeID, 194 | &pMultiBallID, 195 | &pPaddleBigID, 196 | &pPaddleSmallID 197 | }; 198 | for (int f = 0; f < AMOUNT_OF_POWERUPS; f++) { 199 | i = id; 200 | powerupI[f]->resize(0); 201 | for (id = i; id < i + 6; id++) { 202 | pp2d_load_texture_png(id, ("romfs:/sprites/powerup/" + powerupS[f] + (((id - i) < 10) ? ("0" + std::to_string((id - i))) : (std::to_string((id - i)))) + ".png").c_str()); 203 | powerupI[f]->push_back(id); 204 | } 205 | } 206 | std::vector rootS = { 207 | "ball00.png", 208 | "paddle.png", 209 | "paddle_big.png", 210 | "paddle_small.png", 211 | "test.png" 212 | }; 213 | std::vector rootI = { 214 | &ball00ID, 215 | &paddleID, 216 | &paddleBigID, 217 | &paddleSmallID, 218 | &testID 219 | }; 220 | i = id; 221 | for (id = i; id < i + rootS.size(); id++) { 222 | pp2d_load_texture_png(id, ("romfs:/sprites/" + rootS[id - i]).c_str()); 223 | *rootI[id - i] = id; 224 | } 225 | }; 226 | 227 | /*initialize audio*/ 228 | void initialize_audio() { 229 | for (int i = 0; i < 8; i++) { 230 | std::string filename = "romfs:/bounce" + std::to_string(i) + ".raw"; 231 | ball_bounce[i] = createSFX(filename.c_str(), SOUND_FORMAT_16BIT); 232 | } 233 | } 234 | 235 | /*create level layout or something*/ 236 | void initialize_brick_array() { 237 | for (int q = 0; q < def_level_count; q++) { 238 | int array_step = 0; 239 | for (int a = 0; a < 5; a++) 240 | for (int b = 0; b < 10; b++) { 241 | brick_array[q][array_step].setDefaults((40 * b) + 2, ((20 * a) + 2), 36, 16, (level_mask[q][array_step] != 0), level_mask[q][array_step]); 242 | array_step++; 243 | } 244 | } 245 | } 246 | 247 | /*Writes Settings File*/ 248 | void writeSettings() { 249 | settings_file = fopen("sdmc:/3ds/settings.bsf", "w"); 250 | fprintf(settings_file, "%s %d ", "old", (cMode ? 1 : 0)); 251 | fclose(settings_file); 252 | } 253 | 254 | void readSettings() { 255 | char dummy; 256 | int cModeT; 257 | settings_file = fopen("sdmc:/3ds/settings.bsf", "r"); 258 | fscanf(settings_file, "%s %d", &dummy, &cModeT); 259 | fclose(settings_file); 260 | cMode = (cModeT == 1 ? true : false); 261 | } 262 | 263 | /*begin application*/ 264 | int main(int argc, char **argv) 265 | { 266 | debug_file = fopen("sdmc:/3ds/breakout_debug.txt", "w"); 267 | if ((settings_file = fopen("sdmc:/3ds/settings.bsf", "r"))) { 268 | fclose(settings_file); 269 | readSettings(); 270 | } 271 | else { 272 | writeSettings(); 273 | readSettings(); 274 | } 275 | settings_file = fopen("sdmc:/3ds/settings.bsf", "r"); 276 | pp2d_init(); 277 | pp2d_set_screen_color(GFX_TOP, ABGR8(255, 149, 149, 149)); 278 | romfsInit(); 279 | csndInit(); 280 | initSound(); 281 | init_game_textures(); 282 | 283 | if (FILE *file = fopen("sdmc:/3ds/breakout_level.bsl", "r")) { 284 | fclose(file); 285 | create_save_files(0); 286 | } 287 | if (FILE *file = fopen("sdmc:/3ds/breakout_level_0.bsl", "r")) fclose(file); 288 | else create_save_files(1); 289 | 290 | load_save_files(); 291 | initialize_audio(); 292 | initialize_brick_array(); 293 | 294 | srand(time(NULL)); 295 | 296 | consoleInit(GFX_BOTTOM, &bottomScreen); consoleInit(GFX_BOTTOM, &versionWin); 297 | consoleInit(GFX_BOTTOM, &killBox); consoleInit(GFX_BOTTOM, &debugBox); 298 | 299 | consoleSetWindow(&versionWin, 6, 26, 34, 4); 300 | consoleSetWindow(&killBox, 0, 28, 40, 2); 301 | consoleSetWindow(&debugBox, 18, 4, 9, 12); 302 | 303 | the_paddle.setDefaults(175, 215, 50, 10, paddleID); 304 | the_ball[0].setDefaults(193.0, 193.0, 14.0, 14.0, 1, 11.6, 11.6); 305 | for (auto &tBall : the_ball) 306 | for (int i = 0; i < 8; i++) 307 | tBall.trail_circle[7 - i].setDefaults(200.0, 120.0, (0.875 * (i + 1))); 308 | 309 | int bottom_screen_text = 0; 310 | 311 | // Main loop 312 | while (aptMainLoop()) { 313 | hidScanInput(); 314 | kDown = hidKeysDown(); 315 | if (kDown & KEY_START) break; // break in order to return to hbmenu 316 | /*go to extras when X pressed*/ 317 | if (kDown & KEY_X) { 318 | int ext_return = extras_10_13_2017(); 319 | if (ext_return == 3) break; 320 | bottom_screen_text = 0; 321 | } 322 | /*level designer*/ 323 | if (kDown & KEY_Y) { 324 | level_designer(); 325 | bottom_screen_text = 0; 326 | } 327 | /*Toggle Compatibility Mode*/ 328 | if (kDown & KEY_R) { 329 | cMode = (cMode ? false : true); 330 | writeSettings(); 331 | readSettings(); 332 | bottom_screen_text = 0; 333 | } 334 | /*begin game*/ 335 | if (kDown & KEY_SELECT) { 336 | update_text = true; 337 | lives = 3; 338 | int result = 3; 339 | resetBalls(the_ball); 340 | the_paddle.reset(); 341 | setNewBallAngle(the_ball[0].angle); 342 | for (int i = 0; i < def_level_count; i++) 343 | for (int j = 0; j < 50; j++) 344 | brick_array[i][j].reset(); 345 | level = 1; points = 0; last_power = 0; 346 | times_power_1 = 0; times_power_2 = 0; times_power_3 = 0; 347 | the_ball[0].is_attached = true; 348 | /*main breakout loop*/ 349 | while (true) { 350 | result = breakout(); 351 | if (result != 0) break; 352 | } 353 | bottom_screen_text = 0; 354 | if (result == 3) break; 355 | } 356 | /*text display (run once to avoid screen tearing)*/ 357 | if (bottom_screen_text == 0) { 358 | consoleSelect(&killBox); consoleClear(); 359 | consoleSelect(&versionWin); consoleClear(); 360 | consoleSelect(&bottomScreen); consoleClear(); 361 | 362 | consoleSelect(&killBox); 363 | std::cout << CRESET ANSI B_RED CEND; 364 | for (int i = 0; i < 80; i++) 365 | std::cout << " "; 366 | 367 | consoleSelect(&versionWin); 368 | std::cout << CRESET " Tap red area any time to exit"; 369 | std::cout << "Breakout Version: " ANSI RED CEND << versiontxtt << CRESET " " ANSI YELLOW CEND << versiontxtn; 370 | std::cout << ANSI B_RED ASEP GREEN CEND " Build: " << buildnumber; 371 | std::cout << ANSI B_RED ASEP GREEN CEND " ISHUPE Engine Version: " << ishupeversion; 372 | 373 | consoleSelect(&bottomScreen); 374 | std::cout << CRESET ANSI "20;0" PEND; 375 | 376 | std::cout << CRESET ANSI "2;0" PEND "Press Select to begin." << std::endl; 377 | std::cout << "Press X to see what I'm working on or have planned." << std::endl; 378 | std::cout << "Press Y to open level editor." << std::endl << std::endl; 379 | 380 | std::cout << "Compatibility Mode: " << (cMode ? "On" : "Off") << std::endl; 381 | std::cout << "(Turn on if not using a 'New' 3DS/2DS)" << std::endl << "Press R" << std::endl; 382 | std::cout << "May cause undesireable results on VERY" << std::endl << "rare occasions." << std::endl; 383 | 384 | bottom_screen_text = 1; 385 | } 386 | press_select_frame++; 387 | 388 | pp2d_begin_draw(GFX_TOP, GFX_LEFT); 389 | draw_object(the_paddle); 390 | pp2d_draw_texture(titleID, 80, 20); 391 | pp2d_draw_texture(paddleID, 122, 92); 392 | if (press_select_visible) pp2d_draw_texture(pressSelectID, 100, 180); 393 | pp2d_end_draw(); 394 | 395 | /*after half a second, Press Select to play! is toggled*/ 396 | if (press_select_frame == 30) { 397 | press_select_frame = 0; 398 | if (press_select_visible) 399 | press_select_visible = false; 400 | else 401 | press_select_visible = true; 402 | } 403 | 404 | hidTouchRead(&touch); 405 | 406 | /*exit game if red box touched*/ 407 | if (touchInBox(touch, 0, 224, 320, 16)) { 408 | std::cout << "Exiting...\n"; 409 | break; 410 | } 411 | } 412 | 413 | // Exit services 414 | for (int i = 0; i < SAVE_FILES; i++) fclose(saved_level[i]); 415 | 416 | pp2d_exit(); 417 | 418 | exitSound(); 419 | 420 | return 0; 421 | } 422 | 423 | bool change_level; 424 | int thanks_text_display; 425 | std::string debug_string; 426 | 427 | void run_powerup(int typef) { 428 | switch (typef) { 429 | case 1: 430 | the_paddle.remove_powerups(); 431 | the_paddle.has_laser = true; 432 | the_paddle.texture_id = laserPaddleID; 433 | break; 434 | case 2: 435 | the_paddle.remove_powerups(); 436 | the_paddle.has_big = true; 437 | the_paddle.getBig(); 438 | break; 439 | case 3: 440 | the_paddle.remove_powerups(); 441 | the_paddle.has_small = true; 442 | the_paddle.getSmall(); 443 | break; 444 | case 4: 445 | lives++; 446 | break; 447 | case 5: 448 | the_paddle.remove_powerups(); 449 | the_paddle.has_multi = true; 450 | for (auto tBall : the_ball) { 451 | if (tBall.exists) the_paddle.spawn_multi(tBall, the_ball); 452 | break; 453 | } 454 | break; 455 | } 456 | } 457 | 458 | int loseLife() { 459 | lives--; 460 | the_paddle.reset(); 461 | resetBalls(the_ball); 462 | update_text = true; 463 | return 0; 464 | } 465 | 466 | /*main game*/ 467 | int breakout() 468 | { 469 | hidScanInput(); 470 | kDown = hidKeysDown(); kHeld = hidKeysHeld(); 471 | if (kDown & KEY_SELECT || lives == 0) return 2; 472 | if (kHeld & KEY_START) return 3; 473 | /*move paddle (if applicable)*/ 474 | if ((kHeld | kDown) & (KEY_LEFT | KEY_RIGHT)) movePaddle((kHeld & KEY_LEFT ? false : true), the_paddle, the_ball); 475 | int balls_on_screen = 0; 476 | for (auto &tBall : the_ball) { 477 | if (tBall.getTop(false) > 240) tBall.exists = false; 478 | if (tBall.exists) balls_on_screen++; 479 | } 480 | if (balls_on_screen == 0) return loseLife(); 481 | 482 | for (auto &tBall : the_ball) { 483 | if (tBall.exists) { 484 | tBall.has_interacted = false; 485 | tBall.has_hit_paddle = false; 486 | tBall.has_hit_wall = false; 487 | } 488 | } 489 | bool ball_was_shot = false; 490 | if (kDown & KEY_A) { 491 | for (auto &tBall : the_ball) { 492 | if (tBall.is_attached) { 493 | tBall.is_attached = false; 494 | ball_was_shot = true; 495 | update_text = true; 496 | } 497 | } 498 | } 499 | if ((kDown | kHeld) & KEY_A && !ball_was_shot) { 500 | if (the_paddle.has_laser && !the_paddle.laser_on_screen) { 501 | the_paddle.the_laser.setDefaults(the_paddle.x + (the_paddle.width / 2.0) - (the_paddle.the_laser.width / 2.0), the_paddle.y, 3, 30, laserID); 502 | the_paddle.laser_on_screen = true; 503 | } 504 | } 505 | 506 | if (the_paddle.laser_on_screen) { 507 | the_paddle.the_laser.move(0, -8); 508 | int the_number = 30; 509 | int other_number = the_paddle.y - the_paddle.the_laser.y; 510 | if (other_number < the_number) the_number = other_number; 511 | for (int i = 0; i < the_number; i++) 512 | pp2d_draw_texture(the_paddle.the_laser.texture_id, the_paddle.the_laser.x, the_paddle.the_laser.y + i); 513 | for (int i = 0; i < 50; i++) 514 | if (test_collision(the_paddle.the_laser, brick_array[level][i]) && brick_array[level][i].exists) { 515 | brick_array[level][i].destroy(); 516 | the_paddle.laser_on_screen = false; 517 | } 518 | if (off_screen(the_paddle.the_laser)) the_paddle.laser_on_screen = false; 519 | } 520 | /*run main engine code if the ball is not attached to the paddle*/ 521 | for (auto &tBall : the_ball) { 522 | tBall.bricks_hit = 0; 523 | tBall.has_rotated_this_frame = false; 524 | } 525 | change_level = false; 526 | //main hit detection engine (runs 300 times per frame) 527 | for (int i = 0; i < (cMode ? O3DS_CHECKS : N3DS_CHECKS); i++) { 528 | for (auto &tBall : the_ball) { 529 | if (tBall.exists && !tBall.is_attached) { 530 | tBall.has_interacted = false; 531 | tBall.hasHitPadd = (the_paddle.getTop(false) <= tBall.getBottom(false) && (the_paddle.x <= tBall.x && tBall.x <= the_paddle.x + the_paddle.width)); //balls x coordinate is <= paddles x coordinate + it's width 532 | if (tBall.hasHitPadd && tBall.getBottom(false) >= the_paddle.getTop(false) + 0.02) tBall.hasHitPadd = false; 533 | if (tBall.hasHitPadd) tBall.has_hit_paddle = true; 534 | //Add gravity powerup (magnet but different) rotates around paddle until button pressed. 535 | tBall.hasHitWall = (tBall.getLeft(true) <= 0.00 || tBall.getRight(true) >= 400.00 || tBall.getTop(false) <= 0.00); 536 | if (tBall.hasHitWall) tBall.has_hit_wall = true; 537 | //first time ball is detected touching wall 538 | if (tBall.hasHitWall && !tBall.isInWall) { 539 | tBall.has_interacted = true; 540 | tBall.isInWall = true; 541 | tBall.angle = (tBall.getTop(false) <= 0.00) ? (360.0 - tBall.angle) : (180.0 - tBall.angle); 542 | } 543 | 544 | setAngleGood(tBall.angle); 545 | 546 | //first time ball is detected touching paddle 547 | if (tBall.hasHitPadd && !tBall.isInPaddle) { 548 | tBall.has_interacted = true; 549 | tBall.isInPaddle = true; 550 | double paddle_width_ninth = the_paddle.width / 9.0; 551 | int angle = 1; 552 | for (double z = 1.0; z < 9.0; z += 1.0) 553 | if (tBall.getBottom(true) >= the_paddle.x + (paddle_width_ninth * z)) 554 | angle += 1; 555 | //change ball angle according to the area of paddle hit 556 | double angle_of_change = 0.0; 557 | switch (angle) { 558 | case 4: angle_of_change -= 10.0; 559 | case 3: angle_of_change -= 10.0; 560 | case 2: angle_of_change -= 10.0; 561 | case 1: angle_of_change -= 10.0; 562 | break; 563 | case 9: angle_of_change += 10.0; 564 | case 8: angle_of_change += 10.0; 565 | case 7: angle_of_change += 10.0; 566 | case 6: angle_of_change += 10.0; 567 | break; 568 | } 569 | tBall.angle = (360.0 - tBall.angle) + angle_of_change; 570 | } 571 | //large if statement to determine if a brick has been hit (run once per brick) 572 | //bool hitV = false, hitH = false, hitBothSameTime = false; 573 | for (int j = 0; j < 50; j++) { 574 | setAngleGood(tBall.angle); 575 | if (test_collision(tBall, brick_array[level][j], false) || test_collision(tBall, brick_array[level][j], true)) { 576 | if (brick_array[level][j].exists) { 577 | brick_array[level][j].destroy(); 578 | if (!brick_array[level][j].exists) { 579 | points += brick_array[level][j].point_value(); 580 | last_power = brick_array[level][j].random_powerup(); 581 | if (last_power != 0) brick_array[level][j].spawn_powerup(last_power); 582 | } 583 | bool hitH = false, hitV = false; 584 | tBall.bricks_hit++; 585 | //if brick hit V and H reverse direction 586 | if (!tBall.inside_brick[j]) { 587 | /*if ((tBall.mask_x + tBall.mask_width < brick_array[level][j].x + (1 / (cMode ? O3DS_CHECKS : N3DS_CHECKS))) || 588 | (tBall.mask_x > brick_array[level][j].x + brick_array[level][j].width - (1 / (cMode ? O3DS_CHECKS : N3DS_CHECKS)))) 589 | hitV = true; 590 | else if ((tBall.mask_y + tBall.mask_height < brick_array[level][j].y + (1 / (cMode ? O3DS_CHECKS : N3DS_CHECKS))) || 591 | (tBall.mask_y > brick_array[level][j].y + brick_array[level][j].height - (1 / (cMode ? O3DS_CHECKS : N3DS_CHECKS)))) 592 | hitH = true;*/ 593 | if ((brick_array[level][j].e1(tBall.mid(true)) == tBall.mid(false)) || 594 | (brick_array[level][j].e2(tBall.mid(true)) == tBall.mid(false))) { 595 | hitH = true; 596 | hitV = true; 597 | } 598 | else if (((brick_array[level][j].e1(tBall.mid(true)) > tBall.mid(false) && brick_array[level][j].e4(tBall.mid(true)) > tBall.mid(false)) || 599 | (brick_array[level][j].e2(tBall.mid(true)) < tBall.mid(false) && brick_array[level][j].e3(tBall.mid(true)) < tBall.mid(false))) && 600 | (tBall.mid(false) < brick_array[level][j].y || tBall.mid(false) > brick_array[level][j].y + brick_array[level][j].height)) 601 | hitH = true; 602 | else if (((brick_array[level][j].e1(tBall.mid(true)) < tBall.mid(false) && brick_array[level][j].e2(tBall.mid(true)) > tBall.mid(false)) || 603 | (brick_array[level][j].e4(tBall.mid(true)) < tBall.mid(false) && brick_array[level][j].e3(tBall.mid(true)) > tBall.mid(false))) && 604 | (tBall.mid(true) < brick_array[level][j].x || tBall.mid(true) > brick_array[level][j].x + brick_array[level][j].width)) 605 | hitV = true; 606 | /*if ((tBall.mask_x + tBall.mask_width) - brick_array[level][j].x == (tBall.mask_y + tBall.mask_height) - brick_array[level][j].y) 607 | hitBothSameTime = true; 608 | else if (tBall.angle >= 0 && tBall.angle < 90) { 609 | if ((tBall.mask_y + tBall.mask_height) - brick_array[level][j].y < (tBall.mask_x + tBall.mask_width) - brick_array[level][j].x) 610 | hitH = true; 611 | else 612 | hitV = true; 613 | } 614 | else if (tBall.angle >= 90 && tBall.angle < 180) { 615 | if ((tBall.mask_y + tBall.mask_height) - brick_array[level][j].y < (brick_array[level][j].x + brick_array[level][j].width) - tBall.mask_x) 616 | hitH = true; 617 | else 618 | hitV = true; 619 | } 620 | else if (tBall.angle >= 180 && tBall.angle < 270) { 621 | if ((brick_array[level][j].x + brick_array[level][j].width) - tBall.mask_x < (brick_array[level][j].y + brick_array[level][j].height) - tBall.mask_y) 622 | hitH = true; 623 | else 624 | hitV = true; 625 | } 626 | else if (tBall.angle >= 270 && tBall.angle < 360) { 627 | if ((brick_array[level][j].y + brick_array[level][j].height) - tBall.mask_y < (tBall.mask_x + tBall.mask_width) - brick_array[level][j].x) 628 | hitH = true; 629 | else 630 | hitV = true; 631 | }*/ 632 | tBall.inside_brick[j] = true; 633 | } 634 | if (hitH && hitV) 635 | tBall.angle += 180.0; 636 | else if (hitH) 637 | tBall.angle = 360.0 - tBall.angle; 638 | else if (hitV) 639 | tBall.angle = 180.0 - tBall.angle; 640 | } 641 | } 642 | else 643 | tBall.inside_brick[j] = false; 644 | } 645 | /*if ((hitV || hitH) && tBall.has_rotated_this_frame == false) { 646 | if (hitV && hitH) 647 | tBall.angle += 180.0; 648 | else 649 | tBall.angle = (hitH ? 360.0 : 180.0) - tBall.angle; 650 | tBall.has_rotated_this_frame = true; 651 | }*/ 652 | setBallDirection(tBall, 2.0); 653 | if (tBall.hasHitPadd && tBall.isInPaddle) 654 | moveBall(tBall, cMode); 655 | else if (tBall.isInPaddle && !tBall.hasHitPadd) 656 | tBall.isInPaddle = false; 657 | if (tBall.hasHitWall && tBall.isInWall) 658 | moveBall(tBall, cMode); 659 | else if (tBall.isInWall && !tBall.hasHitWall) 660 | tBall.isInWall = false; 661 | if (!tBall.has_interacted && !tBall.hasHitPadd && !tBall.hasHitWall && !tBall.isInPaddle && !tBall.isInWall) moveBall(tBall, cMode); 662 | //if paddle and wall hit in same frame, ball is "crushed" (this could cause problems later) 663 | if (tBall.hasHitPadd && tBall.hasHitWall) tBall.exists = false; 664 | int bricks_available = 0; 665 | for (int brick_array_pos = 0; brick_array_pos < 50; brick_array_pos++) 666 | if (brick_array[level][brick_array_pos].exists && brick_array[level][brick_array_pos].type() != 11) 667 | bricks_available++; 668 | if (bricks_available == 0) change_level = true; 669 | } 670 | } 671 | } 672 | //either increase level, or go to win screen 673 | if (change_level == true) { 674 | if (level == def_level_count - 1) { 675 | int thanks_return; 676 | thanks_text_display = 0; 677 | do (thanks_return = thanks_for_playing_the_beta()); while (thanks_return == 0); 678 | return thanks_return; 679 | } 680 | else { 681 | level++; 682 | resetBalls(the_ball); 683 | the_paddle.reset(); 684 | } 685 | } 686 | //to avoid a glitch, if more than one brick is hit on the same frame the direction is reversed 687 | /*for (auto &tBall : the_ball) { 688 | if (tBall.bricks_hit > 1) { 689 | tBall.angle += 180.0; 690 | setAngleGood(tBall.angle); 691 | } 692 | }*/ 693 | 694 | /*plays random SFX if a brick has been hit*/ 695 | for (auto &tBall : the_ball) { 696 | if (tBall.bricks_hit > 0) { 697 | update_text = true; 698 | int which_bounce = rand() % 7; 699 | playSFX(ball_bounce[which_bounce]); 700 | } 701 | if (tBall.has_hit_paddle || tBall.has_hit_wall) playSFX(ball_bounce[7]); 702 | } 703 | 704 | trail_new_frame(the_ball); 705 | 706 | pp2d_begin_draw(GFX_TOP, GFX_LEFT); 707 | for (int i = 0; i < 50; i++) 708 | if (brick_array[level][i].has_powerup_on_screen) { 709 | brick_array[level][i].my_powerup.y += 1; 710 | if (off_screen(brick_array[level][i].my_powerup)) brick_array[level][i].has_powerup_on_screen = false; 711 | if (test_collision (brick_array[level][i].my_powerup, the_paddle)) { 712 | run_powerup(brick_array[level][i].my_powerup.type); 713 | brick_array[level][i].has_powerup_on_screen = false; 714 | } 715 | brick_array[level][i].draw(); 716 | } 717 | draw_object(the_paddle); 718 | for (int i = 0; i < 50; i++) 719 | if (brick_array[level][i].exists) { 720 | draw_object(brick_array[level][i]); 721 | for (double j = 0.0; j < brick_array[level][i].width; j += 1.0) { 722 | //pp2d_draw_texture(testID, brick_array[level][i].x + j, brick_array[level][i].e1(brick_array[level][i].x + j)); 723 | pp2d_draw_texture(testID, brick_array[level][i].x + j, brick_array[level][i].e2(brick_array[level][i].x + j)); 724 | //pp2d_draw_texture(testID, brick_array[level][i].x + j, brick_array[level][i].e3(brick_array[level][i].x + j)); 725 | pp2d_draw_texture(testID, brick_array[level][i].x + j, brick_array[level][i].e4(brick_array[level][i].x + j)); 726 | } 727 | } 728 | for (auto tBall : the_ball) 729 | for (int i = 7; i > 0; i--) 730 | pp2d_draw_texture_scale(extraBallID[i], (tBall.trail_circle[i].x - tBall.trail_circle[i].rad) + 1.0, (tBall.trail_circle[i].y - tBall.trail_circle[i].rad) + 2.0, (7 - i) / 8.0, (7 - i) / 8.0); //RGBA8(0xFF, 0xFF, 0xFF, 32 * (7 - i)) 731 | for (auto tBall : the_ball) 732 | draw_object(tBall); 733 | if (update_text) { 734 | std::cout << ANSI "13;0" PEND; 735 | for (int i = 0; i < 3; i++) std::cout << " "; 736 | std::cout << ANSI "13;0" PEND; 737 | std::cout << "Score: " << points << "\n" << "Lives: " << lives << "\n"; 738 | std::cout << "Collision being tested " << (cMode ? O3DS_CHECKS : N3DS_CHECKS) << "x/frame." << std::endl; 739 | std::cout << debug_string << std::endl; 740 | update_text = false; 741 | } 742 | pp2d_end_draw(); 743 | hidTouchRead(&touch); 744 | 745 | /*exit game if red box touched*/ 746 | if (touchInBox(touch, 0, 224, 320, 16)) { 747 | std::cout << "Exiting...\n"; 748 | return 2; 749 | } 750 | return 0; 751 | } 752 | 753 | /*win screen for the beta*/ 754 | int thanks_for_playing_the_beta() { 755 | hidScanInput(); 756 | kDown = hidKeysDown(); kHeld = hidKeysHeld(); 757 | if (kDown & (KEY_SELECT | KEY_A | KEY_B | KEY_X | KEY_Y | KEY_L | KEY_R | KEY_ZL | KEY_ZR)) return 2; 758 | if (kHeld & KEY_START) return 3; 759 | pp2d_begin_draw(GFX_TOP, GFX_LEFT); 760 | pp2d_draw_texture(thanksBetaID, 80, 20); 761 | /*run text display once (to avoid screen tear)*/ 762 | if (thanks_text_display == 0) { 763 | std::cout << ANSI "0;0" PEND; 764 | for (int i = 0; i < 30; i++) std::cout << " "; 765 | std::cout << ANSI "0;0" PEND; 766 | std::cout << "[Press any key to return to the title.]\n"; 767 | std::cout << "Thanks to:\n\n"; 768 | std::cout << "Jared for helping me " ANSI BRIGHT ASEP YELLOW CEND "Beta" CRESET " test.\n\n"; 769 | std::cout << ANSI YELLOW CEND "StackOverflow" CRESET " for helping me with " ANSI BRIGHT ASEP GREEN CEND "c++" CRESET "\n\n"; 770 | std::cout << "The awesome " ANSI RED CEND "3ds" CRESET " " ANSI BLUE CEND "homebrew" CRESET " community for\n"; 771 | std::cout << "helping me with many things relating to\n"; 772 | std::cout << ANSI BRIGHT ASEP BLUE CEND "libctru" CRESET " and " ANSI GREEN CEND "sf2dlib." CRESET "\n\n"; 773 | std::cout << "Bryan for helping me with programming\n\n"; 774 | std::cout << ANSI BRIGHT ASEP MAGENTA CEND "GBAtemp" CRESET " community for helping me with so"; 775 | std::cout << "much! You guys are so helpful.\n\n"; 776 | std::cout << "\n"; 777 | std::cout << " And " ANSI MAGENTA CEND "YOU" CRESET " for playing my game!\n"; 778 | std::cout << " And remember, all feedback and\n"; 779 | std::cout << " suggestions are welcome!\n"; 780 | thanks_text_display = 1; 781 | } 782 | pp2d_end_draw(); 783 | return 0; 784 | } 785 | 786 | /*extras: created 10/13/2017*/ 787 | int extras_10_13_2017() 788 | { 789 | consoleSelect(&bottomScreen); 790 | consoleClear(); 791 | std::cout << ANSI "0;0" PEND; 792 | for (int i = 0; i < 30; i++) std::cout << " "; 793 | std::cout << ANSI "0;0" PEND; 794 | std::cout << "The blue cracked brick was orginally\n"; 795 | std::cout << "going to be the design for the normal\n"; 796 | std::cout << "brick but I decided to instead save that"; 797 | std::cout << "for the future for bricks that take more"; 798 | std::cout << "than one hit.\n\n"; 799 | std::cout << "Future Gamemode: This idea came about\n"; 800 | std::cout << "when I'd thought about all the people I\n"; 801 | std::cout << "saw playing some new game on their\n"; 802 | std::cout << "phones. It's this game where you aim\n"; 803 | std::cout << "your ball, and it shoots out like 100\n"; 804 | std::cout << "balls. And all the bricks in the game\n"; 805 | std::cout << "take many hits, which is determined via\n"; 806 | std::cout << "a number displayed on the brick.\n"; 807 | std::cout << "So I figure I'll add this sometime.\n\n"; 808 | std::cout << "These new graphics and SFX aren't\n"; 809 | std::cout << "necessarily permanent. This update is\n"; 810 | std::cout << "more to show off that actual graphics\n"; 811 | std::cout << "and SFX can and have been added, and\n"; 812 | std::cout << "they may very well be changed and\n"; 813 | std::cout << "improved in the future, so if you don't\n"; 814 | std::cout << "like what's presented to you now, then\n"; 815 | std::cout << "don't worry because it can easily be\n"; 816 | std::cout << "changed and I'm always open to\n"; 817 | std::cout << "suggestions!\n"; 818 | /*main loop with pp2d drawing*/ 819 | while (true) 820 | { 821 | pp2d_begin_draw(GFX_TOP, GFX_LEFT); 822 | pp2d_draw_texture_scale(0, 20, 20, 2.0, 2.0); 823 | pp2d_draw_texture(paddleID, 350, 110); 824 | pp2d_draw_texture(waveformID, 40, 97); 825 | hidScanInput(); 826 | kDown = hidKeysDown(); 827 | if (kDown & (KEY_SELECT | KEY_A | KEY_B | KEY_X | KEY_Y | KEY_L | KEY_R | KEY_ZL | KEY_ZR | KEY_START)) break; 828 | pp2d_end_draw(); 829 | } 830 | if (kDown & (KEY_SELECT | KEY_A | KEY_B | KEY_X | KEY_Y | KEY_L | KEY_R | KEY_ZL | KEY_ZR)) return 2; 831 | if (kDown & KEY_START) return 3; 832 | return 4; 833 | } 834 | 835 | /*level designer*/ 836 | int level_designer() { 837 | int selection = 0; 838 | bool quit = false; 839 | consoleSelect(&bottomScreen); 840 | consoleClear(); 841 | std::cout << CRESET; 842 | std::cout << ANSI "5;15" PEND ANSI WHITE CEND; 843 | std::cout << "Save Level 1" CRESET; 844 | for (int i = 1; i < SAVE_FILES; i++) { 845 | int value_a = (5 + (i * 2)); 846 | int value_b = (i + 1); 847 | std::string part_1 = ANSI + std::to_string(value_a) + ";15" PEND; 848 | std::cout << part_1 << ANSI WHITE ASEP BRIGHT CEND; 849 | std::cout << "Save Level " << std::to_string(value_b) << CRESET; 850 | } 851 | while (true) { 852 | hidScanInput(); 853 | kDown = hidKeysDown(); 854 | if ((kDown & KEY_UP) && selection > 0) selection--; 855 | if ((kDown & KEY_DOWN) && selection < SAVE_FILES - 1) selection++; 856 | if (kDown & (KEY_UP | KEY_DOWN)) { 857 | std::cout << CRESET; 858 | for (int i = 0; i < SAVE_FILES; i++) { 859 | int value_a = ((5 + (i * 2)) - 1); 860 | std::string part_1 = ANSI + std::to_string(value_a) + ";15" PEND; 861 | int value_b = value_a + 1; 862 | std::string part_2 = ANSI + std::to_string(value_b) + ";15" PEND; 863 | std::cout << part_1 << CRESET << part_2; 864 | if (selection == i) 865 | std::cout << ANSI WHITE CEND; 866 | else 867 | std::cout << ANSI WHITE ASEP BRIGHT CEND; 868 | int value_c = i + 1; 869 | std::cout << "Save Level " << std::to_string(value_c) << CRESET; 870 | } 871 | } 872 | if (kDown & KEY_A) break; 873 | if (kDown & (KEY_B | KEY_START)) { 874 | quit = true; 875 | break; 876 | } 877 | hidTouchRead(&touch); 878 | bool touched = false; 879 | for (int i = 0; i < SAVE_FILES; i++) { 880 | if (touchInBox(touch, 112, 32 + (16 * i), 96, 8)) { 881 | selection = i; 882 | touched = true; 883 | } 884 | } 885 | if (touched) break; 886 | gspWaitForVBlank(); 887 | } 888 | if (quit) return 0; 889 | int current_spot = 0; 890 | bool refresh_screen = true; 891 | while (true) { 892 | pp2d_begin_draw(GFX_TOP, GFX_LEFT); 893 | int array_step = 0; 894 | for (int a = 0; a < 5; a++) 895 | for (int b = 0; b < 10; b++) 896 | { 897 | if (!designed_level[selection][array_step] == 0) pp2d_draw_texture(brick_texture_by_type[designed_level[selection][array_step]], (40 * b) + 2, (20 * a) + 2); 898 | if (array_step == current_spot) pp2d_draw_texture(ball00ID, (40 * b) + 20, (20 * a) + 8); 899 | array_step++; 900 | } 901 | pp2d_end_draw(); 902 | hidScanInput(); 903 | kDown = hidKeysDown(); 904 | if (kDown & KEY_UP && current_spot >= 10) current_spot -= 10; 905 | if (kDown & KEY_DOWN && current_spot <= 39) current_spot += 10; 906 | if (kDown & KEY_LEFT && current_spot > 0) current_spot--; 907 | if (kDown & KEY_RIGHT && current_spot < 49) current_spot++; 908 | if (kDown & KEY_R) { 909 | if (designed_level[selection][current_spot] == (brick_types - 1)) 910 | designed_level[selection][current_spot] = 0; 911 | else 912 | designed_level[selection][current_spot]++; 913 | } 914 | if (kDown & KEY_L) { 915 | if (designed_level[selection][current_spot] == 0) 916 | designed_level[selection][current_spot] = (brick_types - 1); 917 | else 918 | designed_level[selection][current_spot]--; 919 | } 920 | if (kDown & (KEY_START | KEY_B)) break; 921 | if (kDown & KEY_X) { 922 | save_level(selection); 923 | refresh_screen = true; 924 | } 925 | if (kDown & KEY_Y) { 926 | //randomize level 927 | std::cout << "Are you sure?\nPress A to randomize level\nPress B to cancel\n"; 928 | while (true) { 929 | hidScanInput(); 930 | kDown = hidKeysDown(); 931 | if (kDown & KEY_A) 932 | { 933 | for (int i = 0; i < 50; i++) 934 | { 935 | int chance_block_type = rand() % 3; 936 | int chance_type_more = rand() % 5; 937 | if (chance_block_type == 0) designed_level[selection][i] = 0; 938 | if (chance_block_type == 1) designed_level[selection][i] = chance_type_more + 1; 939 | if (chance_block_type == 2) designed_level[selection][i] = chance_type_more + 6; 940 | } 941 | break; 942 | } 943 | if (kDown & KEY_B) break; 944 | gspWaitForVBlank(); 945 | } 946 | } 947 | if (kDown & KEY_SELECT) { 948 | for (int i = 0; i < 50; i++) 949 | level_mask[0][i] = designed_level[selection][i]; 950 | initialize_brick_array(); 951 | lives = 3; 952 | int result = 3; 953 | resetBalls(the_ball); 954 | the_paddle.reset(); 955 | for (int i = 0; i < def_level_count; i++) 956 | for (int j = 0; j < 50; j++) 957 | brick_array[i][j].reset(); 958 | level = 0; points = 0; last_power = 0; 959 | times_power_1 = 0; times_power_2 = 0; times_power_3 = 0; 960 | for (auto &tBall : the_ball) 961 | tBall.is_attached = true; 962 | /*main breakout loop*/ 963 | while (true) { 964 | result = breakout(); 965 | if (result != 0) break; 966 | } 967 | if (result == 3) break; 968 | } 969 | if (kDown & (KEY_L | KEY_R)) refresh_screen = true; 970 | if (refresh_screen) { 971 | consoleClear(); 972 | std::cout << CRESET ANSI "0;0" PEND ANSI WHITE CEND; 973 | for (int i = 0; i < 30; i++) std::cout << " "; 974 | std::cout << ANSI "0;0" PEND; 975 | std::cout << "Levellayout:\n"; 976 | for (int a = 0; a < 5; a++) { 977 | for (int b = 0; b < 10; b++) { 978 | if (designed_level[selection][b + (a * 10)] > 9) 979 | std::cout << designed_level[selection][b + (a * 10)]; 980 | else 981 | std::cout << " " << designed_level[selection][b + (a * 10)]; 982 | if (b < 9) std::cout << ", "; 983 | } 984 | std::cout << "\n"; 985 | } 986 | std::cout << " Press X to save level."; 987 | std::cout << " Press B or Start to return to title."; 988 | std::cout << " Press Select to play your level!"; 989 | refresh_screen = false; 990 | } 991 | } 992 | return 0; 993 | } 994 | 995 | /*save designed level*/ 996 | int save_level(int selection) { 997 | std::cout << "Are you sure you want to save this?\n"; 998 | std::cout << "A to save B to return"; 999 | while (true) { 1000 | hidScanInput(); 1001 | kDown = hidKeysDown(); 1002 | if (kDown & KEY_B) break; 1003 | if (kDown & KEY_A) { 1004 | fclose(saved_level[selection]); 1005 | remove(saved_level_filename[selection].c_str()); 1006 | saved_level[selection] = fopen(saved_level_filename[selection].c_str(), "w"); 1007 | for (int i = 0; i < 50; i++) fprintf(saved_level[selection], "%d\n", designed_level[selection][i]); 1008 | fclose(saved_level[selection]); 1009 | saved_level[selection] = fopen(saved_level_filename[selection].c_str(), "r"); 1010 | break; 1011 | } 1012 | } 1013 | return 0; 1014 | } -------------------------------------------------------------------------------- /Breakout/source/audio/filesystem.cpp: -------------------------------------------------------------------------------- 1 | //shamelessly grabbed from Smealum's portal3DS 2 | //https://github.com/smealum/portal3DS 3 | 4 | #include 5 | #include 6 | #include 7 | #include <3ds.h> 8 | #include "audio/filesystem.h" 9 | 10 | 11 | FILE* openFile(const char* fn, const char* mode) 12 | { 13 | if (!fn || !mode)return NULL; 14 | return fopen(fn, mode); 15 | } 16 | 17 | void* bufferizeFile(const char* filename, u32* size, bool binary, bool linear) 18 | { 19 | FILE* file; 20 | 21 | if (!binary)file = openFile(filename, "r"); 22 | else file = openFile(filename, "rb"); 23 | 24 | if (!file) return NULL; 25 | 26 | u8* buffer; 27 | long lsize; 28 | fseek(file, 0, SEEK_END); 29 | lsize = ftell(file); 30 | rewind(file); 31 | if (linear)buffer = (u8*)linearMemAlign(lsize, 0x80); 32 | else buffer = (u8*)malloc(lsize); 33 | if (size)*size = lsize; 34 | 35 | if (!buffer) 36 | { 37 | fclose(file); 38 | return NULL; 39 | } 40 | 41 | fread(buffer, 1, lsize, file); 42 | fclose(file); 43 | return buffer; 44 | } -------------------------------------------------------------------------------- /Breakout/source/audio/sfx.cpp: -------------------------------------------------------------------------------- 1 | //shamelessly grabbed from Smealum's portal3DS 2 | //https://github.com/smealum/portal3DS 3 | 4 | 5 | #include 6 | #include 7 | #include <3ds.h> 8 | #include "audio/sfx.h" 9 | #include "audio/filesystem.h" 10 | 11 | SFX_s SFX[NUMSFX]; 12 | 13 | bool soundEnabled; 14 | 15 | void initSound() 16 | { 17 | int i; 18 | for (i = 0; idata = NULL; 50 | s->size = 0; 51 | s->used = true; 52 | } 53 | 54 | void loadSFX(SFX_s* s, const char* filename, u32 format) 55 | { 56 | if (!s)return; 57 | 58 | initSFX(s); 59 | 60 | s->data = (u8*)bufferizeFile(filename, &s->size, true, true); 61 | s->format = format; 62 | } 63 | 64 | SFX_s* createSFX(const char* filename, u32 format) 65 | { 66 | int i; 67 | for (i = 0; iused || !s->data || !soundEnabled)return; 85 | 86 | channel++; 87 | channel %= 7; 88 | 89 | csndPlaySound(channel + 8, s->format, 22050, 1.0, 0.0, (u32*)s->data, (u32*)s->data, s->size); 90 | } 91 | 92 | void playMSC(SFX_s* s) 93 | { 94 | // CSND_SetPlayState(15, 0);//Stop music audio playback. 95 | // csndExecCmds(0); 96 | if (!s || !s->used || !s->data || !soundEnabled)return; 97 | csndPlaySound(15, s->format | SOUND_REPEAT, 22050, 1.0, 0.0, (u32*)s->data, (u32*)s->data, s->size); 98 | } 99 | 100 | void stopSFX(void) 101 | { 102 | int i; 103 | for (i = 0; i<7; i++) 104 | CSND_SetPlayState(8 + i, 0);//Stop music audio playback. 105 | csndExecCmds(0); 106 | } 107 | 108 | void stopMSC(void) 109 | { 110 | CSND_SetPlayState(15, 0);//Stop music audio playback. 111 | csndExecCmds(0); 112 | } -------------------------------------------------------------------------------- /Breakout/source/draw.cpp: -------------------------------------------------------------------------------- 1 | #include "Breakout.hpp" 2 | #include "objects.hpp" 3 | #include "draw.hpp" 4 | 5 | void draw_object(ball &ball_to_draw) { 6 | pp2d_draw_texture(ball_to_draw.texture_id, ball_to_draw.getLeft(true), ball_to_draw.getTop(false)); 7 | } 8 | -------------------------------------------------------------------------------- /Breakout/source/file/file_access.cpp: -------------------------------------------------------------------------------- 1 | #include "Breakout.hpp" 2 | #include "file/file_access.hpp" 3 | 4 | void create_save_files(int setup_type) { 5 | for (int i = 0; i < SAVE_FILES; i++) 6 | saved_level_filename[i] = "sdmc:/3ds/breakout_level_" + std::to_string(i) + ".bsl"; 7 | if (setup_type == 0) { 8 | rename("sdmc:/3ds/breakout_level.bsl", "sdmc:/3ds/breakout_level_0.bsl"); 9 | for (int i = 1; i < SAVE_FILES; i++) { 10 | saved_level[i] = fopen(saved_level_filename[i].c_str(), "w"); 11 | fprintf(saved_level[i], "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "); 12 | fclose(saved_level[i]); 13 | } 14 | } 15 | if (setup_type == 1) { 16 | for (int i = 0; i < SAVE_FILES; i++) { 17 | saved_level[i] = fopen(saved_level_filename[i].c_str(), "w"); 18 | fprintf(saved_level[i], "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "); 19 | fclose(saved_level[i]); 20 | } 21 | } 22 | } 23 | 24 | void load_save_files() { 25 | for (int i = 0; i < SAVE_FILES; i++) 26 | saved_level_filename[i] = "sdmc:/3ds/breakout_level_" + std::to_string(i) + ".bsl"; 27 | for (int i = 0; i < SAVE_FILES; i++) { 28 | saved_level[i] = fopen(saved_level_filename[i].c_str(), "r"); 29 | for (int j = 0; j < 50; j++) 30 | fscanf(saved_level[i], "%d ", &designed_level[i][j]); 31 | } 32 | } -------------------------------------------------------------------------------- /Breakout/source/gfx/pp2d.c: -------------------------------------------------------------------------------- 1 | #include "gfx/pp2d.h" 2 | 3 | static DVLB_s* vshader_dvlb; 4 | static shaderProgram_s program; 5 | static int uLoc_projection; 6 | static C3D_Mtx projectionTopLeft; 7 | static C3D_Mtx projectionTopRight; 8 | static C3D_Mtx projectionBot; 9 | static C3D_Tex* glyphSheets; 10 | static textVertex_s* textVtxArray; 11 | static int textVtxArrayPos; 12 | static C3D_RenderTarget* topLeft; 13 | static C3D_RenderTarget* topRight; 14 | static C3D_RenderTarget* bot; 15 | 16 | static struct { 17 | size_t id; 18 | int x; 19 | int y; 20 | int xbegin; 21 | int ybegin; 22 | int width; 23 | int height; 24 | u32 color; 25 | flipType fliptype; 26 | float scaleX; 27 | float scaleY; 28 | float angle; 29 | float depth; 30 | bool initialized; 31 | } textureData; 32 | 33 | static struct { 34 | C3D_Tex tex; 35 | u32 width; 36 | u32 height; 37 | bool allocated; 38 | } textures[MAX_TEXTURES]; 39 | 40 | static struct { 41 | size_t id; 42 | int startIndex; 43 | bool succeeded; 44 | } fastData; 45 | 46 | static void pp2d_add_text_vertex(float vx, float vy, float vz, float tx, float ty); 47 | static bool pp2d_fast_draw_vbo(int x, int y, int height, int width, float left, float right, float top, float bottom, float depth); 48 | static u32 pp2d_get_next_pow2(u32 n); 49 | static void pp2d_get_text_size_internal(float* width, float* height, float scaleX, float scaleY, int wrapX, const char* text); 50 | static void pp2d_set_text_color(u32 color); 51 | 52 | static void pp2d_add_text_vertex(float vx, float vy, float vz, float tx, float ty) 53 | { 54 | textVertex_s* vtx = &textVtxArray[textVtxArrayPos++]; 55 | vtx->position[0] = vx; 56 | vtx->position[1] = vy; 57 | vtx->position[2] = vz; 58 | vtx->texcoord[0] = tx; 59 | vtx->texcoord[1] = ty; 60 | } 61 | 62 | void pp2d_begin_draw(gfxScreen_t target, gfx3dSide_t side) 63 | { 64 | C3D_FrameBegin(C3D_FRAME_SYNCDRAW); 65 | textVtxArrayPos = 0; 66 | pp2d_draw_on(target, side); 67 | } 68 | 69 | void pp2d_draw_on(gfxScreen_t target, gfx3dSide_t side) 70 | { 71 | if(target == GFX_TOP) { 72 | C3D_FrameDrawOn(side == GFX_LEFT ? topLeft : topRight); 73 | C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, side == GFX_LEFT ? &projectionTopLeft : &projectionTopRight); 74 | } else { 75 | C3D_FrameDrawOn(bot); 76 | C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, &projectionBot); 77 | } 78 | } 79 | 80 | void pp2d_draw_rectangle(int x, int y, int width, int height, u32 color) 81 | { 82 | C3D_TexEnv* env = C3D_GetTexEnv(0); 83 | C3D_TexEnvSrc(env, C3D_Both, GPU_CONSTANT, GPU_CONSTANT, 0); 84 | C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); 85 | C3D_TexEnvFunc(env, C3D_Both, GPU_MODULATE); 86 | C3D_TexEnvColor(env, color); 87 | 88 | if (pp2d_fast_draw_vbo(x, y, height, width, 0, 0, 0, 0, DEFAULT_DEPTH)) 89 | { 90 | C3D_DrawArrays(GPU_TRIANGLE_STRIP, textVtxArrayPos - 4, 4); 91 | } 92 | } 93 | 94 | void pp2d_draw_text(float x, float y, float scaleX, float scaleY, u32 color, const char* text) 95 | { 96 | pp2d_draw_text_wrap(x, y, scaleX, scaleY, color, -1, text); 97 | } 98 | 99 | void pp2d_draw_text_center(gfxScreen_t target, float y, float scaleX, float scaleY, u32 color, const char* text) 100 | { 101 | float width = pp2d_get_text_width(text, scaleX, scaleY); 102 | float x = ((target == GFX_TOP ? TOP_WIDTH : BOTTOM_WIDTH) - width) / 2; 103 | pp2d_draw_text(x, y, scaleX, scaleY, color, text); 104 | } 105 | 106 | void pp2d_draw_textf(float x, float y, float scaleX, float scaleY, u32 color, const char* text, ...) 107 | { 108 | char buffer[256]; 109 | va_list args; 110 | va_start(args, text); 111 | vsnprintf(buffer, 256, text, args); 112 | pp2d_draw_text(x, y, scaleX, scaleY, color, buffer); 113 | va_end(args); 114 | } 115 | 116 | void pp2d_draw_text_wrap(float x, float y, float scaleX, float scaleY, u32 color, float wrapX, const char* text) 117 | { 118 | if (text == NULL) 119 | return; 120 | 121 | pp2d_set_text_color(color); 122 | 123 | ssize_t units; 124 | uint32_t code; 125 | const uint8_t* p = (const uint8_t*)text; 126 | float firstX = x; 127 | int lastSheet = -1; 128 | 129 | do 130 | { 131 | if (!*p) break; 132 | units = decode_utf8(&code, p); 133 | if (units == -1) 134 | break; 135 | p += units; 136 | if (code == '\n' || (wrapX != -1 && x + scaleX * fontGetCharWidthInfo(fontGlyphIndexFromCodePoint(code))->charWidth >= firstX + wrapX)) 137 | { 138 | x = firstX; 139 | y += scaleY*fontGetInfo()->lineFeed; 140 | p -= code == '\n' ? 0 : 1; 141 | } 142 | else if (code > 0) 143 | { 144 | int glyphIdx = fontGlyphIndexFromCodePoint(code); 145 | fontGlyphPos_s data; 146 | fontCalcGlyphPos(&data, glyphIdx, GLYPH_POS_CALC_VTXCOORD, scaleX, scaleY); 147 | 148 | if (data.sheetIndex != lastSheet) 149 | { 150 | lastSheet = data.sheetIndex; 151 | C3D_TexBind(0, &glyphSheets[lastSheet]); 152 | } 153 | 154 | if ((textVtxArrayPos+4) >= TEXT_VTX_ARRAY_COUNT) 155 | break; 156 | 157 | pp2d_add_text_vertex(x+data.vtxcoord.left, y+data.vtxcoord.bottom, DEFAULT_DEPTH, data.texcoord.left, data.texcoord.bottom); 158 | pp2d_add_text_vertex(x+data.vtxcoord.right, y+data.vtxcoord.bottom, DEFAULT_DEPTH, data.texcoord.right, data.texcoord.bottom); 159 | pp2d_add_text_vertex(x+data.vtxcoord.left, y+data.vtxcoord.top, DEFAULT_DEPTH, data.texcoord.left, data.texcoord.top); 160 | pp2d_add_text_vertex(x+data.vtxcoord.right, y+data.vtxcoord.top, DEFAULT_DEPTH, data.texcoord.right, data.texcoord.top); 161 | 162 | C3D_DrawArrays(GPU_TRIANGLE_STRIP, textVtxArrayPos - 4, 4); 163 | 164 | x += data.xAdvance; 165 | } 166 | } while (code > 0); 167 | } 168 | 169 | void pp2d_draw_texture(size_t id, int x, int y) 170 | { 171 | pp2d_texture_select(id, x, y); 172 | pp2d_texture_draw(); 173 | } 174 | 175 | void pp2d_draw_texture_blend(size_t id, int x, int y, u32 color) 176 | { 177 | pp2d_texture_select(id, x, y); 178 | pp2d_texture_blend(color); 179 | pp2d_texture_draw(); 180 | } 181 | 182 | void pp2d_draw_texture_flip(size_t id, int x, int y, flipType fliptype) 183 | { 184 | pp2d_texture_select(id, x, y); 185 | pp2d_texture_flip(fliptype); 186 | pp2d_texture_draw(); 187 | } 188 | 189 | void pp2d_draw_texture_rotate(size_t id, int x, int y, float angle) 190 | { 191 | pp2d_texture_select(id, x, y); 192 | pp2d_texture_rotate(angle); 193 | pp2d_texture_draw(); 194 | } 195 | 196 | void pp2d_draw_texture_scale(size_t id, int x, int y, float scaleX, float scaleY) 197 | { 198 | pp2d_texture_select(id, x, y); 199 | pp2d_texture_scale(scaleX, scaleY); 200 | pp2d_texture_draw(); 201 | } 202 | 203 | void pp2d_draw_texture_part(size_t id, int x, int y, int xbegin, int ybegin, int width, int height) 204 | { 205 | pp2d_texture_select_part(id, x, y, xbegin, ybegin, width, height); 206 | pp2d_texture_draw(); 207 | } 208 | 209 | void pp2d_draw_wtext(float x, float y, float scaleX, float scaleY, u32 color, const wchar_t* text) 210 | { 211 | pp2d_draw_wtext_wrap(x, y, scaleX, scaleY, color, -1, text); 212 | } 213 | 214 | void pp2d_draw_wtext_center(gfxScreen_t target, float y, float scaleX, float scaleY, u32 color, const wchar_t* text) 215 | { 216 | float width = pp2d_get_wtext_width(text, scaleX, scaleY); 217 | float x = ((target == GFX_TOP ? TOP_WIDTH : BOTTOM_WIDTH) - width) / 2; 218 | pp2d_draw_wtext(x, y, scaleX, scaleY, color, text); 219 | } 220 | 221 | void pp2d_draw_wtext_wrap(float x, float y, float scaleX, float scaleY, u32 color, float wrapX, const wchar_t* text) 222 | { 223 | if (text == NULL) 224 | return; 225 | 226 | u32 size = wcslen(text) * sizeof(wchar_t); 227 | char buf[size]; 228 | memset(buf, 0, size); 229 | utf32_to_utf8((uint8_t*)buf, (uint32_t*)text, size); 230 | buf[size - 1] = '\0'; 231 | 232 | pp2d_draw_text_wrap(x, y, scaleX, scaleY, color, wrapX, buf); 233 | } 234 | 235 | void pp2d_draw_wtextf(float x, float y, float scaleX, float scaleY, u32 color, const wchar_t* text, ...) 236 | { 237 | wchar_t buffer[256]; 238 | va_list args; 239 | va_start(args, text); 240 | vswprintf(buffer, 256, text, args); 241 | pp2d_draw_wtext(x, y, scaleX, scaleY, color, buffer); 242 | va_end(args); 243 | } 244 | 245 | void pp2d_end_draw(void) 246 | { 247 | C3D_FrameEnd(0); 248 | } 249 | 250 | void pp2d_exit(void) 251 | { 252 | for (size_t id = 0; id < MAX_TEXTURES; id++) 253 | { 254 | pp2d_free_texture(id); 255 | } 256 | 257 | linearFree(textVtxArray); 258 | free(glyphSheets); 259 | 260 | shaderProgramFree(&program); 261 | DVLB_Free(vshader_dvlb); 262 | 263 | C3D_Fini(); 264 | gfxExit(); 265 | } 266 | 267 | void pp2d_fast_draw_init(size_t id) 268 | { 269 | fastData.startIndex = textVtxArrayPos; 270 | fastData.id = id; 271 | fastData.succeeded = false; 272 | 273 | C3D_TexBind(0, &textures[id].tex); 274 | C3D_TexEnv* env = C3D_GetTexEnv(0); 275 | C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE0, GPU_CONSTANT, 0); 276 | C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); 277 | C3D_TexEnvFunc(env, C3D_Both, GPU_MODULATE); 278 | C3D_TexEnvColor(env, PP2D_NEUTRAL); 279 | } 280 | 281 | void pp2d_fast_draw_texture(int x, int y) 282 | { 283 | size_t id = fastData.id; 284 | if (id >= MAX_SPRITES) 285 | return; 286 | 287 | fastData.succeeded = pp2d_fast_draw_vbo(x, y, 288 | textures[id].height, textures[id].width, 289 | 0.0f, (float)textures[id].width / (float)textures[id].tex.width, 290 | 1.0f, (float)(textures[id].tex.height - textures[id].height) / (float)textures[id].tex.height, 291 | DEFAULT_DEPTH 292 | ); 293 | } 294 | 295 | void pp2d_fast_draw_texture_part(int x, int y, int xbegin, int ybegin, int width, int height) 296 | { 297 | size_t id = fastData.id; 298 | if (id >= MAX_SPRITES) 299 | return; 300 | 301 | fastData.succeeded = pp2d_fast_draw_vbo(x, y, 302 | height, width, 303 | (float)xbegin / (float)textures[id].tex.width, (float)(xbegin + width) / (float)textures[id].tex.width, 304 | (float)(textures[id].tex.height - ybegin) / (float)textures[id].tex.height, (float)(textures[id].tex.height - ybegin - height) / (float)textures[id].tex.height, 305 | DEFAULT_DEPTH 306 | ); 307 | } 308 | 309 | static bool pp2d_fast_draw_vbo(int x, int y, int height, int width, float left, float right, float top, float bottom, float depth) 310 | { 311 | if ((textVtxArrayPos+4) >= TEXT_VTX_ARRAY_COUNT) 312 | return false; 313 | 314 | pp2d_add_text_vertex( x, y + height, depth, left, bottom); 315 | pp2d_add_text_vertex(x + width, y + height, depth, right, bottom); 316 | pp2d_add_text_vertex( x, y, depth, left, top); 317 | pp2d_add_text_vertex(x + width, y, depth, right, top); 318 | 319 | return true; 320 | } 321 | 322 | void pp2d_fast_render(void) 323 | { 324 | if (fastData.succeeded) 325 | { 326 | C3D_DrawArrays(GPU_TRIANGLE_STRIP, fastData.startIndex, textVtxArrayPos - fastData.startIndex); 327 | } 328 | 329 | fastData.succeeded = false; 330 | fastData.startIndex = -1; 331 | } 332 | 333 | void pp2d_free_texture(size_t id) 334 | { 335 | if (id >= MAX_TEXTURES) 336 | return; 337 | 338 | if (!textures[id].allocated) 339 | return; 340 | 341 | C3D_TexDelete(&textures[id].tex); 342 | textures[id].width = 0; 343 | textures[id].height = 0; 344 | textures[id].allocated = false; 345 | } 346 | 347 | Result pp2d_init(void) 348 | { 349 | Result res = 0; 350 | 351 | gfxInitDefault(); 352 | C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); 353 | 354 | topLeft = C3D_RenderTargetCreate(SCREEN_HEIGHT, TOP_WIDTH, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8); 355 | C3D_RenderTargetSetClear(topLeft, C3D_CLEAR_ALL, BACKGROUND_COLOR, 0); 356 | C3D_RenderTargetSetOutput(topLeft, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS); 357 | 358 | topRight = C3D_RenderTargetCreate(SCREEN_HEIGHT, TOP_WIDTH, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8); 359 | C3D_RenderTargetSetClear(topRight, C3D_CLEAR_ALL, BACKGROUND_COLOR, 0); 360 | C3D_RenderTargetSetOutput(topRight, GFX_TOP, GFX_RIGHT, DISPLAY_TRANSFER_FLAGS); 361 | 362 | bot = C3D_RenderTargetCreate(SCREEN_HEIGHT, BOTTOM_WIDTH, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8); 363 | C3D_RenderTargetSetClear(bot, C3D_CLEAR_ALL, BACKGROUND_COLOR, 0); 364 | C3D_RenderTargetSetOutput(bot, GFX_BOTTOM, GFX_LEFT, DISPLAY_TRANSFER_FLAGS); 365 | 366 | res = fontEnsureMapped(); 367 | if (R_FAILED(res)) 368 | return res; 369 | 370 | #ifdef BUILDTOOLS 371 | vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_len); 372 | #else 373 | vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size); 374 | #endif 375 | 376 | shaderProgramInit(&program); 377 | shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]); 378 | C3D_BindProgram(&program); 379 | 380 | uLoc_projection = shaderInstanceGetUniformLocation(program.vertexShader, "projection"); 381 | 382 | C3D_AttrInfo* attrInfo = C3D_GetAttrInfo(); 383 | AttrInfo_Init(attrInfo); 384 | AttrInfo_AddLoader(attrInfo, 0, GPU_FLOAT, 3); 385 | AttrInfo_AddLoader(attrInfo, 1, GPU_FLOAT, 2); 386 | 387 | Mtx_OrthoTilt(&projectionTopLeft, 0, TOP_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, true); 388 | Mtx_OrthoTilt(&projectionTopRight, 0, TOP_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, true); 389 | Mtx_OrthoTilt(&projectionBot, 0, BOTTOM_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, true); 390 | 391 | C3D_DepthTest(true, GPU_GEQUAL, GPU_WRITE_ALL); 392 | 393 | int i; 394 | TGLP_s* glyphInfo = fontGetGlyphInfo(); 395 | glyphSheets = malloc(sizeof(C3D_Tex)*glyphInfo->nSheets); 396 | for (i = 0; i < glyphInfo->nSheets; i ++) 397 | { 398 | C3D_Tex* tex = &glyphSheets[i]; 399 | tex->data = fontGetGlyphSheetTex(i); 400 | tex->fmt = glyphInfo->sheetFmt; 401 | tex->size = glyphInfo->sheetSize; 402 | tex->width = glyphInfo->sheetWidth; 403 | tex->height = glyphInfo->sheetHeight; 404 | tex->param = GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR) 405 | | GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE); 406 | tex->border = 0; 407 | tex->lodParam = 0; 408 | } 409 | 410 | textVtxArray = (textVertex_s*)linearAlloc(sizeof(textVertex_s)*TEXT_VTX_ARRAY_COUNT); 411 | C3D_BufInfo* bufInfo = C3D_GetBufInfo(); 412 | BufInfo_Init(bufInfo); 413 | BufInfo_Add(bufInfo, textVtxArray, sizeof(textVertex_s), 2, 0x10); 414 | 415 | return 0; 416 | } 417 | 418 | static u32 pp2d_get_next_pow2(u32 v) 419 | { 420 | v--; 421 | v |= v >> 1; 422 | v |= v >> 2; 423 | v |= v >> 4; 424 | v |= v >> 8; 425 | v |= v >> 16; 426 | v++; 427 | return v >= 64 ? v : 64; 428 | } 429 | 430 | float pp2d_get_text_height(const char* text, float scaleX, float scaleY) 431 | { 432 | float height; 433 | pp2d_get_text_size_internal(NULL, &height, scaleX, scaleY, -1, text); 434 | return height; 435 | } 436 | 437 | float pp2d_get_text_height_wrap(const char* text, float scaleX, float scaleY, int wrapX) 438 | { 439 | float height; 440 | pp2d_get_text_size_internal(NULL, &height, scaleX, scaleY, wrapX, text); 441 | return height; 442 | } 443 | 444 | void pp2d_get_text_size(float* width, float* height, float scaleX, float scaleY, const char* text) 445 | { 446 | pp2d_get_text_size_internal(width, height, scaleX, scaleY, -1, text); 447 | } 448 | 449 | static void pp2d_get_text_size_internal(float* width, float* height, float scaleX, float scaleY, int wrapX, const char* text) 450 | { 451 | float w = 0.0f; 452 | float h = 0.0f; 453 | 454 | ssize_t units; 455 | uint32_t code; 456 | float x = 0; 457 | float firstX = x; 458 | const uint8_t* p = (const uint8_t*)text; 459 | 460 | do 461 | { 462 | if (!*p) break; 463 | units = decode_utf8(&code, p); 464 | if (units == -1) 465 | break; 466 | p += units; 467 | if (code == '\n' || (wrapX != -1 && x + scaleX * fontGetCharWidthInfo(fontGlyphIndexFromCodePoint(code))->charWidth >= firstX + wrapX)) 468 | { 469 | x = firstX; 470 | h += scaleY*fontGetInfo()->lineFeed; 471 | p -= code == '\n' ? 0 : 1; 472 | } 473 | else if (code > 0) 474 | { 475 | float len = (scaleX * fontGetCharWidthInfo(fontGlyphIndexFromCodePoint(code))->charWidth); 476 | w += len; 477 | x += len; 478 | } 479 | } while (code > 0); 480 | 481 | if (width) 482 | { 483 | *width = w; 484 | } 485 | 486 | if (height) 487 | { 488 | h += scaleY*fontGetInfo()->lineFeed; 489 | *height = h; 490 | } 491 | } 492 | 493 | float pp2d_get_text_width(const char* text, float scaleX, float scaleY) 494 | { 495 | float width; 496 | pp2d_get_text_size_internal(&width, NULL, scaleX, scaleY, -1, text); 497 | return width; 498 | } 499 | 500 | float pp2d_get_wtext_height(const wchar_t* text, float scaleX, float scaleY) 501 | { 502 | u32 size = wcslen(text) * sizeof(wchar_t); 503 | char buf[size]; 504 | memset(buf, 0, size); 505 | utf32_to_utf8((uint8_t*)buf, (uint32_t*)text, size); 506 | buf[size - 1] = '\0'; 507 | 508 | float height; 509 | pp2d_get_text_size_internal(NULL, &height, scaleX, scaleY, -1, buf); 510 | return height; 511 | } 512 | 513 | float pp2d_get_wtext_width(const wchar_t* text, float scaleX, float scaleY) 514 | { 515 | u32 size = wcslen(text) * sizeof(wchar_t); 516 | char buf[size]; 517 | memset(buf, 0, size); 518 | utf32_to_utf8((uint8_t*)buf, (uint32_t*)text, size); 519 | buf[size - 1] = '\0'; 520 | 521 | float width; 522 | pp2d_get_text_size_internal(&width, NULL, scaleX, scaleY, -1, buf); 523 | return width; 524 | } 525 | 526 | void pp2d_load_texture_memory(size_t id, void* buf, u32 width, u32 height) 527 | { 528 | u32 w_pow2 = pp2d_get_next_pow2(width); 529 | u32 h_pow2 = pp2d_get_next_pow2(height); 530 | 531 | C3D_TexInit(&textures[id].tex, (u16)w_pow2, (u16)h_pow2, GPU_RGBA8); 532 | C3D_TexSetFilter(&textures[id].tex, GPU_NEAREST, GPU_NEAREST); 533 | 534 | textures[id].allocated = true; 535 | textures[id].width = width; 536 | textures[id].height = height; 537 | 538 | memset(textures[id].tex.data, 0, textures[id].tex.size); 539 | for (u32 i = 0; i < width; i++) 540 | { 541 | for (u32 j = 0; j < height; j++) 542 | { 543 | u32 dst = ((((j >> 3) * (w_pow2 >> 3) + (i >> 3)) << 6) + ((i & 1) | ((j & 1) << 1) | ((i & 2) << 1) | ((j & 2) << 2) | ((i & 4) << 2) | ((j & 4) << 3))) * 4; 544 | u32 src = (j * width + i) * 4; 545 | 546 | memcpy(textures[id].tex.data + dst, buf + src, 4); 547 | } 548 | } 549 | 550 | C3D_TexFlush(&textures[id].tex); 551 | } 552 | 553 | void pp2d_load_texture_png(size_t id, const char* path) 554 | { 555 | if (id >= MAX_TEXTURES) 556 | return; 557 | 558 | u8* image; 559 | unsigned width; 560 | unsigned height; 561 | 562 | lodepng_decode32_file(&image, &width, &height, path); 563 | 564 | for (u32 i = 0; i < width; i++) 565 | { 566 | for (u32 j = 0; j < height; j++) 567 | { 568 | u32 p = (i + j*width) * 4; 569 | 570 | u8 r = *(u8*)(image + p); 571 | u8 g = *(u8*)(image + p + 1); 572 | u8 b = *(u8*)(image + p + 2); 573 | u8 a = *(u8*)(image + p + 3); 574 | 575 | *(image + p) = a; 576 | *(image + p + 1) = b; 577 | *(image + p + 2) = g; 578 | *(image + p + 3) = r; 579 | } 580 | } 581 | 582 | pp2d_load_texture_memory(id, image, width, height); 583 | free(image); 584 | } 585 | 586 | void pp2d_load_texture_png_memory(size_t id, void* buf, size_t buf_size) 587 | { 588 | if (id >= MAX_TEXTURES) 589 | return; 590 | 591 | u8* image; 592 | unsigned width; 593 | unsigned height; 594 | 595 | lodepng_decode32(&image, &width, &height, buf, buf_size); 596 | 597 | for (u32 i = 0; i < width; i++) 598 | { 599 | for (u32 j = 0; j < height; j++) 600 | { 601 | u32 p = (i + j*width) * 4; 602 | 603 | u8 r = *(u8*)(image + p); 604 | u8 g = *(u8*)(image + p + 1); 605 | u8 b = *(u8*)(image + p + 2); 606 | u8 a = *(u8*)(image + p + 3); 607 | 608 | *(image + p) = a; 609 | *(image + p + 1) = b; 610 | *(image + p + 2) = g; 611 | *(image + p + 3) = r; 612 | } 613 | } 614 | 615 | pp2d_load_texture_memory(id, image, width, height); 616 | free(image); 617 | } 618 | 619 | void pp2d_set_3D(int enable) 620 | { 621 | gfxSet3D(enable); 622 | } 623 | 624 | void pp2d_set_screen_color(gfxScreen_t target, u32 color) 625 | { 626 | C3D_RenderTargetSetClear(target == GFX_TOP ? topLeft : bot, C3D_CLEAR_ALL, color, 0); 627 | } 628 | 629 | static void pp2d_set_text_color(u32 color) 630 | { 631 | C3D_TexEnv* env = C3D_GetTexEnv(0); 632 | C3D_TexEnvSrc(env, C3D_RGB, GPU_CONSTANT, 0, 0); 633 | C3D_TexEnvSrc(env, C3D_Alpha, GPU_TEXTURE0, GPU_CONSTANT, 0); 634 | C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); 635 | C3D_TexEnvFunc(env, C3D_RGB, GPU_REPLACE); 636 | C3D_TexEnvFunc(env, C3D_Alpha, GPU_MODULATE); 637 | C3D_TexEnvColor(env, color); 638 | } 639 | 640 | void pp2d_texture_select(size_t id, int x, int y) 641 | { 642 | if (id >= MAX_TEXTURES) 643 | { 644 | textureData.initialized = false; 645 | return; 646 | } 647 | 648 | textureData.id = id; 649 | textureData.x = x; 650 | textureData.y = y; 651 | textureData.xbegin = 0; 652 | textureData.ybegin = 0; 653 | textureData.width = textures[id].width; 654 | textureData.height = textures[id].height; 655 | textureData.color = PP2D_NEUTRAL; 656 | textureData.fliptype = NONE; 657 | textureData.scaleX = 1; 658 | textureData.scaleY = 1; 659 | textureData.angle = 0; 660 | textureData.depth = DEFAULT_DEPTH; 661 | textureData.initialized = true; 662 | } 663 | 664 | void pp2d_texture_select_part(size_t id, int x, int y, int xbegin, int ybegin, int width, int height) 665 | { 666 | if (id >= MAX_TEXTURES) 667 | { 668 | textureData.initialized = false; 669 | return; 670 | } 671 | 672 | textureData.id = id; 673 | textureData.x = x; 674 | textureData.y = y; 675 | textureData.xbegin = xbegin; 676 | textureData.ybegin = ybegin; 677 | textureData.width = width; 678 | textureData.height = height; 679 | textureData.color = PP2D_NEUTRAL; 680 | textureData.fliptype = NONE; 681 | textureData.scaleX = 1; 682 | textureData.scaleY = 1; 683 | textureData.angle = 0; 684 | textureData.depth = DEFAULT_DEPTH; 685 | textureData.initialized = true; 686 | } 687 | 688 | void pp2d_texture_blend(u32 color) 689 | { 690 | textureData.color = color; 691 | } 692 | 693 | void pp2d_texture_scale(float scaleX, float scaleY) 694 | { 695 | textureData.scaleX = scaleX; 696 | textureData.scaleY = scaleY; 697 | } 698 | 699 | void pp2d_texture_flip(flipType fliptype) 700 | { 701 | textureData.fliptype = fliptype; 702 | } 703 | 704 | void pp2d_texture_rotate(float angle) 705 | { 706 | textureData.angle = angle; 707 | } 708 | 709 | void pp2d_texture_depth(float depth) 710 | { 711 | textureData.depth = depth; 712 | } 713 | 714 | void pp2d_texture_draw(void) 715 | { 716 | if (!textureData.initialized) 717 | return; 718 | 719 | if ((textVtxArrayPos+4) >= TEXT_VTX_ARRAY_COUNT) 720 | return; 721 | 722 | size_t id = textureData.id; 723 | 724 | float left = (float)textureData.xbegin / (float)textures[id].tex.width; 725 | float right = (float)(textureData.xbegin + textureData.width) / (float)textures[id].tex.width; 726 | float top = (float)(textures[id].tex.height - textureData.ybegin) / (float)textures[id].tex.height; 727 | float bottom = (float)(textures[id].tex.height - textureData.ybegin - textureData.height) / (float)textures[id].tex.height; 728 | 729 | // scaling 730 | textureData.height *= textureData.scaleY; 731 | textureData.width *= textureData.scaleX; 732 | 733 | float vert[4][2] = { 734 | { textureData.x, textureData.height + textureData.y}, 735 | {textureData.width + textureData.x, textureData.height + textureData.y}, 736 | { textureData.x, textureData.y}, 737 | {textureData.width + textureData.x, textureData.y}, 738 | }; 739 | 740 | // flipping 741 | if (textureData.fliptype == BOTH || textureData.fliptype == HORIZONTAL) 742 | { 743 | float tmp = left; 744 | left = right; 745 | right = tmp; 746 | } 747 | 748 | if (textureData.fliptype == BOTH || textureData.fliptype == VERTICAL) 749 | { 750 | float tmp = top; 751 | top = bottom; 752 | bottom = tmp; 753 | } 754 | 755 | // rotating 756 | textureData.angle = fmod(textureData.angle, 360); 757 | if (textureData.angle != 0) 758 | { 759 | const float rad = textureData.angle/(180/M_PI); 760 | const float c = cosf(rad); 761 | const float s = sinf(rad); 762 | 763 | const float xcenter = textureData.x + textureData.width/2.0f; 764 | const float ycenter = textureData.y + textureData.height/2.0f; 765 | 766 | for (int i = 0; i < 4; i++) 767 | { 768 | float oldx = vert[i][0]; 769 | float oldy = vert[i][1]; 770 | 771 | float newx = c * (oldx - xcenter) - s * (oldy - ycenter) + xcenter; 772 | float newy = s * (oldx - xcenter) + c * (oldy - ycenter) + ycenter; 773 | 774 | vert[i][0] = newx; 775 | vert[i][1] = newy; 776 | } 777 | } 778 | 779 | // blending 780 | C3D_TexBind(0, &textures[id].tex); 781 | C3D_TexEnv* env = C3D_GetTexEnv(0); 782 | C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE0, GPU_CONSTANT, 0); 783 | C3D_TexEnvOp(env, C3D_Both, 0, 0, 0); 784 | C3D_TexEnvFunc(env, C3D_Both, GPU_MODULATE); 785 | C3D_TexEnvColor(env, textureData.color); 786 | 787 | // rendering 788 | pp2d_add_text_vertex(vert[0][0], vert[0][1], textureData.depth, left, bottom); 789 | pp2d_add_text_vertex(vert[1][0], vert[1][1], textureData.depth, right, bottom); 790 | pp2d_add_text_vertex(vert[2][0], vert[2][1], textureData.depth, left, top); 791 | pp2d_add_text_vertex(vert[3][0], vert[3][1], textureData.depth, right, top); 792 | 793 | C3D_DrawArrays(GPU_TRIANGLE_STRIP, textVtxArrayPos - 4, 4); 794 | } 795 | -------------------------------------------------------------------------------- /Breakout/source/ishupe.cpp: -------------------------------------------------------------------------------- 1 | #include "Breakout.hpp" 2 | #include "ishupe.hpp" 3 | #include "objects.hpp" 4 | 5 | bool off_screen(ball &object) { 6 | return ((object.x + object.width <= 0) || 7 | (object.x - object.width >= 400) || 8 | (object.y + object.height <= 0) || 9 | (object.y - object.height >= 240)); 10 | } 11 | 12 | void movePaddle(bool right, paddle &the_paddle, std::vector &ball_vec) { 13 | int x = (3 * (right ? (the_paddle.x < paddleMax(the_paddle) ? 1 : 0) : (the_paddle.x > 1 ? -1 : 0))); 14 | for (auto &tBall : ball_vec) 15 | if (x != 0 && tBall.is_attached) tBall.move(x, 0.0); 16 | the_paddle.x += x; 17 | } 18 | 19 | void setBallDirection(ball &tBall, double speed) { 20 | tBall.dx = speed * cos(tBall.angle * (M_PI / 180.0)); 21 | tBall.dy = speed * sin(tBall.angle * (M_PI / 180.0)); 22 | } 23 | 24 | void moveBall(ball &tBall, bool &cMode) { 25 | tBall.move(tBall.dx / (cMode ? O3DS_CHECKS : N3DS_CHECKS), tBall.dy / (cMode ? O3DS_CHECKS : N3DS_CHECKS)); 26 | } 27 | 28 | void setNewBallAngle(double &angle) { 29 | do angle = (rand() % 90) + 225.0; 30 | while (angle > 265 && angle < 275); 31 | } 32 | 33 | void setAngleGood(double &angle) { 34 | while (angle < 0) angle += 360; 35 | while (angle > 360) angle -= 360; 36 | } 37 | -------------------------------------------------------------------------------- /Breakout/source/objects.cpp: -------------------------------------------------------------------------------- 1 | #include "Breakout.hpp" 2 | #include "objects.hpp" 3 | 4 | size_t brick_texture_by_type[brick_types] = { 5 | 0, 6 | 1, 2, 3, 4, 5, 7 | 10, 11, 12, 13, 14, 8 | 15 9 | }; 10 | 11 | size_t brick_second_texture_by_type[brick_types] = { 12 | 0, 13 | 0, 0, 0, 0, 0, 14 | 0, 6, 7, 8, 9, 15 | 0 16 | }; 17 | int brick_point_value[brick_types] = { 18 | 0, 19 | 0, 10, 15, 20, 25, 20 | 0, 20, 30, 40, 50, 21 | 1000000 22 | }; 23 | 24 | std::vector ball_texture_id = { 25 | 0, &ball00ID 26 | }; 27 | 28 | std::vector*> powerup_texture_id = { 29 | &pLaserID, 30 | &pPaddleBigID, 31 | &pPaddleSmallID, 32 | &pLifeID, 33 | &pMultiBallID 34 | }; 35 | 36 | size_t stZ = 0; 37 | -------------------------------------------------------------------------------- /Breakout/source/vshader.v.pica: -------------------------------------------------------------------------------- 1 | ; Uniforms 2 | .fvec projection[4] 3 | 4 | ; Constants 5 | .constf myconst(0.0, 1.0, -1.0, 0.1) 6 | .constf RGBA_TO_FLOAT4(0.00392156862, 0, 0, 0) 7 | .alias zeros myconst.xxxx ; Vector full of zeros 8 | .alias ones myconst.yyyy ; Vector full of ones 9 | 10 | ; Outputs 11 | .out outpos position 12 | .out outclr color 13 | .out outtc0 texcoord0 14 | 15 | ; Inputs (defined as aliases for convenience) 16 | .alias inpos v0 17 | .alias intex v1 18 | 19 | .bool test 20 | 21 | .proc main 22 | ; Force the w component of inpos to be 1.0 23 | mov r0.xyz, inpos 24 | mov r0.w, ones 25 | 26 | ; outpos = projectionMatrix * inpos 27 | dp4 outpos.x, projection[0], r0 28 | dp4 outpos.y, projection[1], r0 29 | dp4 outpos.z, projection[2], r0 30 | dp4 outpos.w, projection[3], r0 31 | 32 | ;outtc0 = intexcoord 33 | mov outtc0, intex 34 | 35 | ;outclr 36 | mul outclr, RGBA_TO_FLOAT4.xxxx, intex 37 | 38 | end 39 | .end -------------------------------------------------------------------------------- /BreakoutLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/BreakoutLeft.png -------------------------------------------------------------------------------- /BreakoutRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magicrafter13/Breakout/15d37916ad5fb9fa437fbcd14a15d2064026dc18/BreakoutRight.png -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at scubaventure101@hotmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | I am open to everyone contributing: Now I don't necessarily mean actually modifying the code, but rather suggesting code for me to implement. Since I'm new to coding in c and c++ I'll always try a suggestion. 2 | 3 | Although before just suggesting random things, please check out the issue's page and see if there's anything you can help with. Then you can suggest things. 4 | 5 | I don't have time for creating the wiki, but if anyone has suggestions for articles/pages to add, I'll review them and if I think they're good then I'll add them, and credit you. 6 | 7 | [Oh yeah, and people with code suggestions and people who help with Issue's will be added in the credits page.] 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ATTENTION 2 | This software is no longer being maintained, and most likely will never be changed again. The new project can be found here: [Breakout Redux](https://github.com/Magicrafter13/BreakoutRedux) 3 | For preservation's sake, and for myself if I ever want to check tou my old projects these are the requirements to compile this software. 4 | 5 | - [libctru 1.4.0](https://github.com/devkitPro/libctru/releases/tag/v1.4.0) 6 | - [citro3d 1.3.1](https://github.com/devkitPro/citro3d/releases/tag/v1.3.1) 7 | - zlib from [3ds_portlibs](https://github.com/devkitPro/3ds_portlibs) (Good luck with this one...) 8 | 9 | # Breakout 10 | A simple Breakout clone for the 3DS [Uses pp2d, citro3d, and of course ctrulib.] 11 | 12 | -Written by Magicrafter13 [Matthew Rease]. 13 | 14 | ### Screenshots 15 | 16 | ![Screenshot1](/BreakoutLeft.png) ![Screenshot2](/BreakoutRight.png) 17 | 18 | 19 | # Play 20 | To play this, just download a precompiled binary (3dsx, cia, or elf) from the releases tab. 21 | 22 | ## Controls 23 | #### In - Game #### 24 | * __D-Pad__ or Joystick to move Left and Right 25 | * __A Button__ to launch ball (when ball attached) or shoot laser if power up has been acquired. 26 | * __Select__ to start game (or return to title) 27 | * __Y__ to open Level editor 28 | * __Start__ to exit 29 | 30 | #### In Level Editor #### 31 | * __D-Pad__ or __Joystick__ to move cursor 32 | * __L__ and __R__ to switch brick type 33 | * __X__ to save level layout 34 | * __B__ or __Start__ to return to title 35 | * __Y__ to randomize brick layout 36 | * __Select__ play your level 37 | 38 | ## "Nightlies" 39 | Available on my website. [Click Here!](http://oldforgeinn.ddns.net/Games/?game=Breakout#download) 40 | 41 | # Edit / self-compile 42 | You will need the following libraries to compile this: 43 | [pp2d](https://github.com/BernardoGiordano/pp2d) 44 | [ctrulib](https://github.com/Smealum/ctrulib) (If you don't have this, you are either new to 3ds homebrew or you're just crazy. 45 | If you've set up homebrew environment, you have this.) 46 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman --------------------------------------------------------------------------------