12 |
// |
// |
13 |
// $Id$ |
// $Id$ |
14 |
// $Log$ |
// $Log$ |
15 |
|
// Revision 1.8 2004/12/26 08:58:16 skunix |
16 |
|
// removed all std::cout |
17 |
|
// |
18 |
// Revision 1.7 2004/12/26 08:03:34 skunix |
// Revision 1.7 2004/12/26 08:03:34 skunix |
19 |
// changed lambda::bind's to boost::binds |
// changed lambda::bind's to boost::binds |
20 |
// |
// |
31 |
#include "log.hpp" |
#include "log.hpp" |
32 |
#include "texture.hpp" |
#include "texture.hpp" |
33 |
#include <stdexcept> |
#include <stdexcept> |
|
#include <iostream> |
|
34 |
#include <boost/format.hpp> |
#include <boost/format.hpp> |
35 |
#include <boost/filesystem/operations.hpp> |
#include <boost/filesystem/operations.hpp> |
36 |
#include <memory> |
#include <memory> |
90 |
Usata::setup_video() |
Usata::setup_video() |
91 |
{ |
{ |
92 |
ConfigSection conf("video"); |
ConfigSection conf("video"); |
93 |
|
log::Stream2 logstream(log::Level::INFO); |
94 |
|
|
95 |
std::string mode_string = conf.get("mode", std::string(DEFAULT_VIDEO_MODE)); |
std::string mode_string = conf.get("mode", std::string(DEFAULT_VIDEO_MODE)); |
96 |
parsed_video_mode mode(parse_video_mode(mode_string)); |
parsed_video_mode mode(parse_video_mode(mode_string)); |
97 |
|
|
98 |
if (!mode.get<0>()) |
if (!mode.get<0>()) |
99 |
throw std::runtime_error("yay!"); |
throw std::runtime_error("yay!"); |
100 |
|
|
101 |
|
logstream << boost::format("requested video mode %1%x%2%") % mode.get<1>() |
102 |
|
% mode.get<2>() << log::Commit; |
103 |
|
|
|
std::cout << boost::format("Height: %1%\nWidth: %2%") % mode.get<1>() |
|
|
% mode.get<2>() <<std::endl; |
|
104 |
system::VideoMode vm(mode.get<1>(), mode.get<2>(), false); |
system::VideoMode vm(mode.get<1>(), mode.get<2>(), false); |
105 |
vm = scan_modes(vm); |
|
106 |
std::cout << "going with " << vm.width << "x" << vm.height <<std::endl; |
system::VideoMode vm2 = scan_modes(vm); |
107 |
set_mode(vm); |
if (vm2 == vm) |
108 |
|
logstream << "mode checks out." << log::Commit; |
109 |
|
else |
110 |
|
{ |
111 |
|
logstream << "scan_modes() suggests " << vm2.width << "x" << vm2.height << log::Commit; |
112 |
|
} |
113 |
|
set_mode(vm2); |
114 |
|
|
115 |
} |
} |
116 |
int |
int |
118 |
{ |
{ |
119 |
setup_video(); |
setup_video(); |
120 |
boost::filesystem::path datapath = find_data(); |
boost::filesystem::path datapath = find_data(); |
|
std::cout << datapath.string() <<std::endl; |
|
121 |
// FIXME: catch exceptions |
// FIXME: catch exceptions |
122 |
texture_manager->load_path(datapath); |
texture_manager->load_path(datapath); |
123 |
|
|