git.ucc.asn.au
/
atyndall
/
cits2231.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a80b904
)
Completed menu functionality, added two functions roundUp and makeSubmenuFromArray...
author
Ash Tyndall
<
[email protected]
>
Sat, 8 Oct 2011 07:01:40 +0000
(15:01 +0800)
committer
Ash Tyndall
<
[email protected]
>
Sat, 8 Oct 2011 07:01:40 +0000
(15:01 +0800)
scene.c
patch
|
blob
|
history
diff --git
a/scene.c
b/scene.c
index
602dc49
..
f9df3c8
100644
(file)
--- a/
scene.c
+++ b/
scene.c
@@
-246,6
+246,12
@@
void processLightEvents(int id) {
\r
}
\r
\r
\r
}
\r
\r
+/**
\r
+ * Rounds up numbers, from http://stackoverflow.com/questions/3407012/c-rounding-up-to-the-nearest-multiple-of-a-number
\r
+ * @param numToRound Number to round
\r
+ * @param multiple Multiple to round up to
\r
+ * @return Rounded number
\r
+ */
\r
int roundUp(int numToRound, int multiple) {
\r
if(multiple == 0) {
\r
return numToRound;
\r
int roundUp(int numToRound, int multiple) {
\r
if(multiple == 0) {
\r
return numToRound;
\r
@@
-257,6
+263,14
@@
int roundUp(int numToRound, int multiple) {
return numToRound + multiple - remainder;
\r
}
\r
\r
return numToRound + multiple - remainder;
\r
}
\r
\r
+/**
\r
+ * Makes a submenu from an array of items, splitting the list into subsubmenus
\r
+ * of only 10 items.
\r
+ * @param menuEntries Array of menu items
\r
+ * @param menuEntriesSize Size of menuEntries
\r
+ * @param callback Callback function for this array of menu items
\r
+ * @return Reference to menu created
\r
+ */
\r
int makeSubmenuFromArray( const char *menuEntries[], unsigned int menuEntriesSize, void *callback ) {
\r
if ( menuEntriesSize == 0 ) return -1;
\r
\r
int makeSubmenuFromArray( const char *menuEntries[], unsigned int menuEntriesSize, void *callback ) {
\r
if ( menuEntriesSize == 0 ) return -1;
\r
\r
@@
-270,7
+284,7
@@
int makeSubmenuFromArray( const char *menuEntries[], unsigned int menuEntriesSiz
if ( j == menuEntriesSize ) break; // Detect if we've reached the end of the array
\r
glutAddMenuEntry( menuEntries[j], j + 1 );
\r
}
\r
if ( j == menuEntriesSize ) break; // Detect if we've reached the end of the array
\r
glutAddMenuEntry( menuEntries[j], j + 1 );
\r
}
\r
- }
\r
+ }
\r
\r
int mainMenu = glutCreateMenu(callback);
\r
for ( int i = 0; i < menuNumber; i++ ) {
\r
\r
int mainMenu = glutCreateMenu(callback);
\r
for ( int i = 0; i < menuNumber; i++ ) {
\r
UCC
git Repository :: git.ucc.asn.au