Skip to content

Commit d64e3d7

Browse files
authored
Merge pull request #8 from cortex-command-community/development
Merge v2.0.0 into Master
2 parents 5e4a253 + 0319b82 commit d64e3d7

32 files changed

+1948
-933
lines changed

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
/.bmx
2+
\.bmx
23
*.exe
34
*.bak
45
*.png
56
*.bmp
67

7-
!test-image.bmp
8-
!input-template.bmp
8+
*.code-workspace
9+
.vscode/
10+
11+
BenderUserSettings.ini
12+
!TestImage.png
13+
!InputTemplate.png

Assets/Logo

18.1 KB
Binary file not shown.
File renamed without changes.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Welcome to the CCCP Bender utility!
1+
Welcome to the Cortex Command Bender utility!
22

33
It's purpose is to make the life of modders easier by automagically generating bent limb frames.
44

55
The CC Bender was originally created by Arne Jansson (AndroidArts), the man behind all the Cortex Command artwork.
6-
The CCCommunityProject Bender, however, is a brand new tool that allows more control and convenience for the modder (hopefully).
6+
This version, however, is a brand new tool that allows more control and convenience for the modder (hopefully).
77

88
Arne's original bend code was used as base for this utility, and has been modified and improved to enable the new features.
99

10-
Created by MaximDude using BlitzMax 0.105.3.35 and MaxIDE 1.52
11-
Bender logo image by Arne Jansson - Edited by MaximDude
10+
Created using BlitzMax NG 0.129
11+
Bender logo image by Arne Jansson

Assets/TextHelp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Basic Controls:
2+
• Load
3+
Loads an image file and starts bending. Supported formats are BMP, PNG and JPG/JPEG. Files can also be loaded by dragging and dropping them into the main window.
4+
The loaded file is being cut to 24x24px tiles internally. A file that is not the correct dimensions will be rejected. For best results, use provided template to create correct input files.
5+
6+
• Save
7+
Saves the bended limbs into a new file (or multiple files if saving as frames) with the specified name. Typing the file extension is not needed. The currently loaded file cannot be overwritten.
8+
9+
Editor Settings:
10+
• Background Color (R, G, B)
11+
Changes the background color of the output. When saving file, the output will automatically set background color to magenta (255, 0, 255) so no manual setting before saving is needed.
12+
13+
• Input Zoom
14+
Magnifies the source image for easier placement of joint markers. Changing zoom level will reset the joint markers to initial positions.
15+
Does not magnify the output. Accepts values from 1 to a maximum value calculated from the desktop width.
16+
17+
• Output Zoom
18+
Magnifies the bend limb output for easier examination. Does not affect saved files, they will be saved at original dimensions. Accepts values from 1 to 5.
19+
When zoomed, the output area can be panned by clicking and dragging so all the output that does not fit the window can be examined.
20+
21+
• Frame Count
22+
Sets the amount of frames output will generate. Limb bending will automatically adjust to number of frames. Accepts values from 1 to 20.
23+
24+
• Save As Indexed
25+
Sets the output to be saved as an indexed color file indexed to the CC palette, otherwise the output will be saved as a non-indexed PNG.
26+
When ticked, a combobox with the available file formats will appear. The selected item in the box will be the one used for saving (PNG by default).
27+
28+
• Save As Frames
29+
Sets each frame in the output to be exported as an individual file. A bounding box will be shown around each frame to help user stay within bounds.
30+
The content within the bounds is then cropped to actual dimensions (all empty space will be trimmed).
31+
When saving as frames, do not manually add limb name or frame number to the file name! This is done automatically! DOING SO WILL RESULT IS HORRIBLE HORRIBLE EXPORTED FILE NAMES!
32+
33+
Adjusting Joints:
34+
• To adjust the joint positioning on a limb part, click the joint marker on and drag it, or click at desired point to set it there. Output will update automatically as you adjust the markers.
35+
Note that the lower joint marker only adjusts the length of the limb part, not it's position.
36+
37+
Layering Controls:
38+
• Adjust the draw order of the limb parts in a limb by ticking the checkbox of that limb. Lower parts are drawn on top by default.
39+
40+
Saving Settings as User Defaults:
41+
• The "Save Settings" button will save the current editor settings to a file. If this file exists, it will be automatically loaded on startup and apply the settings as defaults.

Bender.bmx

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
Rem
2+
██████  ██████  ██████  ████████ ███████ ██  ██  ██████  ██████  ███  ███ ███  ███  █████  ███  ██ ██████  ██████  ███████ ███  ██ ██████  ███████ ██████
3+
██      ██    ██ ██   ██    ██    ██       ██ ██   ██      ██    ██ ████  ████ ████  ████ ██   ██ ████  ██ ██   ██  ██   ██ ██      ████  ██ ██   ██ ██      ██   ██
4+
██  ██  ██ ██████   ██  █████   ███   ██  ██  ██ ██ ████ ██ ██ ████ ██ ███████ ██ ██  ██ ██  ██  ██████  █████  ██ ██  ██ ██  ██ █████  ██████
5+
██  ██  ██ ██   ██  ██  ██     ██ ██  ██  ██  ██ ██  ██  ██ ██  ██  ██ ██   ██ ██  ██ ██ ██  ██  ██   ██ ██     ██  ██ ██ ██  ██ ██     ██   ██
6+
 ██████  ██████  ██  ██  ██  ███████ ██   ██   ██████  ██████  ██      ██ ██      ██ ██  ██ ██   ████ ██████   ██████  ███████ ██   ████ ██████  ███████ ██  ██
7+
EndRem
8+
9+
SuperStrict
10+
11+
Import "EmbeddedAssets.bmx"
12+
Import "Types/UserInterface.bmx"
13+
Import "Types/FileIO.bmx"
14+
Import "Types/GraphicsOutput.bmx"
15+
16+
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17+
18+
AppTitle = "CC Bender 2.0.0" '4 Mar 2021
19+
20+
Global g_SettingsManager:SettingsManager = Null
21+
Global g_UserInterface:UserInterface = Null
22+
Global g_FileIO:FileIO = Null
23+
Global g_GraphicsOutput:GraphicsOutput = Null
24+
25+
'//// MAIN LOOP AND EVENT HANDLING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26+
27+
Repeat
28+
g_SettingsManager = New SettingsManager()
29+
g_UserInterface = New UserInterface(g_DefaultMaximizeWindow)
30+
g_FileIO = New FileIO()
31+
g_GraphicsOutput = New GraphicsOutput(g_UserInterface.GetMaxWorkspaceWidth(), g_UserInterface.GetCanvasVisibleArea())
32+
33+
'Apply user settings/defaults.
34+
g_UserInterface.SetColorTextboxValues(g_GraphicsOutput.SetBackgroundColor(Int[][g_DefaultBackgroundRed, g_DefaultBackgroundGreen, g_DefaultBackgroundBlue]))
35+
g_UserInterface.SetInputZoomTextboxValue(g_GraphicsOutput.SetInputZoom(g_DefaultInputZoom))
36+
g_UserInterface.SetOutputZoomTextboxValue(g_GraphicsOutput.SetOutputZoom(g_DefaultOutputZoom))
37+
g_UserInterface.SetFramesTextboxValue(g_GraphicsOutput.SetFrameCount(g_DefaultFrameCount))
38+
g_UserInterface.SetSaveAsFramesCheckboxValue(g_GraphicsOutput.SetDrawOutputFrameBounds(g_FileIO.SetSaveAsFrames(g_DefaultSaveAsFrames)))
39+
g_UserInterface.SetFileTypeComboBoxVisible(g_UserInterface.SetSaveAsIndexedCheckboxValue(g_FileIO.SetSaveAsIndexed(g_DefaultSaveAsIndexed)))
40+
g_UserInterface.SetFileTypeComboBoxSelectedItem(g_FileIO.SetIndexedFileType(g_DefaultIndexedFileType))
41+
42+
Local refreshTimer:TTimer = CreateTimer(g_DefaultOutputRefreshRate)
43+
Local refreshOutput:Int = False
44+
45+
EnablePolledInput()
46+
47+
Repeat
48+
refreshOutput = False
49+
PollEvent()
50+
51+
Select EventID()
52+
Case EVENT_TIMERTICK
53+
Select EventSource()
54+
Case refreshTimer
55+
refreshOutput = True
56+
EndSelect
57+
Case EVENT_APPRESUME
58+
ActivateWindow(g_UserInterface.m_MainWindow)
59+
ActivateGadget(g_UserInterface.m_CanvasGraphics)
60+
Case EVENT_WINDOWSIZE
61+
g_GraphicsOutput.SetCanvasVisibleArea(g_UserInterface.ProcessWindowResize())
62+
Case EVENT_WINDOWACCEPT
63+
g_GraphicsOutput.LoadFile(g_FileIO.SetFileToLoad(EventExtra().ToString()))
64+
Case EVENT_MENUACTION
65+
Select EventData()
66+
Case g_UserInterface.c_SaveSettingsMenuTag
67+
g_SettingsManager.WriteSettingsFile(g_UserInterface.GetSettingsValuesForSaving())
68+
Case g_UserInterface.c_HelpMenuTag
69+
Notify(g_UserInterface.m_HelpMenuText, False)
70+
Case g_UserInterface.c_AboutMenuTag
71+
Notify(g_UserInterface.m_AboutMenuText, False)
72+
EndSelect
73+
Case EVENT_GADGETACTION
74+
Select EventSource()
75+
'Loading.
76+
Case g_UserInterface.m_LoadButton
77+
g_UserInterface.SetSaveButtonEnabled(g_GraphicsOutput.LoadFile(g_FileIO.SetFileToLoad()))
78+
'Saving.
79+
Case g_UserInterface.m_SaveButton
80+
If g_FileIO.GetSaveAsFrames() Then
81+
g_GraphicsOutput.RevertBackgroundColorAfterSave(g_FileIO.SaveFileAsFrames(g_GraphicsOutput.GrabOutputFramesForSaving(), g_GraphicsOutput.GetFrameCount()))
82+
Else
83+
g_GraphicsOutput.RevertBackgroundColorAfterSave(g_FileIO.SaveFile(g_GraphicsOutput.GrabOutputForSaving()))
84+
EndIf
85+
Continue
86+
'Input Scale.
87+
Case g_UserInterface.m_SettingsInputZoomTextbox
88+
g_UserInterface.SetInputZoomTextboxValue(g_GraphicsOutput.SetInputZoom(g_UserInterface.GetInputZoomTextboxValue()))
89+
'Output Scale.
90+
Case g_UserInterface.m_SettingsOutputZoomTextbox
91+
g_UserInterface.SetOutputZoomTextboxValue(g_GraphicsOutput.SetOutputZoom(g_UserInterface.GetOutputZoomTextboxValue()))
92+
'Frames.
93+
Case g_UserInterface.m_SettingsFramesTextbox
94+
g_UserInterface.SetFramesTextboxValue(g_GraphicsOutput.SetFrameCount(g_UserInterface.GetFramesTextboxValue()))
95+
'BG Color.
96+
Case g_UserInterface.m_SettingsColorRTextbox, g_UserInterface.m_SettingsColorGTextbox, g_UserInterface.m_SettingsColorBTextbox
97+
g_UserInterface.SetColorTextboxValues(g_GraphicsOutput.SetBackgroundColor(g_UserInterface.GetColorTextboxValues()))
98+
'Save as Frames.
99+
Case g_UserInterface.m_SettingsSaveAsFramesCheckbox
100+
g_GraphicsOutput.SetDrawOutputFrameBounds(g_FileIO.SetSaveAsFrames(g_UserInterface.GetSaveAsFramesCheckboxValue()))
101+
'Save as Indexed.
102+
Case g_UserInterface.m_SettingsIndexedCheckbox
103+
g_UserInterface.SetFileTypeComboBoxVisible(g_FileIO.SetSaveAsIndexed(g_UserInterface.GetSaveAsIndexedCheckboxValue()))
104+
'Indexed Filetype.
105+
Case g_UserInterface.m_SettingsIndexedFileTypeComboBox
106+
g_FileIO.SetIndexedFileType(GadgetText(g_UserInterface.m_SettingsIndexedFileTypeComboBox))
107+
'Layering Controls.
108+
Case g_UserInterface.m_LayeringArmFGCheckbox, g_UserInterface.m_LayeringArmBGCheckbox, g_UserInterface.m_LayeringLegFGCheckbox, g_UserInterface.m_LayeringLegBGCheckbox
109+
g_GraphicsOutput.SetBentLimbPartDrawOrder(g_UserInterface.SetLayerCheckboxLabels(g_UserInterface.GetLayerCheckboxValues()))
110+
EndSelect
111+
Case EVENT_KEYDOWN
112+
If g_UserInterface.GetSaveButtonEnabled() And (KeyDown(KEY_LCONTROL) Or KeyDown(KEY_RCONTROL)) And KeyDown(KEY_S) Then
113+
If g_FileIO.GetSaveAsFrames() Then
114+
g_GraphicsOutput.RevertBackgroundColorAfterSave(g_FileIO.SaveFileAsFrames(g_GraphicsOutput.GrabOutputFramesForSaving(), g_GraphicsOutput.GetFrameCount()))
115+
Else
116+
g_GraphicsOutput.RevertBackgroundColorAfterSave(g_FileIO.SaveFile(g_GraphicsOutput.GrabOutputForSaving()))
117+
EndIf
118+
FlushKeys()
119+
Continue
120+
EndIf
121+
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
122+
If Confirm("Quit program?") Then End
123+
EndSelect
124+
125+
g_GraphicsOutput.Update()
126+
If refreshOutput Then
127+
g_GraphicsOutput.Draw()
128+
EndIf
129+
Forever
130+
Forever

bender.ico renamed to Bender.ico

File renamed without changes.

Bender.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
app.version.name=2.0.0
2+
app.name=CC Bender
3+
app.description=Cortex Command Bender

EmbeddedAssets.bmx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'File assets to be embedded into the executable
2+
Incbin "Assets/Logo"
3+
Incbin "Assets/Palette"
4+
Incbin "Assets/TextAbout"
5+
Incbin "Assets/TextHelp"

InputTemplate.png

234 Bytes
Loading

0 commit comments

Comments
 (0)