23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 * POSSIBILITY OF SUCH DAMAGE. |
25 * POSSIBILITY OF SUCH DAMAGE. |
26 */ |
26 */ |
27 |
27 |
28 #include "ascension/window.h" |
28 #include <ascension/ascension.h> |
29 |
29 |
30 static bool show_message_box_on_error(SDL_Window* window) { |
30 static bool show_message_box_on_error(SDL_Window* window) { |
31 if (asc_has_error()) { |
31 if (asc_has_error()) { |
32 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, |
32 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, |
33 "Fatal Error", |
33 "Fatal Error", |
46 |
46 |
47 AscWindowSettings settings; |
47 AscWindowSettings settings; |
48 asc_window_settings_init_defaults(&settings); |
48 asc_window_settings_init_defaults(&settings); |
49 settings.title = "Sandbox Application"; |
49 settings.title = "Sandbox Application"; |
50 |
50 |
51 AscWindow window; |
51 AscWindow *window = asc_window_initialize(0, &settings); |
52 asc_window_initialize(&window, &settings); |
|
53 |
52 |
54 while (asc_loop_next()) { |
53 while (asc_loop_next()) { |
55 // quit application on any error |
54 // quit application on any error |
56 if (show_message_box_on_error(window.window)) break; |
55 if (show_message_box_on_error(window->window)) break; |
57 |
56 |
58 |
57 |
59 } |
58 } |
60 |
59 |
61 asc_context_destroy(); |
60 asc_context_destroy(); |