Moved a tonne of code around

This commit is contained in:
2021-11-22 09:20:01 -08:00
parent fb454d98a4
commit 6d8fe79a76
227 changed files with 61 additions and 810 deletions

44
src/dawn/ui/breakpoint.c Normal file
View File

@ -0,0 +1,44 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "breakpoint.h"
void breakpointListInit(breakpointlist_t *list) {
list->breakpointCount = 0;
list->user = NULL;
list->onBreakpoint = NULL;
list->breakpointCurrent = 0x00;
}
uint8_t breakpointGet(breakpointlist_t *list, float width) {
uint8_t bp, i;
bp = 0xFF;
for(i = 0; i < list->breakpointCount; i++) {
if(list->breakpoints[i] > width) break;
bp = i;
}
if(bp == 0xFF) bp = 0;
return bp;
}
void breakpointAdd(breakpointlist_t *list, float width) {
list->breakpoints[list->breakpointCount++] = width;
}
void breakpointResize(breakpointlist_t *list, float width) {
uint8_t bp;
// Determine breakpoint
bp = breakpointGet(list, width);
if(list->breakpointCurrent == bp) return;
list->breakpointCurrent = bp;
// Fire event.
if(list->onBreakpoint != NULL) {
list->onBreakpoint(list->user, bp, list->breakpoints[bp]);
}
}